Skip to content

Commit

Permalink
MAINT: put back mesonpy.__version__
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
dnicolodi committed Jan 27, 2025
1 parent 077e3bc commit 7eb7dc5
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 1 deletion.
2 changes: 1 addition & 1 deletion RELEASE.rst
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ After that is done, you may release the project by following these steps:

#. Create the release commit

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

Expand Down
3 changes: 3 additions & 0 deletions mesonpy/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,9 @@ class InvalidLicenseExpression(Exception): # type: ignore[no-redef]
MesonArgs = Mapping[MesonArgsKeys, List[str]]


__version__ = '0.18.0.dev0'


_PYPROJECT_METADATA_VERSION = tuple(map(int, pyproject_metadata.__version__.split('.')[:2]))
_SUPPORTED_DYNAMIC_FIELDS = {'version', } if _PYPROJECT_METADATA_VERSION < (0, 9) else {'version', 'license', 'license-files'}

Expand Down
9 changes: 9 additions & 0 deletions tests/test_consistency.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,15 @@
else:
import tomli as tomllib

import mesonpy


def test_version():
pyproject = pathlib.Path(__file__).parent.parent.joinpath('pyproject.toml')
with open(pyproject, 'rb') as f:
project_version = tomllib.load(f)['project']['version']
assert mesonpy.__version__ == project_version


def test_pyproject_dependencies():
pyproject = pathlib.Path(__file__).parent.parent.joinpath('pyproject.toml')
Expand Down

0 comments on commit 7eb7dc5

Please sign in to comment.