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

Fix pkg_resources deprecation warning #146

Merged
merged 4 commits into from
Sep 7, 2023
Merged
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
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ repos:
- id: check-added-large-files
- id: debug-statements
- repo: https://github.com/pycqa/isort
rev: 5.10.1
rev: "5.12.0"
hooks:
- id: isort
- repo: https://github.com/PyCQA/flake8
Expand Down
9 changes: 7 additions & 2 deletions src/robots/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
from pkg_resources import get_distribution
try:
from importlib.metadata import version

__version__ = get_distribution("django-robots").version
__version__ = version("django-robots")
except ImportError:
from pkg_resources import get_distribution

__version__ = get_distribution("django-robots").version

# needed for Django<3.2
default_app_config = "robots.apps.RobotsConfig"
11 changes: 8 additions & 3 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@ envlist =
# list of supported Django/Python versions:
# https://docs.djangoproject.com/en/dev/faq/install/#what-python-version-can-i-use-with-django
py{36,37,38,39,310}-dj{22,31,32}
py{38,39,310}-dj{40}
py{38,39,310}-djmain
py{38,39,310}-dj{40,41}
py{38,39,310,311}-dj42
py{310,311,312}-djmain
py38-{lint,docs}

[gh-actions]
Expand All @@ -13,6 +14,8 @@ python =
3.8: py38
3.9: py39
3.10: py310
3.11: py311
3.12: py312

[testenv]
usedevelop = true
Expand All @@ -28,7 +31,9 @@ deps =
dj22: django>=2.2,<2.3
dj31: django>=3.1,<3.2
dj32: django>=3.2,<3.3
dj40: django>=4.0a1,<4.1
dj40: django>=4.0,<4.1
dj41: django>=4.1,<4.2
dj42: django>=4.2,<4.3
djmain: https://github.com/django/django/archive/main.tar.gz

[testenv:py38-lint]
Expand Down