-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
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
Add basic support for PEP 702 (@deprecated). #17476
base: master
Are you sure you want to change the base?
Conversation
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Thank you! I'll review this soon. |
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, this is looking pretty good!
test-data/unit/check-deprecated.test
Outdated
f[1] # E: __main__.f is deprecated - use f2 instead \ | ||
# E: Value of type "Callable[[], None]" is not indexable | ||
g = f # E: __main__.f is deprecated - use f2 instead | ||
g() # E: __main__.f is deprecated - use f2 instead |
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.
This ideally shouldn't error since we already got an error at the g = f
line. I don't mind if that's too hard to implement though.
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.
Unfortunately, I have no spontaneous idea how to implement this with reasonable effort.
This is a case where just one overload is deprecated, so I think For reference, pyright has the same issue:
Pyanalyze prints the affected overload (but appears to have a bug where the signature degenerates to
I would want it to either print the actual deprecated signature (like pyanalyze) or say something like "Deprecated call to logging.getLevelName", indicating that the function isn't fully deprecated, just this way of calling it is deprecated. |
Noticed this in primer output from python/mypy#17476.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Noticed this in primer output from python/mypy#17476.
This comment has been minimized.
This comment has been minimized.
docs/source/error_code_list2.rst
Outdated
Check that imported or used feature is deprecated [deprecated] | ||
-------------------------------------------------------------- | ||
|
||
If you use :option:`--warn-deprecated <mypy --warn-deprecated>`, mypy generates a note if |
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.
It looks like there has been some back and forth so docs are out of sync now. To summarize how I see the logic should be:
- Deprecation messages are always shown as notes by default (with code shown, see my previous comment), this will result in exit code 0 (which is kind of my main concern, I don't want users CI to break unnecessarily on new mypy version).
- People who still don't want to see the notes, can use
--disable-error-code=deprecated
and/or# type: ignore[deprecated]
. - There should be a flag that turns notes into errors (for more pedantic people). They will still be able to selectively silence the errors using
# type: ignore[deprecated]
.
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.
- There should be a flag that turns notes into errors (for more pedantic people).
Does Mypy implement other checks that can result in errors or notes, depending on an option? (I'm just asking to avoid reinventing the wheel.)
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.
TBH I don't remember. But in any case it should be as simple as changing last line in your warn_deprecated()
method in checker.py
to something like
if self.options.error_on_deprecated: # or other flag name
self.error(...)
else:
self.note(...)
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.
That seems doable, thanks. I will implement it later.
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.
Done! report-deprecated-as-error
is the shortest understandable description I could come up with. Other suggestions are welcome, of course.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
…cated` and `@overload`
… feature/support_deprecated
for more information, see https://pre-commit.ci
This request was not too hard to implement (at least concerning the available test cases). The suggested pattern is: This step offered the chance to report wrong orders of |
… feature/support_deprecated
This comment has been minimized.
This comment has been minimized.
…ss` into one method (`check_deprecated`)
…rning` and document it
…. of function ...`
for more information, see https://pre-commit.ci
This comment has been minimized.
This comment has been minimized.
I refactored the code and polished the messages a little. In my opinion, the "basic support" is ready now. I may find time to react to possible further remarks today, but then I am off for a while. So, do not hesitate to make any changes you think are useful by yourself. |
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.
OK, I had time to look at the implementation, and I think there are some large-scale things that are not right:
- Being deprecated is not a property of a type, it is a property of a symbol, and as such should be only ever stored on symbol nodes. (I understand this may complicate a bit the situation with specific overload deprecated, but this does not justify breaking the abstraction)
- Creating/storing the deprecation warnings should be done during semantic analysis phase (emitting the actual warnings should be kept in type-checking however). Doing this during type-checking will lead to unpredictable results if e.g. an import cycle is involved (I understand this is an edge case, but it is non-fixable in principle with the current logic).
- We need good test coverage for both coarse- and fine-grained incremental modes. It is important that when deprecation status of a symbol changes, then all its (transitive) use sites are re-checked appropriately.
@tyralla are you looking at implementing the feedback for this? I am happy to pick up where you left off otherwise. |
…e`, and `deserialize`.
…irectImport1-only_when_nocache`) fails due to currently unknown reasons.
…la/mypy into feature/support_deprecated
Diff from mypy_primer, showing the effect of this PR on open source code: SinbadCogs (https://github.com/mikeshardmind/SinbadCogs)
+ rolemanagement/events.py:41: note: function datetime.datetime.utcnow is deprecated: Use timezone-aware objects to represent datetimes in UTC; e.g. by calling .now(datetime.UTC) [deprecated]
+ embedmaker/serialize.py:81: note: function datetime.datetime.utcfromtimestamp is deprecated: Use timezone-aware objects to represent datetimes in UTC; e.g. by calling .fromtimestamp(datetime.UTC) [deprecated]
+ antimentionspam/antimentionspam.py:239: note: function datetime.datetime.utcnow is deprecated: Use timezone-aware objects to represent datetimes in UTC; e.g. by calling .now(datetime.UTC) [deprecated]
+ scheduler/time_utils.py:42: note: function datetime.datetime.utcnow is deprecated: Use timezone-aware objects to represent datetimes in UTC; e.g. by calling .now(datetime.UTC) [deprecated]
+ embedmaker/time_utils.py:42: note: function datetime.datetime.utcnow is deprecated: Use timezone-aware objects to represent datetimes in UTC; e.g. by calling .now(datetime.UTC) [deprecated]
+ scheduler/message.py:82: note: function datetime.datetime.utcnow is deprecated: Use timezone-aware objects to represent datetimes in UTC; e.g. by calling .now(datetime.UTC) [deprecated]
+ modnotes/modnotes.py:148: note: function datetime.datetime.utcnow is deprecated: Use timezone-aware objects to represent datetimes in UTC; e.g. by calling .now(datetime.UTC) [deprecated]
spack (https://github.com/spack/spack)
+ lib/spack/spack/fetch_strategy.py:849: note: overload def (self: shutil._RmtreeType, path: Union[builtins.str, builtins.bytes, os.PathLike[builtins.str], os.PathLike[builtins.bytes]], ignore_errors: builtins.bool, onerror: def (def (*Any, **Any) -> Any, builtins.str, tuple[type[builtins.BaseException], builtins.BaseException, types.TracebackType]) -> builtins.object, *, onexc: None =, dir_fd: Union[builtins.int, None] =) of function shutil._RmtreeType.__call__ is deprecated: The `onerror` parameter is deprecated. Use `onexc` instead. [deprecated]
+ lib/spack/spack/util/package_hash.py:30: note: class ast.Str is deprecated: Replaced by ast.Constant; removal scheduled for Python 3.14 [deprecated]
parso (https://github.com/davidhalter/parso)
+ parso/tree.py:1: note: class abc.abstractproperty is deprecated: Use 'property' with 'abstractmethod' instead [deprecated]
pydantic (https://github.com/pydantic/pydantic)
+ pydantic/deprecated/parse.py:78: note: function pydantic.deprecated.parse.load_str_bytes is deprecated: `load_str_bytes` is deprecated. [deprecated]
+ pydantic/color.py:252: note: class pydantic.color.Color is deprecated: The `Color` class is deprecated, use `pydantic_extra_types` instead. See https://docs.pydantic.dev/latest/api/pydantic_extra_types_color/. [deprecated]
+ pydantic/deprecated/json.py:16: note: class pydantic.color.Color is deprecated: The `Color` class is deprecated, use `pydantic_extra_types` instead. See https://docs.pydantic.dev/latest/api/pydantic_extra_types_color/. [deprecated]
+ pydantic/deprecated/json.py:132: note: function pydantic.deprecated.json.pydantic_encoder is deprecated: `pydantic_encoder` is deprecated, use `pydantic_core.to_jsonable_python` instead. [deprecated]
+ pydantic/main.py:1175: note: function pydantic.deprecated.parse.load_str_bytes is deprecated: `load_str_bytes` is deprecated. [deprecated]
+ pydantic/main.py:1227: note: function pydantic.deprecated.parse.load_file is deprecated: `load_file` is deprecated. [deprecated]
+ pydantic/deprecated/tools.py:101: note: function pydantic.deprecated.tools.schema_of is deprecated: `schema_of` is deprecated. Use `pydantic.TypeAdapter.json_schema` instead. [deprecated]
+ pydantic/v1/_hypothesis_plugin.py:105: note: class pydantic.color.Color is deprecated: The `Color` class is deprecated, use `pydantic_extra_types` instead. See https://docs.pydantic.dev/latest/api/pydantic_extra_types_color/. [deprecated]
+ pydantic/v1/_hypothesis_plugin.py:126: note: class pydantic.types.PaymentCardNumber is deprecated: The `PaymentCardNumber` class is deprecated, use `pydantic_extra_types` instead. See https://docs.pydantic.dev/latest/api/pydantic_extra_types_payment/#pydantic_extra_types.payment.PaymentCardNumber. [deprecated]
+ pydantic/v1/_hypothesis_plugin.py:139: note: class pydantic.types.PaymentCardNumber is deprecated: The `PaymentCardNumber` class is deprecated, use `pydantic_extra_types` instead. See https://docs.pydantic.dev/latest/api/pydantic_extra_types_payment/#pydantic_extra_types.payment.PaymentCardNumber. [deprecated]
+ pydantic/deprecated/decorator.py:84: note: function pydantic.deprecated.decorator.validate_arguments is deprecated: The `validate_arguments` method is deprecated; use `validate_call` instead. [deprecated]
cloud-init (https://github.com/canonical/cloud-init)
+ tests/integration_tests/clouds.py:328: note: function datetime.datetime.utcnow is deprecated: Use timezone-aware objects to represent datetimes in UTC; e.g. by calling .now(datetime.UTC) [deprecated]
+ cloudinit/sources/azure/errors.py:55: note: function datetime.datetime.utcnow is deprecated: Use timezone-aware objects to represent datetimes in UTC; e.g. by calling .now(datetime.UTC) [deprecated]
+ cloudinit/sources/azure/kvp.py:52: note: function datetime.datetime.utcnow is deprecated: Use timezone-aware objects to represent datetimes in UTC; e.g. by calling .now(datetime.UTC) [deprecated]
+ tests/unittests/sources/azure/test_kvp.py:14: note: function datetime.datetime.utcnow is deprecated: Use timezone-aware objects to represent datetimes in UTC; e.g. by calling .now(datetime.UTC) [deprecated]
+ tests/integration_tests/test_paths.py:68: note: function datetime.datetime.utcnow is deprecated: Use timezone-aware objects to represent datetimes in UTC; e.g. by calling .now(datetime.UTC) [deprecated]
+ tests/integration_tests/test_paths.py:100: note: function datetime.datetime.utcnow is deprecated: Use timezone-aware objects to represent datetimes in UTC; e.g. by calling .now(datetime.UTC) [deprecated]
pywin32 (https://github.com/mhammond/pywin32)
+ AutoDuck/fixHelpCompression.py:16:1: note: function win32.win32api.WriteProfileVal is deprecated: This function is obsolete, applications should use the registry instead. [deprecated]
+ win32/Lib/win32serviceutil.py:140:19: note: function win32.win32api.GetProfileVal is deprecated: This function is obsolete, applications should use the registry instead. [deprecated]
+ Pythonwin/pywin/framework/sgrepmdi.py:615:20: note: function win32.win32api.GetProfileSection is deprecated: This function is obsolete, applications should use the registry instead. [deprecated]
+ Pythonwin/pywin/framework/sgrepmdi.py:629:21: note: function win32.win32api.WriteProfileVal is deprecated: This function is obsolete, applications should use the registry instead. [deprecated]
+ Pythonwin/pywin/framework/mdi_pychecker.py:703:20: note: function win32.win32api.GetProfileSection is deprecated: This function is obsolete, applications should use the registry instead. [deprecated]
+ Pythonwin/pywin/framework/mdi_pychecker.py:717:21: note: function win32.win32api.WriteProfileVal is deprecated: This function is obsolete, applications should use the registry instead. [deprecated]
+ Pythonwin/pywin/framework/editor/vss.py:45:20: note: function win32.win32api.GetProfileVal is deprecated: This function is obsolete, applications should use the registry instead. [deprecated]
+ Pythonwin/pywin/framework/editor/vss.py:46:19: note: function win32.win32api.GetProfileVal is deprecated: This function is obsolete, applications should use the registry instead. [deprecated]
dd-trace-py (https://github.com/DataDog/dd-trace-py)
+ ddtrace/internal/flare/flare.py:70: note: overload def (level: builtins.str) -> Any of function logging.getLevelName is deprecated: The str -> int case is considered a mistake. [deprecated]
+ ddtrace/internal/debug.py:121: note: function datetime.datetime.utcnow is deprecated: Use timezone-aware objects to represent datetimes in UTC; e.g. by calling .now(datetime.UTC) [deprecated]
+ ddtrace/appsec/_iast/_ast/visitor.py:224: note: class ast.Bytes is deprecated: Replaced by ast.Constant; removal scheduled for Python 3.14 [deprecated]
+ ddtrace/appsec/_iast/_ast/visitor.py:234: note: class ast.Num is deprecated: Replaced by ast.Constant; removal scheduled for Python 3.14 [deprecated]
+ ddtrace/appsec/_iast/_ast/visitor.py:386: note: class ast.NameConstant is deprecated: Replaced by ast.Constant; removal scheduled for Python 3.14 [deprecated]
+ ddtrace/profiling/exporter/http.py:219: note: function datetime.datetime.utcfromtimestamp is deprecated: Use timezone-aware objects to represent datetimes in UTC; e.g. by calling .fromtimestamp(datetime.UTC) [deprecated]
+ ddtrace/profiling/exporter/http.py:220: note: function datetime.datetime.utcfromtimestamp is deprecated: Use timezone-aware objects to represent datetimes in UTC; e.g. by calling .fromtimestamp(datetime.UTC) [deprecated]
alerta (https://github.com/alerta/alerta)
+ alerta/dev.py:4: note: function datetime.datetime.utcnow is deprecated: Use timezone-aware objects to represent datetimes in UTC; e.g. by calling .now(datetime.UTC) [deprecated]
+ alerta/utils/audit.py:94: note: function datetime.datetime.utcnow is deprecated: Use timezone-aware objects to represent datetimes in UTC; e.g. by calling .now(datetime.UTC) [deprecated]
+ alerta/models/note.py:25: note: function datetime.datetime.utcnow is deprecated: Use timezone-aware objects to represent datetimes in UTC; e.g. by calling .now(datetime.UTC) [deprecated]
+ alerta/models/key.py:31: note: function datetime.datetime.utcnow is deprecated: Use timezone-aware objects to represent datetimes in UTC; e.g. by calling .now(datetime.UTC) [deprecated]
+ alerta/models/key.py:42: note: function datetime.datetime.utcnow is deprecated: Use timezone-aware objects to represent datetimes in UTC; e.g. by calling .now(datetime.UTC) [deprecated]
+ alerta/models/key.py:164: note: function datetime.datetime.utcnow is deprecated: Use timezone-aware objects to represent datetimes in UTC; e.g. by calling .now(datetime.UTC) [deprecated]
+ alerta/models/heartbeat.py:56: note: function datetime.datetime.utcnow is deprecated: Use timezone-aware objects to represent datetimes in UTC; e.g. by calling .now(datetime.UTC) [deprecated]
+ alerta/models/heartbeat.py:59: note: function datetime.datetime.utcnow is deprecated: Use timezone-aware objects to represent datetimes in UTC; e.g. by calling .now(datetime.UTC) [deprecated]
+ alerta/models/heartbeat.py:61: note: function datetime.datetime.utcnow is deprecated: Use timezone-aware objects to represent datetimes in UTC; e.g. by calling .now(datetime.UTC) [deprecated]
+ alerta/models/blackout.py:37: note: function datetime.datetime.utcnow is deprecated: Use timezone-aware objects to represent datetimes in UTC; e.g. by calling .now(datetime.UTC) [deprecated]
+ alerta/models/blackout.py:60: note: function datetime.datetime.utcnow is deprecated: Use timezone-aware objects to represent datetimes in UTC; e.g. by calling .now(datetime.UTC) [deprecated]
+ alerta/models/alert.py:66: note: function datetime.datetime.utcnow is deprecated: Use timezone-aware objects to represent datetimes in UTC; e.g. by calling .now(datetime.UTC) [deprecated]
+ alerta/models/alert.py:75: note: function datetime.datetime.utcnow is deprecated: Use timezone-aware objects to represent datetimes in UTC; e.g. by calling .now(datetime.UTC) [deprecated]
+ alerta/models/alert.py:282: note: function datetime.datetime.utcnow is deprecated: Use timezone-aware objects to represent datetimes in UTC; e.g. by calling .now(datetime.UTC) [deprecated]
+ alerta/models/alert.py:335: note: function datetime.datetime.utcnow is deprecated: Use timezone-aware objects to represent datetimes in UTC; e.g. by calling .now(datetime.UTC) [deprecated]
+ alerta/models/alert.py:379: note: function datetime.datetime.utcnow is deprecated: Use timezone-aware objects to represent datetimes in UTC; e.g. by calling .now(datetime.UTC) [deprecated]
+ alerta/models/alert.py:430: note: function datetime.datetime.utcnow is deprecated: Use timezone-aware objects to represent datetimes in UTC; e.g. by calling .now(datetime.UTC) [deprecated]
+ alerta/models/alert.py:574: note: function datetime.datetime.utcnow is deprecated: Use timezone-aware objects to represent datetimes in UTC; e.g. by calling .now(datetime.UTC) [deprecated]
+ alerta/models/alert.py:609: note: function datetime.datetime.utcnow is deprecated: Use timezone-aware objects to represent datetimes in UTC; e.g. by calling .now(datetime.UTC) [deprecated]
+ alerta/models/alert.py:637: note: function datetime.datetime.utcnow is deprecated: Use timezone-aware objects to represent datetimes in UTC; e.g. by calling .now(datetime.UTC) [deprecated]
+ alerta/auth/utils.py:52: note: function datetime.datetime.utcnow is deprecated: Use timezone-aware objects to represent datetimes in UTC; e.g. by calling .now(datetime.UTC) [deprecated]
+ alerta/models/user.py:41: note: function datetime.datetime.utcnow is deprecated: Use timezone-aware objects to represent datetimes in UTC; e.g. by calling .now(datetime.UTC) [deprecated]
+ alerta/models/user.py:44: note: function datetime.datetime.utcnow is deprecated: Use timezone-aware objects to represent datetimes in UTC; e.g. by calling .now(datetime.UTC) [deprecated]
+ alerta/database/backends/mongodb/utils.py:250: note: function datetime.datetime.utcnow is deprecated: Use timezone-aware objects to represent datetimes in UTC; e.g. by calling .now(datetime.UTC) [deprecated]
+ alerta/database/backends/mongodb/utils.py:252: note: function datetime.datetime.utcnow is deprecated: Use timezone-aware objects to represent datetimes in UTC; e.g. by calling .now(datetime.UTC) [deprecated]
+ alerta/database/backends/mongodb/utils.py:254: note: function datetime.datetime.utcnow is deprecated: Use timezone-aware objects to represent datetimes in UTC; e.g. by calling .now(datetime.UTC) [deprecated]
+ alerta/database/backends/mongodb/utils.py:345: note: function datetime.datetime.utcnow is deprecated: Use timezone-aware objects to represent datetimes in UTC; e.g. by calling .now(datetime.UTC) [deprecated]
+ alerta/database/backends/mongodb/utils.py:347: note: function datetime.datetime.utcnow is deprecated: Use timezone-aware objects to represent datetimes in UTC; e.g. by calling .now(datetime.UTC) [deprecated]
scrapy (https://github.com/scrapy/scrapy)
+ scrapy/utils/misc.py:279: note: class ast.NameConstant is deprecated: Replaced by ast.Constant; removal scheduled for Python 3.14 [deprecated]
pytest (https://github.com/pytest-dev/pytest)
+ src/_pytest/logging.py:518: note: overload def (level: builtins.str) -> Any of function logging.getLevelName is deprecated: The str -> int case is considered a mistake. [deprecated]
comtypes (https://github.com/enthought/comtypes)
+ comtypes/test/__init__.py:140: note: function unittest.loader.makeSuite is deprecated: Deprecated in Python 3.11; removal scheduled for Python 3.13 [deprecated]
+ comtypes/test/__init__.py:210: note: function unittest.loader.makeSuite is deprecated: Deprecated in Python 3.11; removal scheduled for Python 3.13 [deprecated]
openlibrary (https://github.com/internetarchive/openlibrary)
+ openlibrary/core/yearly_reading_goals.py: note: In member "update_current_count" of class "YearlyReadingGoals":
+ openlibrary/core/yearly_reading_goals.py:103: note: function datetime.datetime.utcnow is deprecated: Use timezone-aware objects to represent datetimes in UTC; e.g. by calling .now(datetime.UTC) [deprecated]
+ openlibrary/core/yearly_reading_goals.py: note: In member "update_target" of class "YearlyReadingGoals":
+ openlibrary/core/yearly_reading_goals.py:121: note: function datetime.datetime.utcnow is deprecated: Use timezone-aware objects to represent datetimes in UTC; e.g. by calling .now(datetime.UTC) [deprecated]
+ openlibrary/core/edits.py: note: In member "assign_request" of class "CommunityEditsQueue":
+ openlibrary/core/edits.py:231: note: function datetime.datetime.utcnow is deprecated: Use timezone-aware objects to represent datetimes in UTC; e.g. by calling .now(datetime.UTC) [deprecated]
+ openlibrary/core/edits.py: note: In member "unassign_request" of class "CommunityEditsQueue":
+ openlibrary/core/edits.py:251: note: function datetime.datetime.utcnow is deprecated: Use timezone-aware objects to represent datetimes in UTC; e.g. by calling .now(datetime.UTC) [deprecated]
+ openlibrary/core/edits.py: note: In member "update_request_status" of class "CommunityEditsQueue":
+ openlibrary/core/edits.py:280: note: function datetime.datetime.utcnow is deprecated: Use timezone-aware objects to represent datetimes in UTC; e.g. by calling .now(datetime.UTC) [deprecated]
+ openlibrary/core/edits.py: note: In member "comment_request" of class "CommunityEditsQueue":
+ openlibrary/core/edits.py:296: note: function datetime.datetime.utcnow is deprecated: Use timezone-aware objects to represent datetimes in UTC; e.g. by calling .now(datetime.UTC) [deprecated]
+ openlibrary/core/edits.py: note: In member "create_comment" of class "CommunityEditsQueue":
+ openlibrary/core/edits.py:322: note: function datetime.datetime.utcnow is deprecated: Use timezone-aware objects to represent datetimes in UTC; e.g. by calling .now(datetime.UTC) [deprecated]
+ openlibrary/plugins/upstream/borrow.py: note: In function "is_loaned_out":
+ openlibrary/plugins/upstream/borrow.py:606: note: function datetime.datetime.utcnow is deprecated: Use timezone-aware objects to represent datetimes in UTC; e.g. by calling .now(datetime.UTC) [deprecated]
+ openlibrary/plugins/upstream/borrow.py: note: In function "_update_loan_status":
+ openlibrary/plugins/upstream/borrow.py:632: note: function datetime.datetime.utcnow is deprecated: Use timezone-aware objects to represent datetimes in UTC; e.g. by calling .now(datetime.UTC) [deprecated]
+ openlibrary/plugins/upstream/borrow.py: note: In function "get_ia_auth_dict":
+ openlibrary/plugins/upstream/borrow.py:823: note: function datetime.datetime.utcnow is deprecated: Use timezone-aware objects to represent datetimes in UTC; e.g. by calling .now(datetime.UTC) [deprecated]
+ openlibrary/plugins/upstream/addbook.py: note: In function "get_recaptcha":
+ openlibrary/plugins/upstream/addbook.py:50: note: function datetime.datetime.utcnow is deprecated: Use timezone-aware objects to represent datetimes in UTC; e.g. by calling .now(datetime.UTC) [deprecated]
speedrun.com_global_scoreboard_webapp (https://github.com/Avasam/speedrun.com_global_scoreboard_webapp)
+ backend/api/api_wrappers.py:56: note: function datetime.datetime.utcnow is deprecated: Use timezone-aware objects to represent datetimes in UTC; e.g. by calling .now(datetime.UTC) [deprecated]
+ backend/services/user_updater.py:78: note: function datetime.datetime.utcnow is deprecated: Use timezone-aware objects to represent datetimes in UTC; e.g. by calling .now(datetime.UTC) [deprecated]
+ backend/api/core_api.py:36: note: function datetime.datetime.utcnow is deprecated: Use timezone-aware objects to represent datetimes in UTC; e.g. by calling .now(datetime.UTC) [deprecated]
+ backend/api/core_api.py:37: note: function datetime.datetime.utcnow is deprecated: Use timezone-aware objects to represent datetimes in UTC; e.g. by calling .now(datetime.UTC) [deprecated]
+ backend/api/global_scoreboard_api.py:76: note: function datetime.datetime.utcnow is deprecated: Use timezone-aware objects to represent datetimes in UTC; e.g. by calling .now(datetime.UTC) [deprecated]
discord.py (https://github.com/Rapptz/discord.py)
+ discord/member.py:946: note: function datetime.datetime.utcnow is deprecated: Use timezone-aware objects to represent datetimes in UTC; e.g. by calling .now(datetime.UTC) [deprecated]
+ discord/member.py:1002: note: function datetime.datetime.utcnow is deprecated: Use timezone-aware objects to represent datetimes in UTC; e.g. by calling .now(datetime.UTC) [deprecated]
dragonchain (https://github.com/dragonchain/dragonchain)
+ dragonchain/lib/dto/smart_contract_model.py:100:86: note: function datetime.datetime.utcnow is deprecated: Use timezone-aware objects to represent datetimes in UTC; e.g. by calling .now(datetime.UTC) [deprecated]
+ dragonchain/lib/dto/smart_contract_model.py:300:112: note: function datetime.datetime.utcnow is deprecated: Use timezone-aware objects to represent datetimes in UTC; e.g. by calling .now(datetime.UTC) [deprecated]
+ dragonchain/lib/authorization.py:51:12: note: function datetime.datetime.utcnow is deprecated: Use timezone-aware objects to represent datetimes in UTC; e.g. by calling .now(datetime.UTC) [deprecated]
+ dragonchain/scheduler/scheduler.py:65:42: note: function datetime.datetime.utcnow is deprecated: Use timezone-aware objects to represent datetimes in UTC; e.g. by calling .now(datetime.UTC) [deprecated]
pytest-robotframework (https://github.com/detachhead/pytest-robotframework)
+ pytest_robotframework/__init__.py:471: note: @overload should be placed before @deprecated
tornado (https://github.com/tornadoweb/tornado)
+ tornado/autoreload.py:339: note: function pkgutil.get_loader is deprecated: Use importlib.util.find_spec() instead. Will be removed in Python 3.14. [deprecated]
+ tornado/test/httputil_test.py:444: note: function datetime.datetime.utcfromtimestamp is deprecated: Use timezone-aware objects to represent datetimes in UTC; e.g. by calling .fromtimestamp(datetime.UTC) [deprecated]
+ tornado/test/httpclient_test.py:915: note: function datetime.datetime.utcnow is deprecated: Use timezone-aware objects to represent datetimes in UTC; e.g. by calling .now(datetime.UTC) [deprecated]
prefect (https://github.com/PrefectHQ/prefect)
+ src/prefect/_internal/concurrency/api.py:49: note: class abc.abstractstaticmethod is deprecated: Use 'staticmethod' with 'abstractmethod' instead [deprecated]
+ src/prefect/_internal/concurrency/api.py:62: note: class abc.abstractstaticmethod is deprecated: Use 'staticmethod' with 'abstractmethod' instead [deprecated]
+ src/prefect/results.py:596: note: class abc.abstractclassmethod is deprecated: Use 'classmethod' with 'abstractmethod' instead [deprecated]
+ src/prefect/server/database/query_components.py:2: note: class abc.abstractproperty is deprecated: Use 'property' with 'abstractmethod' instead [deprecated]
bandersnatch (https://github.com/pypa/bandersnatch)
+ src/bandersnatch/utils.py: note: In function "make_time_stamp":
+ src/bandersnatch/utils.py:54: note: function datetime.datetime.utcnow is deprecated: Use timezone-aware objects to represent datetimes in UTC; e.g. by calling .now(datetime.UTC) [deprecated]
+ src/bandersnatch/mirror.py: note: In member "synchronize" of class "Mirror":
+ src/bandersnatch/mirror.py:58: note: function datetime.datetime.utcnow is deprecated: Use timezone-aware objects to represent datetimes in UTC; e.g. by calling .now(datetime.UTC) [deprecated]
paasta (https://github.com/yelp/paasta)
+ paasta_tools/utils.py:1500: note: function datetime.datetime.utcnow is deprecated: Use timezone-aware objects to represent datetimes in UTC; e.g. by calling .now(datetime.UTC) [deprecated]
+ paasta_tools/utils.py:3673: note: function datetime.datetime.utcnow is deprecated: Use timezone-aware objects to represent datetimes in UTC; e.g. by calling .now(datetime.UTC) [deprecated]
+ paasta_tools/utils.py:3680: note: function datetime.datetime.utcnow is deprecated: Use timezone-aware objects to represent datetimes in UTC; e.g. by calling .now(datetime.UTC) [deprecated]
+ paasta_tools/utils.py:3688: note: function datetime.datetime.utcnow is deprecated: Use timezone-aware objects to represent datetimes in UTC; e.g. by calling .now(datetime.UTC) [deprecated]
+ paasta_tools/cli/cmds/status.py:721: note: function datetime.datetime.utcnow is deprecated: Use timezone-aware objects to represent datetimes in UTC; e.g. by calling .now(datetime.UTC) [deprecated]
+ paasta_tools/cli/cmds/status.py:1868: note: function datetime.datetime.utcnow is deprecated: Use timezone-aware objects to represent datetimes in UTC; e.g. by calling .now(datetime.UTC) [deprecated]
+ paasta_tools/cli/cmds/logs.py:1020: note: function datetime.datetime.utcnow is deprecated: Use timezone-aware objects to represent datetimes in UTC; e.g. by calling .now(datetime.UTC) [deprecated]
+ paasta_tools/cli/cmds/logs.py:1310: note: function datetime.datetime.utcnow is deprecated: Use timezone-aware objects to represent datetimes in UTC; e.g. by calling .now(datetime.UTC) [deprecated]
+ paasta_tools/cli/cmds/logs.py:1317: note: function datetime.datetime.utcnow is deprecated: Use timezone-aware objects to represent datetimes in UTC; e.g. by calling .now(datetime.UTC) [deprecated]
+ paasta_tools/cli/cmds/logs.py:1329: note: function datetime.datetime.utcnow is deprecated: Use timezone-aware objects to represent datetimes in UTC; e.g. by calling .now(datetime.UTC) [deprecated]
typeshed-stats (https://github.com/AlexWaygood/typeshed-stats)
+ website_macros.py:101: note: function datetime.datetime.utcnow is deprecated: Use timezone-aware objects to represent datetimes in UTC; e.g. by calling .now(datetime.UTC) [deprecated]
materialize (https://github.com/MaterializeInc/materialize)
+ misc/python/materialize/buildkite_insights/util/data_io.py:75: note: function datetime.datetime.utcfromtimestamp is deprecated: Use timezone-aware objects to represent datetimes in UTC; e.g. by calling .fromtimestamp(datetime.UTC) [deprecated]
+ ci/cleanup/launchdarkly.py:32: note: function datetime.datetime.utcnow is deprecated: Use timezone-aware objects to represent datetimes in UTC; e.g. by calling .now(datetime.UTC) [deprecated]
+ misc/python/materialize/scratch.py:388: note: function datetime.datetime.utcnow is deprecated: Use timezone-aware objects to represent datetimes in UTC; e.g. by calling .now(datetime.UTC) [deprecated]
+ misc/python/materialize/cli/cloudbench.py:290: note: function datetime.datetime.utcnow is deprecated: Use timezone-aware objects to represent datetimes in UTC; e.g. by calling .now(datetime.UTC) [deprecated]
+ misc/python/materialize/cli/scratch/create.py:148: note: function datetime.datetime.utcnow is deprecated: Use timezone-aware objects to represent datetimes in UTC; e.g. by calling .now(datetime.UTC) [deprecated]
+ ci/load/periodic.py:31: note: function datetime.datetime.utcnow is deprecated: Use timezone-aware objects to represent datetimes in UTC; e.g. by calling .now(datetime.UTC) [deprecated]
+ ci/load/periodic.py:36: note: function datetime.datetime.utcnow is deprecated: Use timezone-aware objects to represent datetimes in UTC; e.g. by calling .now(datetime.UTC) [deprecated]
+ ci/cleanup/aws.py:105: note: function datetime.datetime.utcnow is deprecated: Use timezone-aware objects to represent datetimes in UTC; e.g. by calling .now(datetime.UTC) [deprecated]
python-sop (https://gitlab.com/dkg/python-sop)
+ sop/__init__.py:424: note: function datetime.datetime.utcnow is deprecated: Use timezone-aware objects to represent datetimes in UTC; e.g. by calling .now(datetime.UTC) [deprecated]
mkosi (https://github.com/systemd/mkosi)
+ mkosi/log.py:92:34: note: overload def (level: builtins.str) -> Any of function logging.getLevelName is deprecated: The str -> int case is considered a mistake. [deprecated]
poetry (https://github.com/python-poetry/poetry)
+ src/poetry/utils/helpers.py:117: note: overload def (self: shutil._RmtreeType, path: Union[builtins.str, builtins.bytes, os.PathLike[builtins.str], os.PathLike[builtins.bytes]], ignore_errors: builtins.bool, onerror: def (def (*Any, **Any) -> Any, builtins.str, tuple[type[builtins.BaseException], builtins.BaseException, types.TracebackType]) -> builtins.object, *, onexc: None =, dir_fd: Union[builtins.int, None] =) of function shutil._RmtreeType.__call__ is deprecated: The `onerror` parameter is deprecated. Use `onexc` instead. [deprecated]
streamlit (https://github.com/streamlit/streamlit)
+ lib/streamlit/runtime/scriptrunner/magic.py: note: In function "_get_st_write_from_expr":
+ lib/streamlit/runtime/scriptrunner/magic.py:227:30: note: class ast.Str is deprecated: Replaced by ast.Constant; removal scheduled for Python 3.14 [deprecated]
+ lib/streamlit/elements/doc_string.py: note: In function "_get_variable_name_from_code_str":
+ lib/streamlit/elements/doc_string.py:297:9: note: class ast.Num is deprecated: Replaced by ast.Constant; removal scheduled for Python 3.14 [deprecated]
+ lib/streamlit/elements/doc_string.py:298:9: note: class ast.Str is deprecated: Replaced by ast.Constant; removal scheduled for Python 3.14 [deprecated]
+ lib/streamlit/elements/doc_string.py:299:9: note: class ast.Bytes is deprecated: Replaced by ast.Constant; removal scheduled for Python 3.14 [deprecated]
+ lib/streamlit/elements/doc_string.py:300:9: note: class ast.NameConstant is deprecated: Replaced by ast.Constant; removal scheduled for Python 3.14 [deprecated]
+ lib/streamlit/elements/doc_string.py:301:9: note: class ast.Ellipsis is deprecated: Replaced by ast.Constant; removal scheduled for Python 3.14 [deprecated]
+ lib/streamlit/runtime/credentials.py: note: In function "_send_email":
+ lib/streamlit/runtime/credentials.py:85:10: note: function datetime.datetime.utcnow is deprecated: Use timezone-aware objects to represent datetimes in UTC; e.g. by calling .now(datetime.UTC) [deprecated]
jax (https://github.com/google/jax)
+ jax/_src/scipy/optimize/_lbfgs.py:146: note: function builtins.bool.__invert__ is deprecated: Will throw an error in Python 3.14. Use `not` for logical negation of bools instead. [deprecated]
|
Sorry, I was too busy the last few weeks to continue working on it. @Youssefares: I could try to thoroughly address the last remarks in mid-September, but definitely not earlier, and Python 3.13 is on its way. So please do not hesitate if you can start sooner.
|
Noticed this in primer output from python/mypy#17476.
@Youssefares: Did you find time to work on it? I could restart soon, but likely only in small steps. (Especially if I have to solve the mystery about |
Closes #16111
This PR provides only basic support. Many special cases might need additional attention (descriptors, some special methods like
__int__
, etc.). Other open issues are code comments, eventual documentation updates, the deprecation message style, etc.). But I wanted to offer these first steps before going on vacation (so I cannot respond to possible reviews too soon).Maybe someone wants to extend the list of (test) cases the basic support should address?