Maya 2024 stub files

I’m curious which IDE you use that supports @overload. Would be good for me to test with.

My whole studio uses VSCode. It seems to be one of the most popular out there and expandable.

I use the Neovim text editor with PyRight and MyPy Language Server plugins, but that’s a whole rabbit hole of basically relearning how to edit code. You probably shouldn’t mess with that JUST for testing. There’s a notoriously steep learning curve. I still think everybody should give it a try through! Once you learn it, it’s like magic!

Ok, stepping off the soapbox :wink:
PyRight is the LS that comes with vscode, so you could definitely test there.
And MyPy is the reference implementation of python static type checking. I was able to easily find a vscode plugin for that.
You may also want to test with Pyre from Facebook, but that seems a bit more involved to set up.

1 Like

Downloaded VS Code (Pylance) and pointed it to the stub files I have generated. It handles the overloaded methods really nicely.

vsCode_mayaOverload

It provides a nice page flipper widget for the different overloads. And once you have it filled in, it will know to only display the overload that is currently used.

One thing I notice right away though, is the docstring text formatting that Pycharm supports is not supported in VS Code - at least, with default settings. That’s why there’s ** for part of the docstring. That’s supposed to be bolded text.

After doing some more testing, looks like it’s best to make different versions for Pycharm and VS Code. They just do not render docstrings the same.

Hi @cgjedi !

Awesome work and may I suggest that you join this project: GitHub - LumaPictures/cg-stubs: Python stubs for VFX and Animation ? Would be great to have all the cg stubs we need under one “mother” project (If you want to keep it to yourself, I can totally understand though :smiley: )

Cheers,
Fabian

1 Like

I don’t actually support using pymel.

specifically formatted for VS Code:
API

Maya commands

specifically formatted for Pycharm:

API

Maya commands

2 Likes

Ah! The project I linked is indeed from Luma pictures but it is not about pymel. :slight_smile: Instead it it is about generating stubs for common python libraries from the VFX industry and makes them available on PYPI . For example pip install types-nuke types-mari gives you type hinting for Nuke and Mari. They are still missing maya.cmds, so I think you are pretty much a perfect fit for that project.
But I saw that you are not keen to go on GitHub, which I understand and respect. I will shut up now! :grimacing:

1 Like

First release!
Check it out.

Maya2024 stub files

9 Likes

Any comments by anyone who has tried these out?

So you don’t just get radio silence: I can say that the vscode style (haven’t tried the others) loads without error for me, and the docstrings show up. But I haven’t been doing maya cmds devopment for the past couple weeks to really put it through its paces.

Though it would be nice if you built stub-only wheels so the type info could be pip-installed. But that’s just mostly me being greedy :wink:

1 Like

Just to say that this is great!
Also python does support overloaded methods in pyi files you just need to mark them with the overload decorator from the typing module:

@typing.overload
def overloaded_fn(arg1: int) ->int:…

@typing.overload
def overloaded_fn(arg1: str) ->str:…

That should prompt your IDE to properly show overloaded argument signatures.

Also worth noting that pymel ships with its own stubs as of 2024.

1 Like

Thanks for generating stub files, I’ve been testing them in PyCharm and they work great!

I do have one question.
Are there stub files for OpenMaya 2.0?

Thanks for the kind words. Comments like yours make the effort worthwhile.
I haven’t done any for API 2.0, yet. I was waiting on the feedback for this first pass. I wanted to gauge how much it is used before putting in the added effort.

2 Likes

Maya2025 has been released. But Autodesk has not provided an offline download of the new docs. Really disappointed since I can’t generate new stub files until they do.

I got really surprising news from Autodesk today. I had put in a ticket request for offline documentation for Maya 2025. This is their reply:

I got feedback from the product team today. Unfortunately, they are unable to provide offline document for Maya 2025. Sorry for the bad news.

If you want stub files for Maya 2025, we need those offline docs. Please put in your own ticket request for the offline docs. Who knows, if enough people complain…

1 Like

That sounds … dumb. But I wouldn’t put it past Autodesk.
Could this just be “we can’t provide offline documentation right now”? :crossed_fingers: Hey, I can hope

And if worse comes to worst, you could just scrape the data from their website. I took a look at the website T&C, and I didn’t find any provisions for that. [EDIT: Nevermind, the help file links to a different T&C that does prohibit scraping] Though I did see that they put a header into the MEL docs that tells search engines not to index them. Which is probably why you still get Maya 2012 MEL docs when you search on Google.

I looked into scraping or copying the Autodesk docs website. Can’t do it. Lots of javascript code. My scripts rely on certain page structure and I’m not about to redo it all.

Good lord Autodesk - WHY?!