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

Distribute typing stubs as part of Traits #1254

Closed
mdickinson opened this issue Jul 21, 2020 · 5 comments · Fixed by #1714
Closed

Distribute typing stubs as part of Traits #1254

mdickinson opened this issue Jul 21, 2020 · 5 comments · Fixed by #1714
Labels
component: typing stubs Issues related to the mypy typing stub files type: discussion

Comments

@mdickinson
Copy link
Member

When we have two separate packages being released from a single repository, release management and versioning are unnecessarily painful. If we want to keep traits-stubs as a separate package, we may want to consider breaking it out into its own repository.

The alternative would be to fully absorb traits-stubs into traits.

@mdickinson mdickinson added type: discussion component: typing stubs Issues related to the mypy typing stub files labels Jul 21, 2020
@rahulporuri
Copy link
Contributor

Personally, i'm for fully absorbing. I felt overhead when i was looking to add/modify stubs because they are two separate packages at the moment. It will also mean easier maintenance of the stubs - otherwise, every API change in traits would need a separate change in the stub.

@mdickinson
Copy link
Member Author

I have both philosophical and practical objections to fuller integration of typing in Traits. Let's leave aside the philosophical objections for now. On the practical side, typing.py and traits.api define a lot of the same names with related but different meanings: e.g., Dict, List, Any, Union. I think this is going to be a recipe for confusion if we want to use these in type annotations.

That's partially fixed in 3.9, where the "list of integers" type can be spelled as list[int] rather than List[int], but it's going to be a while before we can drop 3.8 as being too old.

Integrating just to the point where traits-stubs and traits are part of the same distribution, share the same version, changelog, etc., seems possible.

@mdickinson
Copy link
Member Author

Integrating just to the point where traits-stubs and traits are part of the same distribution, share the same version, changelog, etc., seems possible.

I think a prerequisite for such integration would be improving the traits-stubs quality and completeness: if installing traits from PyPI (or EDM) also automatically installs traits-stubs, it's harder for mypy-using users to opt out of using the traits stubs. We've got a way to go before the traits stubs are of usable quality, but right now they're opt-in rather than opt-out, so that's okay.

@mdickinson
Copy link
Member Author

From offline discussion, keeping traits-stubs in this repository and having those stubs automatically distributed with Traits seems like the way to go. We have a couple of options here:

  • keep traits-stubs as a separate package in the same distribution
  • move the .pyi files into the traits package

NumPy recently moved stubs into the core package, it may be worth looking at how they're managing this.

@mdickinson mdickinson changed the title Consider breaking traits-stubs out into its own repository Distribute typing stubs as part of Traits Oct 6, 2020
@mdickinson
Copy link
Member Author

Updated the title to reflect what we actually want to do.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: typing stubs Issues related to the mypy typing stub files type: discussion
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants