Skip to content

Get rid of pkg_resources#1493

Open
kajinamit wants to merge 3 commits intognocchixyz:stable/4.6from
kajinamit:pkg_resources-4.6
Open

Get rid of pkg_resources#1493
kajinamit wants to merge 3 commits intognocchixyz:stable/4.6from
kajinamit:pkg_resources-4.6

Conversation

@kajinamit
Copy link
Copy Markdown
Contributor

... because it was removed in Python 3.12 [1].

[1] https://docs.python.org/3/whatsnew/3.12.html#ensurepip

(cherry picked from commit 7c90f34)

... because it was removed in Python 3.12 [1].

[1] https://docs.python.org/3/whatsnew/3.12.html#ensurepip

(cherry picked from commit 7c90f34)
cotyledon 2.2.0 removed its support for Python 3.9 .
Comment thread doc/source/conf.py
# serve to show the default.

import pkg_resources
import importlib.metadata
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For Python <3.10, this will need to be something like:

try:
    import importlib.metadata as importlib_metadata
except ImportError:
    import importlib_metadata

Comment thread gnocchi/__init__.py
# limitations under the License.

import pkg_resources
import importlib.metadata
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For Python <3.10, this will need to be something like:

try:
    import importlib.metadata as importlib_metadata
except ImportError:
    import importlib_metadata

Comment thread doc/source/conf.py
#
# The short X.Y version.
release = pkg_resources.get_distribution('gnocchi').version
release = importlib.metadata.version('gnocchi')
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

release = importlib_metadata.version('gnocchi')

Comment thread gnocchi/__init__.py
try:
__version__ = pkg_resources.get_distribution(__name__).version
except pkg_resources.DistributionNotFound:
__version__ = importlib.metadata.version('gnocchi')
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

    __version__ = importlib_metadata.version('gnocchi')

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants