All-encompassing Auto-completeīecause we do not remove Maya’s site-packages folder, if there are other packages or modules installed there you will get auto-complete for them also since they are all still on the pythonpath. Why don’t we need to solve the conflict problem here? More on that in a bit. This removal step was always unintuitive but necessary so as to avoid conflicts between the stub files and the same modules found in Maya’s site-packages folder. Previously it was suggested to do all of the steps above, but then also remove Maya’s site-packages folder from the interpreter paths to set up auto-complete properly. This first reason is admittedly minor, but it is more direct than popular recommendations in the past. There were a lot of steps here, but this is extremely straightforward after you’ve done it once. Press “OK” on all windows until your settings updates have been accepted.Navigate to the “pyi” stubs folder that we made previously, wherever you decided to keep it.Press the “+” button to add a new path.This time, press the tree, “Show paths for the selected interpreter”, button.Select your newly renamed Python Interpreter again from the previous window.I like to follow the template of “ExeName AppVersion PythonVersion”, i.e. Rename it to something more descriptive.Press the pencil, “Edit”, button to give it a better name.From the list of interpreters that appears, choose the one you just made.Press the “…” button to the right of the “Python Interpreter:” dropdown again.Navigate to your Maya installation’s bin folder and choose “mayapy.exe” (or “mayapy2.exe”).Press the “…” button to the right of the “Interpreter:” dropdown.Click on the “…” button to the right of the “Python Interpreter:” dropdown and choose “Add…”.In P圜harm’s Settings, go into “Project: ” and choose “Python Interpreter” from the left-side menu.If you’ve done this before using past approaches, this time will be slightly different because of pyi, so be sure to follow along. pyi files, it is time we set up our MayaPy interpreter in P圜harm. Now that you have a stubs folder full of. The most obvious place to put them is in the, otherwise empty, devkit folder in your Maya installation location. Rename_from_py_to_pyi(r'/Users/mat/py', r'/Users/mat/pyi')įind a nice home for these pyi stubs on your hard drive, as we will be using them when we set up our MayaPy interpreter. # Update below with the appropriate local paths for your machine import osĭef rename_from_py_to_pyi(py_dir, output_dir):įor root, _, files in os.walk(output_dir): Here is a short script to help you with the renaming. If you are on a version of Maya where the devkit doesn’t include pyi files, we can make them ourselves! All you need to do is rename the extension of the. So, if you see a folder named “pyi” in the devkit location from above, use it. There is a special kind of stub file P圜harm supports that we will take advantage of – pyi files! I reached out to Autodesk several years ago when I first learned of pyi files and asked them to begin including them with Maya distributions. With it downloaded, you’ll find the stub files at the following location inside: devkit/other/Python(x)/pymel/completion Download the appropriate one for your version of Maya from here. If you’re unfamiliar, the devkit contains autocomplete stubs for Maya’s Python modules. To get started, we’ll fetch Maya’s devkit. Today I will share how I set up P圜harm to work with MayaPy and how it enables a super-slick workflow for unit testing. Even just setting up an IDE with MayaPy has been a challenge through the years. The language supports many great workflows, but most are off-limits when working with Maya. Python is one of the most popular programming languages in the world as of 2022. There’s no denying – Maya makes development hard.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |