Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Show git commit in --version #253

Merged
merged 6 commits into from
May 31, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ wheels/
.installed.cfg
*.egg
MANIFEST
mreg_cli/_version.py

# PyInstaller
# Usually these files are written by a python script from a template
Expand Down
6 changes: 5 additions & 1 deletion mreg_cli/__about__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
"""Metadata about the mreg-cli package."""

from __future__ import annotations

__version__ = "1.0.0"
from importlib.metadata import version

__version__ = version("mreg-cli")
2 changes: 1 addition & 1 deletion mreg_cli/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ def main():
args = parser.parse_args()

if args.version:
print(f"mreg-cli version {__version__}")
print(f"mreg-cli {__version__}")
raise SystemExit() from None

setup_logging(args.verbosity)
Expand Down
9 changes: 5 additions & 4 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
[build-system]
requires = ["setuptools >= 68.0"]
requires = ["setuptools >= 68.0", "setuptools_scm>=8"]
build-backend = "setuptools.build_meta"

[project]
name = "mreg-cli"
Expand Down Expand Up @@ -36,9 +37,6 @@ Repository = 'https://github.com/unioslo/mreg-cli/'
[project.scripts]
mreg-cli = "mreg_cli.main:main"

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

[tool.setuptools.packages.find]
include = ["mreg_cli*"]

Expand Down Expand Up @@ -190,3 +188,6 @@ dummy-variable-rgx = "^(_+|(_+[a-zA-Z0-9_]*[a-zA-Z0-9]+?))$"
[tool.ruff.lint.mccabe]
# Unlike Flake8, default to a complexity level of 10.
max-complexity = 10

[tool.setuptools_scm]
version_file = "mreg_cli/_version.py"
Loading