Skip to content

Commit

Permalink
Use importlib.metadaata for versioning (#79)
Browse files Browse the repository at this point in the history
  • Loading branch information
maxrjones authored Apr 16, 2024
1 parent b1ec924 commit 885076c
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
10 changes: 6 additions & 4 deletions carbonplan_styles/__init__.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
from pkg_resources import DistributionNotFound, get_distribution
from importlib.metadata import PackageNotFoundError as _PackageNotFoundError
from importlib.metadata import version as _version

from . import altair, colors, mpl # noqa

try:
version = get_distribution(__name__).version
except DistributionNotFound: # pragma: no cover
version = "0.0.0" # pragma: no cover
version = _version(__name__)
except _PackageNotFoundError:
# package is not installed
version = "unknown"
__version__ = version


Expand Down
5 changes: 3 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ exclude = [
"node_modules",
"venv",
]
[tool.ruff.lint]
per-file-ignores = {}
# E402: module level import not at top of file
# E501: line too long - let black worry about that
Expand All @@ -100,10 +101,10 @@ select = [
]


[tool.ruff.mccabe]
[tool.ruff.lint.mccabe]
max-complexity = 18

[tool.ruff.isort]
[tool.ruff.lint.isort]
known-first-party = ["carbonplan_styles"]
known-third-party = ["altair","matplotlib","numpy","pkg_resources","pytest","seaborn","setuptools"]

Expand Down

0 comments on commit 885076c

Please sign in to comment.