Skip to content

Commit 479bbbf

Browse files
committed
build: update versioning
1 parent 9a7b215 commit 479bbbf

File tree

8 files changed

+16
-9
lines changed

8 files changed

+16
-9
lines changed

.github/workflows/CD.yml renamed to .github/workflows/cd.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,11 @@ on:
55
push:
66
branches:
77
- master
8+
tags:
9+
- v*
10+
pull_request:
11+
branches:
12+
- master
813
release:
914
types:
1015
- published

.readthedocs.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,3 +20,5 @@ python:
2020
version: 3.7
2121
install:
2222
- requirements: docs/requirements.txt
23+
- method: pip
24+
path: .

pyproject.toml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
11
[build-system]
22
# Minimum requirements for the build system (setup.py) to execute.
3-
requires = ["wheel", "setuptools>=39.2.0"]
3+
requires = ["wheel", "setuptools>=42", "setuptools_scm[toml]>=3.4",]
44
build-backend = "setuptools.build_meta"
55

6+
[tool.setuptools_scm]
7+
write_to = "src/mplhep/_version.py"
8+
69
[tool.nbqa.config]
710
black = "pyproject.toml"
811

setup.cfg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[metadata]
22
name = mplhep
3-
version = file: src/mplhep/.VERSION
3+
# version = file: src/mplhep/.VERSION
44
long_description = file: README.md
55
long_description_content_type = text/markdown
66
author = andrzejnovak

setup.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
from __future__ import annotations
22

3+
import setuptools_scm # noqa: F401
34
from setuptools import setup
45

56
extras_require = {

src/mplhep/.VERSION

Lines changed: 0 additions & 1 deletion
This file was deleted.

src/mplhep/__init__.py

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
from . import alice, atlas, cms, label, lhcb, plot
1111
from . import styles as style
1212
from ._tools import Config
13+
from ._version import version as __version__ # noqa: F401
1314
from .label import save_variations, savelabels
1415
from .plot import (
1516
append_axes,
@@ -41,12 +42,6 @@
4142
),
4243
)
4344

44-
# Make __version__ available
45-
_base_dir = os.path.dirname(os.path.abspath(__file__))
46-
47-
with open(os.path.join(_base_dir, ".VERSION")) as version_file:
48-
__version__ = version_file.read().strip()
49-
5045
path = os.path.abspath(__file__)
5146
font_path = os.path.join(os.path.dirname(mplhep_data.__file__), "fonts")
5247
font_files = fm.findSystemFonts(fontpaths=font_path)

src/mplhep/version.pyi

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
version: str
2+
version_tuple: tuple[int, int, int] | tuple[int, int, int, str, str]

0 commit comments

Comments
 (0)