Skip to content

Commit be34dd1

Browse files
Merge pull request #1076 from jamesbraza/all-in-version
`version.py` including `__all__`
2 parents d665621 + 24d7797 commit be34dd1

File tree

3 files changed

+19
-1
lines changed

3 files changed

+19
-1
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
# Unreleased
2+
3+
## Changed
4+
5+
- inclusion of `__all__` in autogenerated `version.py` files to aid IDE autoimports
16

27
# v8.0.4
38

src/setuptools_scm/_integration/dump_version.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,14 @@
1515
".py": """\
1616
# file generated by setuptools-scm
1717
# don't change, don't track in version control
18+
19+
__all__ = ["__version__", "__version_tuple__", "version", "version_tuple"]
20+
1821
TYPE_CHECKING = False
1922
if TYPE_CHECKING:
20-
from typing import Tuple, Union
23+
from typing import Tuple
24+
from typing import Union
25+
2126
VERSION_TUPLE = Tuple[Union[int, str], ...]
2227
else:
2328
VERSION_TUPLE = object

testing/test_functions.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,14 @@ def test_dump_version_flake8(tmp_path: Path) -> None:
153153
subprocess.run([flake8, "VERSION.py"], cwd=tmp_path, check=True)
154154

155155

156+
def test_dump_version_ruff(tmp_path: Path) -> None:
157+
ruff = shutil.which("ruff")
158+
if ruff is None:
159+
pytest.skip("ruff not found")
160+
dump_a_version(tmp_path)
161+
subprocess.run([ruff, "check", "--no-fix", "VERSION.py"], cwd=tmp_path, check=True)
162+
163+
156164
def test_has_command() -> None:
157165
with pytest.warns(RuntimeWarning, match="yadayada"):
158166
assert not has_command("yadayada_setuptools_aint_ne")

0 commit comments

Comments
 (0)