Skip to content

Commit

Permalink
use setuptools-scm for package version
Browse files Browse the repository at this point in the history
  • Loading branch information
ryanpdx committed Feb 21, 2024
1 parent fcf705c commit ddbec19
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 5 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -133,3 +133,6 @@ dmypy.json

# MacOS
.DS_Store

# setuptools-scm
_version.py
5 changes: 4 additions & 1 deletion olaf/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,10 @@
from .common.service import Service, ServiceState
from .common.timer_loop import TimerLoop

__version__ = "3.3.1"
try:
from ._version import version as __version__
except ImportError:
__version__ = "unknown" # package is not installed

olaf_parser = ArgumentParser(prog="OLAF", add_help=False)
olaf_parser.add_argument("-b", "--bus", default="vcan0", help="CAN bus to use, defaults to vcan0")
Expand Down
13 changes: 9 additions & 4 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[build-system]
requires = ["setuptools"]
requires = ["setuptools", "setuptools_scm"]
build-backend = "setuptools.build_meta"

[project]
Expand Down Expand Up @@ -28,15 +28,15 @@ dependencies = [
]
dynamic = ["version"]

[tool.setuptools.dynamic]
version = {attr = "olaf.__version__"}

[tool.setuptools.packages.find]
exclude = ["docs*", "tests*"]

[tool.setuptools.package-data]
"*" = ["*.html", "*.ico"]

[tool.setuptools_scm]
write_to = "olaf/_version.py"

[tool.black]
line_length = 100

Expand Down Expand Up @@ -76,6 +76,11 @@ path = "tests/*"
# W0212: Access to a protected member of a class
ignore = "W0212"

[[tool.pylama.files]]
path = "*/_version.py"
# C0114: Missing module docstring
ignore = "C0114"

[[tool.mypy.overrides]]
module = "canopen,oresat_configs,psutil"
ignore_missing_imports = true
Expand Down
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ psutil
pylama[all]
pylama[toml]
setuptools
setuptools-scm
sphinx
sphinx-rtd-theme
sphinxcontrib-mermaid
Expand Down

0 comments on commit ddbec19

Please sign in to comment.