Skip to content

Use rst2pyi to generate type stubs and package - #1915

Merged
tannewt merged 3 commits into
adafruit:masterfrom
amyreese:rst2pyi
Jun 4, 2019
Merged

tannewt merged 3 commits into
adafruit:masterfrom
amyreese:rst2pyi

Conversation

@amyreese

Copy link
Copy Markdown

This adds a make stubs step that generates type stubs using rst2pyi, and then builds a source distribution containing these stubs for upload to PyPI. Type stubs are validated for correct syntax, but there are a number of failures right now due to documentation that does not use valid PEP 484 types, uses method instead of function for module-level callables, or otherwise contains invalid Python syntax. Running make stubs also warns about a number of "unmatched param directives" which should be individually investigated or addressed to determine if they are the fault of documentation or limitations in rst2pyi.

The PyPI package follows PEP 561, but uses my name/email as the author as I wasn't sure of what the correct maintainer name/email should be. I've also taken the liberty of uploading a preliminary version of the stubs package to PyPI to claim the circuitpython-stubs namespace. I'm more than happy to update the author/maintainer fields to whatever makes sense, and to add other owner/maintainer accounts to the package on PyPI.

@tannewt
tannewt self-requested a review May 30, 2019 20:52
@tannewt

tannewt commented May 30, 2019

Copy link
Copy Markdown
Member

Thanks for grabbing circuitpython-stubs! I'm tannewt on pypi too and I can add our adafruit accounts we have after I get additional ownership.

For author I'd do "CircuitPythonistas" and "[email protected]" for the email.

tannewt
tannewt previously approved these changes May 30, 2019

@tannewt tannewt left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm happy to pull this in as is. I'll take a look at fixing some of the errors as an example.

Comment thread requirements-dev.txt Outdated
@@ -0,0 +1 @@
rst2pyi=0.1.0 No newline at end of file

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this should be 0.3.0 because it's the latest at this time.

@amyreese

amyreese commented Jun 1, 2019

Copy link
Copy Markdown
Author

Added you as owner to the package on PyPI. I'll update the PR when I get the chance this weekend.

@tannewt tannewt left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great! Thank you!

@tannewt
tannewt merged commit c5a4e19 into adafruit:master Jun 4, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants