Skip to content

Commit ca5a56f

Browse files
Replace versioneer with setuptools-scm (#9137)
1 parent a9ad6d4 commit ca5a56f

File tree

7 files changed

+19
-758
lines changed

7 files changed

+19
-758
lines changed

.flake8

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
# https://flake8.readthedocs.io/en/latest/user/error-codes.html
66

77
# Note: there cannot be spaces after commas here
8-
exclude = __init__.py,versioneer.py,distributed/_concurrent_futures_thread.py
8+
exclude = __init__.py,distributed/_concurrent_futures_thread.py
99
ignore =
1010
# Ignores below are aligned with black https://github.com/psf/black/blob/main/.flake8
1111
# Whitespace before ':'

.gitignore

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,11 @@
55
# Cython files
66
*.c
77
*.so
8-
distributed/scheduler.html
98

109
build/
1110
dist/
1211
*.egg-info
1312
docs/build
14-
continuous_integration/hdfs-initialized
1513
.DS_Store
1614
.cache
1715
.coverage
@@ -32,6 +30,12 @@ tags
3230
.venv/
3331
.mypy_cache/
3432

33+
# Project specific
34+
continuous_integration/hdfs-initialized
35+
distributed/scheduler.html
36+
distributed/_version.py
37+
38+
# Test reports
3539
reports/
3640
test_report*.html
3741
test_report*.db

continuous_integration/recipes/distributed/meta.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,8 @@ requirements:
2727
- python >=3.10
2828
- pip
2929
- dask-core {{ dask_version }}
30-
- versioneer =0.29
31-
- setuptools >=62.6
30+
- setuptools-scm
31+
- setuptools >=80
3232
- tomli # [py<311]
3333
run:
3434
- python >=3.10

distributed/__init__.py

Lines changed: 7 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919
import dask
2020
from dask.config import config # type: ignore
2121

22-
from distributed._version import get_versions
2322
from distributed.actor import Actor, ActorFuture, BaseActorFuture
2423
from distributed.client import (
2524
Client,
@@ -77,23 +76,13 @@
7776
)
7877
from distributed.worker_client import local_client, worker_client
7978

80-
81-
def __getattr__(name):
82-
global __version__, __git_revision__
83-
84-
if name == "__version__":
85-
from importlib.metadata import version
86-
87-
__version__ = version("distributed")
88-
return __version__
89-
90-
if name == "__git_revision__":
91-
from distributed._version import get_versions
92-
93-
__git_revision__ = get_versions()["full-revisionid"]
94-
return __git_revision__
95-
96-
raise AttributeError(f"module {__name__!r} has no attribute {name!r}")
79+
try:
80+
# Backwards compatibility with versioneer
81+
from distributed._version import __commit_id__ as __git_revision__
82+
from distributed._version import __version__
83+
except ImportError:
84+
__git_revision__ = "unknown"
85+
__version__ = "unknown"
9786

9887

9988
__all__ = [
@@ -142,7 +131,6 @@ def __getattr__(name):
142131
"get_client",
143132
"get_task_metadata",
144133
"get_task_stream",
145-
"get_versions",
146134
"get_worker",
147135
"local_client",
148136
"performance_report",

0 commit comments

Comments
 (0)