Skip to content

Commit 7eb7dc5

Browse files
committed
MAINT: put back mesonpy.__version__
The module constant has been used to check meson-python version in other projects, see discussion on mesonbuild#691. Add a test to ensure that the version recorded in pyproject.toml and mesonpy/__init__.py are kept in sync.
1 parent 077e3bc commit 7eb7dc5

File tree

3 files changed

+13
-1
lines changed

3 files changed

+13
-1
lines changed

RELEASE.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ After that is done, you may release the project by following these steps:
1919

2020
#. Create the release commit
2121

22-
#. Bump the versions in ``pyproject.toml``.
22+
#. Bump the versions in ``pyproject.toml`` and in ``mesonpy/__init__.py``.
2323
#. Create ``CHANGELOG.rst`` section for the new release and fill it.
2424
#. The commit message should read: ``REL: set version to X.Y.Z``
2525

mesonpy/__init__.py

+3
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,9 @@ class InvalidLicenseExpression(Exception): # type: ignore[no-redef]
7979
MesonArgs = Mapping[MesonArgsKeys, List[str]]
8080

8181

82+
__version__ = '0.18.0.dev0'
83+
84+
8285
_PYPROJECT_METADATA_VERSION = tuple(map(int, pyproject_metadata.__version__.split('.')[:2]))
8386
_SUPPORTED_DYNAMIC_FIELDS = {'version', } if _PYPROJECT_METADATA_VERSION < (0, 9) else {'version', 'license', 'license-files'}
8487

tests/test_consistency.py

+9
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,15 @@
1111
else:
1212
import tomli as tomllib
1313

14+
import mesonpy
15+
16+
17+
def test_version():
18+
pyproject = pathlib.Path(__file__).parent.parent.joinpath('pyproject.toml')
19+
with open(pyproject, 'rb') as f:
20+
project_version = tomllib.load(f)['project']['version']
21+
assert mesonpy.__version__ == project_version
22+
1423

1524
def test_pyproject_dependencies():
1625
pyproject = pathlib.Path(__file__).parent.parent.joinpath('pyproject.toml')

0 commit comments

Comments
 (0)