Skip to content

Commit

Permalink
get version without deprecation warnings
Browse files Browse the repository at this point in the history
merges #29

* Make getting version Python 3.8+ compatible
* Bump minimum Python version to 3.8
  • Loading branch information
bgyori committed Jul 20, 2024
1 parent fec6a82 commit ffd8310
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 7 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
- windows-latest
- macOS-latest
python-version:
- "3.7"
- "3.8"
- "3.11"
networkx-version:
- "1.*"
Expand Down
7 changes: 3 additions & 4 deletions obonet/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,11 @@


def _get_version() -> str | None:
# https://github.com/pypa/setuptools_scm#retrieving-package-version-at-runtime
from pkg_resources import DistributionNotFound, get_distribution
from importlib.metadata import PackageNotFoundError, version

try:
return str(get_distribution("obonet").version)
except DistributionNotFound:
return version("obonet")
except PackageNotFoundError:
return None


Expand Down
4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ keywords = [
"parser",
"network",
]
requires-python = ">=3.7"
requires-python = ">=3.8"
dependencies = ["networkx"]
dynamic = ["version"]

Expand All @@ -54,7 +54,7 @@ include-package-data = true
license-files = ["LICENSE.md"]

[tool.ruff]
target-version = "py37"
target-version = "py38"
ignore = [
"E501", # line-too-long (black should handle)
]
Expand Down

0 comments on commit ffd8310

Please sign in to comment.