Skip to content

Commit 383b19b

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 383b19b

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

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

+8
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,21 @@
55
import pathlib
66
import sys
77

8+
import mesonpy
89

910
if sys.version_info >= (3, 11):
1011
import tomllib
1112
else:
1213
import tomli as tomllib
1314

1415

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

0 commit comments

Comments
 (0)