Skip to content
Myr

Merge pull request #4420 from K900/main

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by David Lord · committed by GitHub · parents fdac8a5, 751d85f · Browse files · 3 files+15 added−6 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Trailers

  • cli: use importlib.metadata instead of pkg_resources

Diff stats

3 files+15 added−6 removed

  • other:+15 added−6 removed

3 files+15 added−6 removed

modified:src/flask/cli.py+12 added-6 removed
26 unmodified lines
27 import ssl28except ImportError:29 ssl = None # type: ignore3031if sys.version_info >= (3, 10):32 from importlib import metadata33else:34 # Use a backport on Python < 3.10.35 #36 # We technically have importlib.metadata on 3.8+,37 # but the API changed in 3.10, so use the backport38 # for consistency.39 import importlib_metadata as metadata # type: ignore404142class NoAppException(click.UsageError):43 """Raised if an application cannot be found or loaded."""4445
457 unmodified lines
503504 def _load_plugin_commands(self):505 if self._loaded_plugin_commands:506 return497 try:498 import pkg_resources499 except ImportError:500 self._loaded_plugin_commands = True501 return507503 for ep in pkg_resources.iter_entry_points("flask.commands"):508 for ep in metadata.entry_points(group="flask.commands"):509 self.add_command(ep.load(), ep.name)510511 self._loaded_plugin_commands = True512513 def get_command(self, ctx, name):514 self._load_plugin_commands()
447 unmodified lines
modified:CHANGES.rst+2 added
33 unmodified lines
34- The ``RequestContext.g`` property is deprecated. Use ``g`` directly35 or ``AppContext.g`` instead. :issue:`3898`36- ``copy_current_request_context`` can decorate async functions.37 :pr:`4303`38- Replace the previously undocumented ``setuptools`` dependency in the CLI39 with ``importlib.metadata``. :issue:`4419`404142Version 2.0.343-------------
1199 unmodified lines
modified:setup.py+1 added
6 unmodified lines
7 "Werkzeug >= 2.0",8 "Jinja2 >= 3.0",9 "itsdangerous >= 2.0",10 "click >= 8.0",11 "importlib-metadata; python_version < '3.10'",12 ],13 extras_require={14 "async": ["asgiref >= 3.2"],15 "dotenv": ["python-dotenv"],
2 unmodified lines