-
Notifications
You must be signed in to change notification settings - Fork 14.9k
[MLIR][Python] enable type stub auto-generation #155741
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
92b0650
to
7e6569c
Compare
010201c
to
9fe2cb4
Compare
386009c
to
62a9f40
Compare
This is awesome! Do we know if the generated stubs are correct? I have set up a CI job for a small MLIR project that uses Also, maybe we can ask the nanobind devs if they have an estimate on when the new release comes out and wait for that to happen. |
Yea I saw you'd hand-written some signatures and I was planning on doing the same (though in a follow-up PR). But the patterns file looks like a winner so I'll do that instead.
Yea I asked and it's like 1-2 weeks away so we could wait - I'm just impatient sometimes :) |
655e9bf
to
8395098
Compare
This PR turns on automatic type stub generation (rather than relying on hand-written/updated stubs). It uses nanobind's stubgen facility.
Note, the only catch is we need a quite recent version of that code - specifically we need a commit of nanobind that includes wjakob/nanobind@53dce4e. In conventional
requirements.txt
files it's no issue to depend directly on a GitHub git commit (which I've done formlir/python/requirements.txt
) but such dependencies don't supportpip hash
(ironically). To workaround this I've temporarily updated.ci/monolithic-linux.sh
and.ci/monolithic-windows.sh
to explicitly install the appropriate commit of nanobind for our CI. When nanobind does its next PyPI release (which will contain the required53dce4e
commit), I'll updatemlir/python/requirements.txt
and.ci/all_requirements.txt
and restore the monolithic scripts.