-
Notifications
You must be signed in to change notification settings - Fork 7
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
Vendor typeguard 2.13.3 #142
Conversation
This package will however need to be edited to work in parallel with other installations of typeguard.
…her typeguard version.
If typeguard is not installed separately, process the packages listed under --typeguard-packages using the vendored typeguard. Otherwise, process only what is listed in --stp-typeguard-packages and leave the --typeguard-packages option to be processed by the installed version of typeguard. To avoid the ambiguity of double processing, an exception is raised if a package is listed in both options.
…rt change. This partially reverts commit ea01297.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @willhardy, this looks great!
I think we should add a page to the documentation specifically on typeguard, which would explain:
- Why we vendored typeguard
- How you can run stp with typeguard 2 installed (backward compatibility)
- How you can run stp with the vendored version
- How you can use newer versions of typeguard in parallel to stp
Would be happy to contribute to this, let me know what you prefer!
On a related note, does the import hook work? I guess you cannot use it in both the vendored version and typeguard >=3 at the same time, right? So maybe we should just discuss it in the documentation in the backward compatibility section, and specify that it is not exposed in the vendored version?
I've merged the PR, but the documentation didn't build as I expected. Will fix that tonight and then I'll release a new version of stp. |
I've released the new version. Thanks for your contribution @willhardy ! |
Vendor the old version of typeguard that is used (2.13.3), so that projects are free to upgrade or not install typeguard as needed (eg for other packages that depend on newer versions).
I have tried to make this as smooth as possible, to require project maintainers to make as few changes as possible and to allow it to work in as many environments as possible. To do that, I have edited the pytest plugin to allow projects to continue to use
--typeguard-packages
if typeguard is not installed, or if a compatible version of typeguard is installed.If an incompatible version of typeguard is installed, project maintainers will need to use
--stp-typeguard-packages
.How to test
Double check the typeguard code is correct:
To do...
--typeguard-packages
to be checked by that version.--typeguard-packages
to be used is a convenience, but it will silently fail in the following situation. We should try to identify that situation, and raise an exception:strictly_typed_pandas
and wants to make use oftypeguard
typeguard
installed (eg 3+)--typeguard-packages
for those packages where they should be using--stp-typeguard-packages