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

Update Python versions #436

Closed
wants to merge 4 commits 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
2 changes: 1 addition & 1 deletion .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.7", "3.10", "3.11"]
python-version: ["3.8", "3.10", "3.11", "3.12"]

steps:
- name: Set up Python ${{ matrix.python-version }}
Expand Down
4 changes: 4 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ release, and any new translations added.
- Replace deprecated ``pkg_resources.iter_entry_points`` with
``importlib_metadata``.

- Drop Python 3.7 support.

- Add Python 3.12 support.


7.5.1 (1 February 2023)
=======================
Expand Down
15 changes: 7 additions & 8 deletions django_countries/fields.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
import importlib.metadata
import re
import sys
from typing import Any, Iterable, Optional, Tuple, Type, Union, cast
from urllib import parse as urlparse

Expand All @@ -15,16 +17,13 @@
from django_countries.conf import settings

_entry_points: Iterable[Any]
try:
import importlib.metadata

_entry_points = importlib.metadata.entry_points().get(
"django_countries.Country", []
)
except ImportError: # Python <3.8
import pkg_resources
_entry_points = importlib.metadata.entry_points()
if sys.version_info >= (3, 10):
_entry_points = _entry_points.select(group="django_countries.Country")
else:
_entry_points = _entry_points.get("django_countries.Country", [])

_entry_points = pkg_resources.iter_entry_points("django_countries.Country")

EXTENSIONS = {ep.name: ep.load() for ep in _entry_points} # type: ignore

Expand Down
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@ classifiers =
Operating System :: OS Independent
Programming Language :: Python
Programming Language :: Python :: 3 :: Only
Programming Language :: Python :: 3.7
Programming Language :: Python :: 3.8
Programming Language :: Python :: 3.9
Programming Language :: Python :: 3.10
Programming Language :: Python :: 3.11
Programming Language :: Python :: 3.12
Framework :: Django
Framework :: Django :: 3.2
Framework :: Django :: 4.0
Expand Down
19 changes: 10 additions & 9 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ distribute = False
envlist =
coverage_setup
# Latest
py311-latest{-pyuca,-noi18n}
py312-latest{-pyuca,-noi18n}
# Historical Python, Django and DRF versions
py310-previous
py311-previous
# Legacy
py37-legacy
py38-legacy
# Package checks
readme
bandit
Expand All @@ -18,9 +18,10 @@ ignore_basepython_conflict = True

[gh-actions]
python =
3.7: py37
3.8: py38
3.10: py310
3.11: py311, readme, bandit, mypy
3.11: py311
3.12: py312, readme, bandit, mypy

[testenv]
basepython = python3
Expand Down Expand Up @@ -50,7 +51,7 @@ commands =
rst2html.py --report=info --halt=warning README.rst /dev/null
rst2html.py --report=info --halt=warning CHANGES.rst /dev/null

[py311-latest-noi18n]
[py312-latest-noi18n]
setenv =
DJANGO_SETTINGS_MODULE = django_countries.tests.settings_noi18n

Expand All @@ -73,11 +74,11 @@ commands = coverage erase
skip_install = True
parallel_show_output = True
depends =
py310-latest{-pyuca}
py312-latest{-pyuca}
noi18n
py36-django32-drf312
py38-django32-drf312
py39-django{32,40}-drf313
py36-legacy
py38-legacy
commands =
coverage combine
coverage html
Expand Down