diff --git a/CHANGELOG.md b/CHANGELOG.md index 62d1b1be..01d6cb4a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,8 @@ +# Unreleased + +## Changed + +- inclusion of `__all__` in autogenerated `version.py` files to aid IDE autoimports # v8.0.4 diff --git a/src/setuptools_scm/_integration/dump_version.py b/src/setuptools_scm/_integration/dump_version.py index cc7d3b1b..a7bfcae7 100644 --- a/src/setuptools_scm/_integration/dump_version.py +++ b/src/setuptools_scm/_integration/dump_version.py @@ -15,9 +15,14 @@ ".py": """\ # file generated by setuptools-scm # don't change, don't track in version control + +__all__ = ["__version__", "__version_tuple__", "version", "version_tuple"] + TYPE_CHECKING = False if TYPE_CHECKING: - from typing import Tuple, Union + from typing import Tuple + from typing import Union + VERSION_TUPLE = Tuple[Union[int, str], ...] else: VERSION_TUPLE = object diff --git a/testing/test_functions.py b/testing/test_functions.py index af99b540..5f394b0b 100644 --- a/testing/test_functions.py +++ b/testing/test_functions.py @@ -153,6 +153,14 @@ def test_dump_version_flake8(tmp_path: Path) -> None: subprocess.run([flake8, "VERSION.py"], cwd=tmp_path, check=True) +def test_dump_version_ruff(tmp_path: Path) -> None: + ruff = shutil.which("ruff") + if ruff is None: + pytest.skip("ruff not found") + dump_a_version(tmp_path) + subprocess.run([ruff, "check", "--no-fix", "VERSION.py"], cwd=tmp_path, check=True) + + def test_has_command() -> None: with pytest.warns(RuntimeWarning, match="yadayada"): assert not has_command("yadayada_setuptools_aint_ne")