Skip to content

Commit

Permalink
Test against Python 3.12 (#239)
Browse files Browse the repository at this point in the history
* Test against Python 3.12

Expand tests to run against Python 3.12

* Update importlib to play nicely with 3.12
  • Loading branch information
abkfenris authored Oct 30, 2023
1 parent 01447c7 commit e2d941d
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 11 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/main.yaml
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.9", "3.10", "3.11"]
python-version: ["3.9", "3.10", "3.11", "3.12"]
pydantic-version: ["<2", ">=2"]
steps:
- uses: actions/checkout@v4
Expand Down Expand Up @@ -56,7 +56,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.9", "3.10", "3.11"]
python-version: ["3.9", "3.10", "3.11", "3.12"]
steps:
- uses: actions/checkout@v4

Expand Down
6 changes: 3 additions & 3 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
rev: v4.5.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
Expand All @@ -10,7 +10,7 @@ repos:
- id: double-quote-string-fixer

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: "v0.0.288"
rev: "v0.0.292"
hooks:
- id: ruff
args: [--fix, --exit-non-zero-on-fix]
Expand Down Expand Up @@ -43,7 +43,7 @@ repos:
- markdown # managed by mdformat

- repo: https://github.com/tox-dev/pyproject-fmt
rev: "1.1.0"
rev: "1.2.0"
hooks:
- id: pyproject-fmt

Expand Down
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ classifiers = [
'Programming Language :: Python :: 3.9',
'Programming Language :: Python :: 3.10',
'Programming Language :: Python :: 3.11',
'Programming Language :: Python :: 3.12',
'Topic :: Scientific/Engineering',
]
dynamic = [
Expand Down
12 changes: 7 additions & 5 deletions xpublish/__init__.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
from pkg_resources import DistributionNotFound, get_distribution
try:
import importlib.metadata as importlib_metadata
except ImportError:
import importlib_metadata

from .accessor import RestAccessor # noqa: F401
from .plugins import Dependencies, Plugin, hookimpl, hookspec # noqa: F401
from .rest import Rest, SingleDatasetRest # noqa: F401

try:
__version__ = get_distribution(__name__).version
except DistributionNotFound: # noqa: F401; pragma: no cover
# package is not installed
pass
__version__ = importlib_metadata.version(__package__)
except importlib_metadata.PackageNotFoundError:
__version__ = None
7 changes: 6 additions & 1 deletion xpublish/plugins/manage.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,12 @@ def find_default_plugins(

plugins: Dict[str, Type[Plugin]] = {}

for entry_point in entry_points()['xpublish.plugin']:
try:
plugin_entry_points = entry_points(group='xpublish.plugin')
except TypeError:
plugin_entry_points = entry_points()['xpublish.plugin']

for entry_point in plugin_entry_points:
if entry_point.name not in exclude_plugins:
plugins[entry_point.name] = entry_point.load()

Expand Down

0 comments on commit e2d941d

Please sign in to comment.