-
Notifications
You must be signed in to change notification settings - Fork 10
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
run PEP585 upgrade #678
run PEP585 upgrade #678
Conversation
Codecov Report
@@ Coverage Diff @@
## master #678 +/- ##
=======================================
Coverage 95.89% 95.90%
=======================================
Files 92 92
Lines 6310 6321 +11
=======================================
+ Hits 6051 6062 +11
Misses 259 259
Continue to review full report at Codecov.
|
What is the purpose of using more specific types, e.g. tuple vs. typing.Tuple, in the annotation? Eventually, we do not want to restrict it to be specific to that particular type, but a broader common interface. Of course this can be changed if desired, I just wonder what this has to do with pep585. |
this doesn't really change anything besides that after pep585 it is allowed to use |
So most of the time it is just replacing lower-case with upper-case in the type hints and a different import source. Well, to me it is not really important which annotation we use, as long as everything works and it is consistent. However:
So can we fix this? |
Now I've learned that the type duplication of collection types in the typing module is now deprecated. Thanks for fixing this. |
I didn't want to spend the time digging into it, feel free to run the hook again and see the changes/errors (they are only a few)
See above, in addition the hook does 'mess' with the imports (adding new ones, removing some) but doesn't respect This was mostly intended as a one time upgrade to switch to pep585 annotations, if we simply stick to that from now on we probably don't need to have the hook activated (or we can run it from time to time manually) |
The readme of the hook does mention that and recommends to run this hook in a "tandem" with isort. So I guess we need to figure how to do that. quote:
|
exactly, if you simply run the hook before isort it will 'heal' itself (but the first commit attempt will still fail) |
RTD has now the following warning: weldx/geometry.py:docstring of weldx.geometry.SpatialData.time:: WARNING: more than one target found for cross-reference 'Time': weldx.Time, weldx.time.Time This is surprising, since I only changed something in weldx/asdf/util.py Eventually the new Sphinx version is being used now. |
to narrow these things down and check if a failed action passes on master you can always manually trigger a build for any branch from the actions page: I have started an additional build on master here: https://github.com/BAMWelDX/weldx/actions/runs/1718748392 |
Thanks. The default branch triggers the same warning. So we can either merge now and fix the warning in a separate PR or resolve it here. From my experience you prefer to keep things separated, right? |
It's the same on the tutorial PR. I will look into the problem next week. |
See #684 |
Changes
I have disabled the pre-commit hook since it breaks some of our type definitions (it might work but I didn't check further)
Using the pep585 type hints should be the new default with
from __future__ import annotations