-
Notifications
You must be signed in to change notification settings - Fork 47
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
pre-commit: pyupgrade #1352
pre-commit: pyupgrade #1352
Conversation
Stop using deprecated type annotations and imports.
Codecov ReportAttention: Patch coverage is
❗ Your organization needs to install the Codecov GitHub app to enable full functionality. Additional details and impacted files@@ Coverage Diff @@
## develop #1352 +/- ##
===========================================
+ Coverage 84.25% 84.32% +0.06%
===========================================
Files 157 157
Lines 12871 12911 +40
===========================================
+ Hits 10845 10887 +42
+ Misses 2026 2024 -2 ☔ View full report in Codecov by Sentry. |
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.
Add to ".git-blame-ignore-revs"?
Yes, but only after merging. |
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.
👍 please add 64efde1 to https://github.com/ICB-DCM/pyPESTO/blob/develop/.git-blame-ignore-revs and use ruff (UP, https://docs.astral.sh/ruff/rules/#pyupgrade-up)
.pre-commit-config.yaml
Outdated
rev: v3.15.0 | ||
hooks: | ||
- id: pyupgrade | ||
args: ["--py39-plus"] |
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.
Is this not automatically picked up from python-requires
in setup.cfg
?
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.
At least I didn't find that documented.
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.
mmh, yeah pyupgrade doesn't seem to do it out of the box. I don't think ruff reads options from setup.cfg
, only pyproject.toml
, but we could anyways move all of the information to a single file, right?
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.
but we could anyways move all of the information to a single file, right?
Yes, it would be good switch to fully switch to pyproject.toml
, but that's something for another day.
After merge. Hash will change.
👍 Didn't notice it was available through ruff. |
@@ -1,7 +1,8 @@ | |||
import logging | |||
import warnings | |||
from collections.abc import Sequence |
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.
Any particular reason to use this one? Seems like just an extra import to me.
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.
Yes. typing.Sequence
is deprecated since python 3.9.
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.
Thank you! It's nice to have it changed everywhere.
One question, more for my info than anything else.
petab_problem: "petab.Problem", | ||
petab_problem: petab.Problem, | ||
model: AmiciModel, | ||
edatas: list["amici.ExpData"], | ||
edatas: list[amici.ExpData], |
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.
I thought that adding " " on petab and amici objects was good for tests not to break if the module is imported, but petab and amici are not installed. I think I tried having it like this, but then tests were failing. Why is it ok to change now?
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.
tl;dr: from __future__ import annotations
details: https://peps.python.org/pep-0563/
Stop using deprecated type annotations and imports.