Skip to content

Commit

Permalink
Use importlib.metadata for docs
Browse files Browse the repository at this point in the history
  • Loading branch information
matthewfeickert committed May 14, 2024
1 parent 01a6efb commit 4412812
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 9 deletions.
5 changes: 2 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
PKG_VERSION = $(shell cat VERSION)
DOCS_FOLDER = "docs"
SOURCE_FOLDER = "madminer"
TESTS_FOLDER = "tests"


.PHONY: build
build:
@echo "Building package"
Expand All @@ -26,7 +24,8 @@ docs:
.PHONY: tag
tag:
@echo "Tagging current commit"
@git tag --annotate "v$(PKG_VERSION)" --message "Tag v$(PKG_VERSION)"
@git tag --annotate "v$(shell python -c 'from importlib.metadata import version; print(version("madminer"))')" \
--message "Tag v$(shell python -c 'from importlib.metadata import version; print(version("madminer"))')"
@git push --follow-tags


Expand Down
14 changes: 8 additions & 6 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,19 +16,21 @@
# sys.path.insert(0, os.path.abspath('.'))

from pathlib import Path
import importlib.metadata

# -- Project information -----------------------------------------------------

project_folder = Path(__file__).parent.parent
version_file = project_folder.joinpath("VERSION")

project = 'MadMiner'
authors = 'Johann Brehmer, Felix Kling, Irina Espejo, Sinclert Perez, Kyle Cranmer'
version = open(version_file).read().strip()
copyright = '{} 2018-2020'.format(authors)

# The full version, including alpha/beta/rc tags
release = version
# The version info for the project you're documenting, acts as replacement for
# |version| and |release|, also used in various other places throughout the
# built documents.
# The full version, including alpha/beta/rc tags.
release = importlib.metadata.version("madminer")
# for example take major/minor/patch
version = ".".join(release.split(".")[:3])


# -- General configuration ---------------------------------------------------
Expand Down

0 comments on commit 4412812

Please sign in to comment.