-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
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
Make "deprecated" Note a standard Error, disabled by default #18192
Conversation
While working on the relase of mypy 1.14 we noticed a large number of notes for deprecated. Speaking with Jukka, he suggested we make this disabled by default. And if it's disabled by default, having it as a note is not as useful. We also don't have many stand alone notes. Most notes are "attached" with an error. This PR makes the deprecated error disabled by default, removes the flag to report it as error and always reports it as error when enabled.
This comment has been minimized.
This comment has been minimized.
docs/source/error_code_list2.rst
Outdated
``from mod import depr`` statement or uses a deprecated feature imported otherwise or defined | ||
locally. Features are considered deprecated when decorated with ``warnings.deprecated``, as | ||
specified in `PEP 702 <https://peps.python.org/pep-0702>`_. You can silence single notes via | ||
specified in `PEP 702 <https://peps.python.org/pep-0702>`_. You can silence single errors via | ||
``# type: ignore[deprecated]`` or turn off this check completely via ``--disable-error-code=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.
The "or turn off this check..." part of the sentence could also be removed.
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! If we decide to go through with this change, I'll take another look at this.
The decision to report either notes or errors (or nothing) was the result of this discussion with @JelleZijlstra and @ilevkivskyi. (Just for information. For me, this change is perfectly fine.) |
Keeping this disabled by default feels unfortunate to me; that will make it much harder for users to discover deprecations. However, I understand that turning it on by default is disruptive. Maybe we could turn it on by default in mypy 2. |
Since a note doesn't change the exit code, I think having them on by default is better. I guess it is only annoying for (very) large code bases, but even then it is a simple config change to disable it globally. I don't want to prioritize the convenience of few "larger" users over convenience for many regular users. |
The main reason I proposed this change is that on master mypy generates notes about some pretty popular stdlib functions that are still available in the most recent Python release. For example, GitHub search for the deprecated function Even though the build still passes even if some deprecation notes are shown, extra notes shown on each mypy run are annoying, so effectively every user that gets a note needs to perform some action (disable the error code or remove the uses of deprecated features). This is why I'd consider turning the notes on by default a breaking change, so it should arguably be behind a feature flag, based on our release process. We can consider switching the default in mypy 2.0, which should be coming in the not-too-distant future. |
Speaking for my experience with Home Assistant, I didn't even notice the deprecated notes at first. The full mypy run is usually only done in CI and as long as that was green, I didn't look at the full log. Once I saw them though, my first action was to turn on Thus I'd be in favor of turning it into an error. Personally I wouldn't necessarily consider it a breaking change to even enable it by default as it would be quite simple to disable globally. The breaking change would be if that option to disable it is removed so users are forced to update their code or ignore the issue. However, if that's the policy, maybe we could target a |
TBH this doesn't really tells much to me. Maybe those people are using a version of Python where it is not deprecated, and/or maybe they don't use mypy, and/or (most likely) that is simply some long abandoned code. The real indicator for me is Moreover, the current behavior matches other modern tools that emit warnings by default on deprecation (e.g. Rust), with an option to turn warnings into errors. On a more philosophical level, Python community used to be not very good with deprecations. And IMO this is not because people are lazy, but because until now there were little visibility into deprecations. So again, we should not delay/hide something that is beneficial for majority, because few people may find some notes in the output annoying. |
I got worried about the change since our big internal codebase at work generated thousands of deprecation notes. The volume of output is much more than from any recent mypy change I can remember. Thousands of notes would make mypy unusable without turning the note off or ignoring all the notes (fixing thousands of issues would take a lot of effort). The above is only one data point, but it might be representative of large proprietary codebases (which mypy primer doesn't cover), so I think we should be careful and introduce the feature as opt-in by default. However, since this is easy to turn off and for most users the impact seems minor, we can turn it on by default in the next mypy feature release after the initial release, without having to wait for mypy 2.0. I also think we should generate errors by default, due to these reasons:
So here's my proposal:
I hope the above is an acceptable compromise. We'd have the feature enabled pretty soon (hopefully in a January release), since we don't need to wait for mypy 2.0. |
Would it be a good idea to add a config option to allow disabling deprecation warnings for warnings about specific fully qualified names? That might help alleviate lots of errors in cases where you need to use the deprecated feature for some reason. For example I've got deprecations in my own library, but then Mypy flags all the test code and imports which isn't particularly useful. But I want to be warned about deprecations in any dependencies. It'd also allow you to keep CI green, while you locally turn it back on for specific functions to migrate. |
After chatting with @JukkaL about this. I'll add back a flag to optionally switch the deprecated errors into notes. |
Diff from mypy_primer, showing the effect of this PR on open source code: parso (https://github.com/davidhalter/parso)
- parso/tree.py:1: note: class abc.abstractproperty is deprecated: Use 'property' with 'abstractmethod' instead [deprecated]
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.timezone.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.timezone.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.timezone.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.timezone.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.timezone.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.timezone.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.timezone.utc) [deprecated]
altair (https://github.com/vega/altair)
- altair/vegalite/v5/theme.py:107: note: function altair.vegalite.v5.theme.ThemeRegistry.register is deprecated: Deprecated since `altair=5.5.0`. Use @altair.theme.register instead. [deprecated]
- altair/vegalite/v5/theme.py:111: note: function altair.vegalite.v5.theme.ThemeRegistry.register is deprecated: Deprecated since `altair=5.5.0`. Use @altair.theme.register instead. [deprecated]
- altair/vegalite/v5/theme.py:120: note: function altair.vegalite.v5.theme.ThemeRegistry.register is deprecated: Deprecated since `altair=5.5.0`. Use @altair.theme.register instead. [deprecated]
- altair/vegalite/v5/theme.py:123: note: function altair.vegalite.v5.theme.ThemeRegistry.register is deprecated: Deprecated since `altair=5.5.0`. Use @altair.theme.register 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/__init__.py:59: note: function pydantic.deprecated.class_validators.root_validator is deprecated: Pydantic V1 style `@root_validator` validators are deprecated. You should migrate to Pydantic V2 style `@model_validator` validators, see the migration guide for more details [deprecated]
- pydantic/__init__.py:59: note: function pydantic.deprecated.class_validators.validator is deprecated: Pydantic V1 style `@validator` validators are deprecated. You should migrate to Pydantic V2 style `@field_validator` validators, see the migration guide for more details [deprecated]
- pydantic/__init__.py:60: note: class pydantic.deprecated.config.BaseConfig is deprecated: BaseConfig is deprecated. Use the `pydantic.ConfigDict` instead. [deprecated]
- pydantic/__init__.py:60: note: class pydantic.deprecated.config.Extra is deprecated: Extra is deprecated. Use literal values instead (e.g. `extra='allow'`) [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/main.py:1276: note: function pydantic.deprecated.parse.load_str_bytes is deprecated: `load_str_bytes` is deprecated. [deprecated]
- pydantic/main.py:1329: note: function pydantic.deprecated.parse.load_file is deprecated: `load_file` is deprecated. [deprecated]
- pydantic/main.py:1336: note: function pydantic.main.BaseModel.parse_obj is deprecated: The `parse_obj` method is deprecated; use `model_validate` instead. [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/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]
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:1186: 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]
optuna (https://github.com/optuna/optuna)
- optuna/_gp/gp.py:260: note: function logging.Logger.warn is deprecated: Deprecated; use warning() instead. [deprecated]
Tanjun (https://github.com/FasterSpeeding/Tanjun)
- tanjun/injecting.py:105: note: class alluka._self_injecting.AsyncSelfInjecting is deprecated: Use Client.auto_inject_async [deprecated]
- tanjun/context/base.py:47: note: class alluka._context.BasicContext is deprecated: Use Context or CachingContext [deprecated]
- tanjun/context/base.py:57: note: function alluka._context.BasicContext._set_type_special_case is deprecated: Use ContextOverride [deprecated]
- tanjun/context/base.py:133: note: function alluka._context.BasicContext._set_type_special_case is deprecated: Use ContextOverride [deprecated]
- tanjun/context/base.py:136: note: function alluka._context.BasicContext._remove_type_special_case is deprecated: Use ContextOverride [deprecated]
- tanjun/context/slash.py:335: note: function alluka._context.BasicContext._set_type_special_case is deprecated: Use ContextOverride [deprecated]
- tanjun/context/slash.py:1029: note: function alluka._context.BasicContext._set_type_special_case is deprecated: Use ContextOverride [deprecated]
- tanjun/context/slash.py:1067: note: function alluka._context.BasicContext._set_type_special_case is deprecated: Use ContextOverride [deprecated]
- tanjun/context/slash.py:1075: note: function alluka._context.BasicContext._remove_type_special_case is deprecated: Use ContextOverride [deprecated]
- tanjun/context/message.py:115: note: function alluka._context.BasicContext._set_type_special_case is deprecated: Use ContextOverride [deprecated]
- tanjun/context/message.py:188: note: function alluka._context.BasicContext._set_type_special_case is deprecated: Use ContextOverride [deprecated]
- tanjun/context/message.py:194: note: function alluka._context.BasicContext._remove_type_special_case is deprecated: Use ContextOverride [deprecated]
- tanjun/context/autocomplete.py:56: note: class alluka._context.BasicContext is deprecated: Use Context or CachingContext [deprecated]
- tanjun/context/autocomplete.py:98: note: function alluka._context.BasicContext._set_type_special_case is deprecated: Use ContextOverride [deprecated]
- tanjun/context/menu.py:99: note: function alluka._context.BasicContext._set_type_special_case is deprecated: Use ContextOverride [deprecated]
- tanjun/context/menu.py:156: note: function alluka._context.BasicContext._set_type_special_case is deprecated: Use ContextOverride [deprecated]
- tanjun/context/menu.py:159: note: function alluka._context.BasicContext._remove_type_special_case is deprecated: Use ContextOverride [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.timezone.utc) [deprecated]
dd-trace-py (https://github.com/DataDog/dd-trace-py)
- 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.timezone.utc) [deprecated]
- ddtrace/appsec/_iast/_ast/visitor.py:232: note: class ast.Bytes is deprecated: Replaced by ast.Constant; removed in Python 3.14 [deprecated]
- ddtrace/appsec/_iast/_ast/visitor.py:242: note: class ast.Num is deprecated: Replaced by ast.Constant; removed in Python 3.14 [deprecated]
- ddtrace/appsec/_iast/_ast/visitor.py:394: note: class ast.NameConstant is deprecated: Replaced by ast.Constant; removed in Python 3.14 [deprecated]
- ddtrace/profiling/exporter/http.py:227: note: function datetime.datetime.utcfromtimestamp is deprecated: Use timezone-aware objects to represent datetimes in UTC; e.g. by calling .fromtimestamp(datetime.timezone.utc) [deprecated]
- ddtrace/profiling/exporter/http.py:228: note: function datetime.datetime.utcfromtimestamp is deprecated: Use timezone-aware objects to represent datetimes in UTC; e.g. by calling .fromtimestamp(datetime.timezone.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:611:20: note: function win32.win32api.GetProfileSection is deprecated: This function is obsolete, applications should use the registry instead. [deprecated]
- Pythonwin/pywin/framework/sgrepmdi.py:625: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:700: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:714: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]
spark (https://github.com/apache/spark)
- python/pyspark/sql/connect/client/reattach.py:212: note: function logging.Logger.warn is deprecated: Deprecated; use warning() instead. [deprecated]
- python/pyspark/sql/connect/client/reattach.py:237: note: function logging.Logger.warn is deprecated: Deprecated; use warning() instead. [deprecated]
- python/pyspark/sql/connect/plan.py:599: note: function logging.Logger.warn is deprecated: Deprecated; use warning() instead. [deprecated]
- python/pyspark/sql/connect/session.py:217: note: function logging.Logger.warn is deprecated: Deprecated; use warning() instead. [deprecated]
- python/pyspark/sql/connect/session.py:230: note: function logging.Logger.warn is deprecated: Deprecated; use warning() instead. [deprecated]
- python/pyspark/sql/connect/session.py:877: note: function logging.Logger.warn is deprecated: Deprecated; use warning() instead. [deprecated]
- python/pyspark/sql/connect/session.py:882: note: function logging.Logger.warn is deprecated: Deprecated; use warning() instead. [deprecated]
- python/pyspark/sql/connect/session.py:898: note: function logging.Logger.warn is deprecated: Deprecated; use warning() instead. [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.timezone.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.timezone.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.timezone.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.timezone.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.timezone.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.timezone.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.timezone.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.timezone.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.timezone.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.timezone.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.timezone.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.timezone.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.timezone.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.timezone.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.timezone.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.timezone.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.timezone.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.timezone.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.timezone.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.timezone.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.timezone.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.timezone.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.timezone.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.timezone.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.timezone.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.timezone.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.timezone.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.timezone.utc) [deprecated]
paasta (https://github.com/yelp/paasta)
- paasta_tools/utils.py:1496: note: function datetime.datetime.utcnow is deprecated: Use timezone-aware objects to represent datetimes in UTC; e.g. by calling .now(datetime.timezone.utc) [deprecated]
- paasta_tools/utils.py:3681: note: function datetime.datetime.utcnow is deprecated: Use timezone-aware objects to represent datetimes in UTC; e.g. by calling .now(datetime.timezone.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.timezone.utc) [deprecated]
- paasta_tools/utils.py:3696: note: function datetime.datetime.utcnow is deprecated: Use timezone-aware objects to represent datetimes in UTC; e.g. by calling .now(datetime.timezone.utc) [deprecated]
- paasta_tools/spark_tools.py:136: note: function logging.Logger.warn is deprecated: Deprecated; use warning() instead. [deprecated]
- paasta_tools/spark_tools.py:207: note: function logging.Logger.warn is deprecated: Deprecated; use warning() instead. [deprecated]
- paasta_tools/setup_istio_mesh.py:106: note: function logging.Logger.warn is deprecated: Deprecated; use warning() instead. [deprecated]
- paasta_tools/smartstack_tools.py:476: note: function logging.Logger.warn is deprecated: Deprecated; use warning() instead. [deprecated]
- paasta_tools/smartstack_tools.py:533: note: function logging.Logger.warn is deprecated: Deprecated; use warning() instead. [deprecated]
- paasta_tools/cli/cmds/logs.py:815: note: function logging.Logger.warn is deprecated: Deprecated; use warning() instead. [deprecated]
- paasta_tools/cli/cmds/logs.py:830: note: function logging.Logger.warn is deprecated: Deprecated; use warning() instead. [deprecated]
- paasta_tools/cli/cmds/logs.py:835: note: function logging.Logger.warn is deprecated: Deprecated; use warning() instead. [deprecated]
- paasta_tools/cli/cmds/logs.py:1026: note: function datetime.datetime.utcnow is deprecated: Use timezone-aware objects to represent datetimes in UTC; e.g. by calling .now(datetime.timezone.utc) [deprecated]
- paasta_tools/cli/cmds/logs.py:1030: note: function logging.Logger.warn is deprecated: Deprecated; use warning() instead. [deprecated]
- paasta_tools/cli/cmds/logs.py:1316: note: function datetime.datetime.utcnow is deprecated: Use timezone-aware objects to represent datetimes in UTC; e.g. by calling .now(datetime.timezone.utc) [deprecated]
- paasta_tools/cli/cmds/logs.py:1323: note: function datetime.datetime.utcnow is deprecated: Use timezone-aware objects to represent datetimes in UTC; e.g. by calling .now(datetime.timezone.utc) [deprecated]
- paasta_tools/cli/cmds/logs.py:1335: note: function datetime.datetime.utcnow is deprecated: Use timezone-aware objects to represent datetimes in UTC; e.g. by calling .now(datetime.timezone.utc) [deprecated]
comtypes (https://github.com/enthought/comtypes)
- comtypes/test/__init__.py:139: note: function unittest.loader.makeSuite is deprecated: Deprecated in Python 3.11; removal scheduled for Python 3.13 [deprecated]
- comtypes/test/__init__.py:209: note: function unittest.loader.makeSuite is deprecated: Deprecated in Python 3.11; removal scheduled for Python 3.13 [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.timezone.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.timezone.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.timezone.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.timezone.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.timezone.utc) [deprecated]
openlibrary (https://github.com/internetarchive/openlibrary)
- openlibrary/core/edits.py: note: In member "assign_request" of class "CommunityEditsQueue":
- openlibrary/core/edits.py:230: note: function datetime.datetime.utcnow is deprecated: Use timezone-aware objects to represent datetimes in UTC; e.g. by calling .now(datetime.timezone.utc) [deprecated]
- openlibrary/core/edits.py: note: In member "unassign_request" of class "CommunityEditsQueue":
- openlibrary/core/edits.py:250: note: function datetime.datetime.utcnow is deprecated: Use timezone-aware objects to represent datetimes in UTC; e.g. by calling .now(datetime.timezone.utc) [deprecated]
- openlibrary/core/edits.py: note: In member "update_request_status" of class "CommunityEditsQueue":
- openlibrary/core/edits.py:279: note: function datetime.datetime.utcnow is deprecated: Use timezone-aware objects to represent datetimes in UTC; e.g. by calling .now(datetime.timezone.utc) [deprecated]
- openlibrary/core/edits.py: note: In member "comment_request" of class "CommunityEditsQueue":
- openlibrary/core/edits.py:295: note: function datetime.datetime.utcnow is deprecated: Use timezone-aware objects to represent datetimes in UTC; e.g. by calling .now(datetime.timezone.utc) [deprecated]
- openlibrary/core/edits.py: note: In member "create_comment" of class "CommunityEditsQueue":
- openlibrary/core/edits.py:321: note: function datetime.datetime.utcnow is deprecated: Use timezone-aware objects to represent datetimes in UTC; e.g. by calling .now(datetime.timezone.utc) [deprecated]
- openlibrary/plugins/upstream/borrow.py: note: In function "is_loaned_out":
- openlibrary/plugins/upstream/borrow.py:578: note: function datetime.datetime.utcnow is deprecated: Use timezone-aware objects to represent datetimes in UTC; e.g. by calling .now(datetime.timezone.utc) [deprecated]
- openlibrary/plugins/upstream/borrow.py: note: In function "_update_loan_status":
- openlibrary/plugins/upstream/borrow.py:604: note: function datetime.datetime.utcnow is deprecated: Use timezone-aware objects to represent datetimes in UTC; e.g. by calling .now(datetime.timezone.utc) [deprecated]
- openlibrary/plugins/upstream/addbook.py: note: In function "get_recaptcha":
- openlibrary/plugins/upstream/addbook.py:45: note: function datetime.datetime.utcnow is deprecated: Use timezone-aware objects to represent datetimes in UTC; e.g. by calling .now(datetime.timezone.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.timezone.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.timezone.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.timezone.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.timezone.utc) [deprecated]
freqtrade (https://github.com/freqtrade/freqtrade)
- freqtrade/data/history/history_utils.py:119: note: function logging.Logger.warn is deprecated: Deprecated; use warning() instead. [deprecated]
- freqtrade/rpc/api_server/api_ws.py:42: note: function pydantic.main.BaseModel.dict is deprecated: The `dict` method is deprecated; use `model_dump` instead. [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.timezone.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.timezone.utc) [deprecated]
- misc/python/materialize/scratch.py:415: note: function datetime.datetime.utcnow is deprecated: Use timezone-aware objects to represent datetimes in UTC; e.g. by calling .now(datetime.timezone.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.timezone.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.timezone.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.timezone.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.timezone.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.timezone.utc) [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.timezone.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.timezone.utc) [deprecated]
sockeye (https://github.com/awslabs/sockeye)
... (truncated 34 lines) ...``` |
Yes, I think it is a good idea. Maybe @tyralla will be interested in this. Btw another idea that appeared in an offline discussion is to actually show fully qualified names in deprecation errors/notes. |
Definitely good ideas. I could work on it in a few days. |
While working on the relase of mypy 1.14 we noticed a large number of notes for deprecated. Speaking with Jukka, he suggested we make this disabled by default. And if it's disabled by default, having it as a note is not as useful. We also don't have many stand alone notes. Most notes are "attached" with an error.
This PR makes the deprecated error disabled by default, removes the flag to report it as error and always reports it as error when enabled.
CC @tyralla