From ed57d4034d186d1b4db38b918bd89d1e99041068 Mon Sep 17 00:00:00 2001 From: Sergey B Kirpichev Date: Sat, 28 Feb 2026 14:04:56 +0300 Subject: [PATCH] Use version_file option of setuptools-scm to keep version info Closes #1044 --- .gitignore | 3 +++ mpmath/__init__.py | 5 +---- pyproject.toml | 3 ++- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/.gitignore b/.gitignore index 2d6f0479..32835e1e 100644 --- a/.gitignore +++ b/.gitignore @@ -33,6 +33,9 @@ my/ dist/ build/ +# Generated by setuptools_scm +mpmath/_version.py + # Tox files .tox/ diff --git a/mpmath/__init__.py b/mpmath/__init__.py index c8672988..2318f7b8 100644 --- a/mpmath/__init__.py +++ b/mpmath/__init__.py @@ -1,7 +1,4 @@ -from importlib.metadata import version - -__version__ = version(__name__) -del version +from ._version import __version__ import functools import sys diff --git a/pyproject.toml b/pyproject.toml index 71f0f943..6f688aac 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -54,6 +54,7 @@ exclude = ['.eggs', '.git'] max_line_length = 200 [tool.setuptools_scm] +version_file = "mpmath/_version.py" [tool.pytest.ini_options] testpaths = ['mpmath', 'docs'] @@ -66,7 +67,7 @@ timeout = 600 [tool.coverage.run] branch = true -omit = ['mpmath/tests/*'] +omit = ['mpmath/tests/*', 'mpmath/_version.py'] patch = ["subprocess"] [tool.coverage.html]