Skip to content

Commit

Permalink
build: use importlib.metadata to get version for py>=3.8 (#51)
Browse files Browse the repository at this point in the history
  • Loading branch information
yxlao authored Apr 7, 2024
1 parent 936356c commit 9aa2347
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 4 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/pypi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.7"]
python-version: ["3.7", "3.8"]

steps:
- name: Set up Python ${{ matrix.python-version }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/unit_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.7"]
python-version: ["3.7", "3.8"]

steps:
- uses: actions/checkout@v3
Expand Down
12 changes: 10 additions & 2 deletions camtools/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,14 @@
from . import transform
from . import util

import pkg_resources

__version__ = pkg_resources.get_distribution("camtools").version
try:
# Python >= 3.8
from importlib.metadata import version

__version__ = version("camtools")
except ImportError:
# Python < 3.8
import pkg_resources

__version__ = pkg_resources.get_distribution("camtools").version

0 comments on commit 9aa2347

Please sign in to comment.