Skip to content

Commit

Permalink
Merge pull request #1076 from jamesbraza/all-in-version
Browse files Browse the repository at this point in the history
`version.py` including `__all__`
  • Loading branch information
RonnyPfannschmidt authored Oct 3, 2024
2 parents d665621 + 24d7797 commit be34dd1
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 1 deletion.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
# Unreleased

## Changed

- inclusion of `__all__` in autogenerated `version.py` files to aid IDE autoimports

# v8.0.4

Expand Down
7 changes: 6 additions & 1 deletion src/setuptools_scm/_integration/dump_version.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 8 additions & 0 deletions testing/test_functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down

0 comments on commit be34dd1

Please sign in to comment.