Skip to content
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

Publish type annotations #105

Closed
PeterJCLaw opened this issue Jan 3, 2024 · 2 comments · Fixed by #110
Closed

Publish type annotations #105

PeterJCLaw opened this issue Jan 3, 2024 · 2 comments · Fixed by #110

Comments

@PeterJCLaw
Copy link
Contributor

It would be great if pyroaring published type annotations, to enable type checking with e.g: mypy of usages.
I don't know if Cython supports automatically generating stubs from the source files, if it does that would be a neat way of keeping them in step.

@PeterJCLaw
Copy link
Contributor Author

Looks like there may be a number of tools which support auto-generation: cython/cython#3818 (comment). Not sure I know enough about the Cython side to know which might be compatible though.

@Ezibenroc
Copy link
Owner

Yes, that would be great, especially if the types are auto-generated!

PeterJCLaw added a commit to PeterJCLaw/PyRoaringBitMap that referenced this issue Jan 27, 2024
Annotate the existing tests so that they can act as validation
for the stubs, adding a tox environment which runs mypy to confirm.

Fixes Ezibenroc#105
PeterJCLaw added a commit to PeterJCLaw/PyRoaringBitMap that referenced this issue Jan 27, 2024
This adds type stubs to the published package, so that consumers
can benefit from type checking despite the cython implementation
of this package. The stubs are manually constructed as there does
not appear to be a mature solution which produces good stubs from
cython code. (It is actually unclear if such a solution is
possible without annotation of the cython source)

Validation of the stubs is achieved by annotating the tests and
relying on the existing test coverage to explore all relevant
members & operations. A new tox environment runs mypy against the
tests.

Fixes Ezibenroc#105
PeterJCLaw added a commit to PeterJCLaw/PyRoaringBitMap that referenced this issue Jan 27, 2024
This adds type stubs to the published package, so that consumers
can benefit from type checking despite the Cython implementation
of this package. The stubs are manually constructed as there does
not appear to be a mature solution which produces good stubs from
Cython code. (It is actually unclear if such a solution is
possible without annotation of the Cython source)

Validation of the stubs is achieved by annotating the tests and
relying on the existing test coverage to explore all relevant
members & operations. A new tox environment runs mypy against the
tests.

Fixes Ezibenroc#105
PeterJCLaw added a commit to PeterJCLaw/PyRoaringBitMap that referenced this issue Jan 27, 2024
This adds type stubs to the published package, so that consumers
can benefit from type checking despite the Cython implementation
of this package. The stubs are manually constructed as there does
not appear to be a mature solution which produces good stubs from
Cython code. (It is actually unclear if such a solution is
possible without annotation of the Cython source)

Validation of the stubs is achieved by annotating the tests and
relying on the existing test coverage to explore all relevant
members & operations. A new tox environment runs mypy against the
tests.

Fixes Ezibenroc#105
PeterJCLaw added a commit to PeterJCLaw/PyRoaringBitMap that referenced this issue Jan 27, 2024
This adds type stubs to the published package, so that consumers
can benefit from type checking despite the Cython implementation
of this package. The stubs are manually constructed as there does
not appear to be a mature solution which produces good stubs from
Cython code. (It is actually unclear if such a solution is
possible without annotation of the Cython source)

Validation of the stubs is achieved by annotating the tests and
relying on the existing test coverage to explore all relevant
members & operations. A new tox environment runs mypy against the
tests.

Fixes Ezibenroc#105
Ezibenroc pushed a commit that referenced this issue Jan 28, 2024
This adds type stubs to the published package, so that consumers
can benefit from type checking despite the Cython implementation
of this package. The stubs are manually constructed as there does
not appear to be a mature solution which produces good stubs from
Cython code. (It is actually unclear if such a solution is
possible without annotation of the Cython source)

Validation of the stubs is achieved by annotating the tests and
relying on the existing test coverage to explore all relevant
members & operations. A new tox environment runs mypy against the
tests.

Fixes #105
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 a pull request may close this issue.

2 participants