Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion meson.build
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
project(
'numpy-financial',
'cython', 'c',
version: '2.0.0.dev',
version: run_command('tools/version.py', check: true).stdout().strip(),
license: 'BSD-3',
meson_version: '>=1.4.0',
)
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ requires = [

[project]
name = "numpy-financial"
version = "2.0.0"
dynamic = ['version']
requires-python = ">=3.13"
description = "Simple financial functions"
license = "BSD-3-Clause"
Expand Down
21 changes: 21 additions & 0 deletions tools/version.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!/usr/bin/env python3

"""Determine and print the version number.

Used in the top level ``meson.build``.
"""

from pathlib import Path

INIT = Path(__file__).parent.parent / "numpy_financial" / "__init__.py"


def version_from_init():
"""Extract the version string from ``numpy_financial/__init__.py``."""
lines = INIT.read_text().splitlines()
version_line = next(line for line in lines if line.startswith("__version__ ="))
return version_line.split(" = ")[1].strip().strip("\"'")


if __name__ == "__main__":
print(version_from_init())
Loading