Skip to content
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

Use importlib.metadata instead of pkg_resources #132

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
Changes
=======

Unreleased
----------

* Removed usage of pkg_resource to avoid derecation
warnings. If you want to inspect the installed version,
use ``importlib.metadata.version("django-widget-tweaks")``
(`docs <https://docs.python.org/3.8/library/importlib.metadata.html#distribution-versions>`__ /
`backport <https://pypi.org/project/importlib-metadata/>`__).
Comment on lines +7 to +11
Copy link
Contributor

Choose a reason for hiding this comment

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

Fix some typos, and remove the backport link, since nearly everyone runs Python 3.8+ now, and 3.7 is EOL in a couple months.

Suggested change
* Removed usage of pkg_resource to avoid derecation
warnings. If you want to inspect the installed version,
use ``importlib.metadata.version("django-widget-tweaks")``
(`docs <https://docs.python.org/3.8/library/importlib.metadata.html#distribution-versions>`__ /
`backport <https://pypi.org/project/importlib-metadata/>`__).
* Removed usage of ``pkg_resources`` to avoid deprecation
warnings. If you want to inspect the installed version,
use ``importlib.metadata.version("django-widget-tweaks")``
(`docs <https://docs.python.org/3/library/importlib.metadata.html#distribution-versions>`__).

Copy link
Contributor

Choose a reason for hiding this comment

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

Agreed. 3.7 is now EOL. But we should stop testing on it too. Similar for old EOL Django versions like 2.2. Is there a policy regarding support for old versions?


1.4.12 (2022-01-13)
-------------------
Expand Down
7 changes: 0 additions & 7 deletions widget_tweaks/__init__.py
Original file line number Diff line number Diff line change
@@ -1,7 +0,0 @@
from pkg_resources import get_distribution, DistributionNotFound

try:
__version__ = get_distribution("django-widget-tweaks").version
except DistributionNotFound:
# package is not installed
__version__ = None