Skip to content

Commit eafa265

Browse files
committed
Remove remnants of setuptools
We also move stuff around pyproject.toml to keep related things together and allow users to use the package without installing it or having setuptools_scm installed.. Signed-off-by: Stephen Finucane <stephen@that.guru>
1 parent 0878ac4 commit eafa265

File tree

4 files changed

+23
-52
lines changed

4 files changed

+23
-52
lines changed

.github/workflows/test.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,7 @@ jobs:
3232
3333
- name: Install dependencies
3434
run: |
35-
python -m pip install --upgrade pip
36-
python -m pip install --upgrade setuptools wheel setuptools_scm
35+
python -m pip install --upgrade pip wheel
3736
python -m pip install sphinx
3837
python -m pip install ".[test,twisted,dev]"
3938

pyproject.toml

Lines changed: 17 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,5 @@
1-
[tool.mypy]
2-
warn_redundant_casts = true
3-
warn_unused_configs = true
4-
check_untyped_defs = true
5-
6-
[[tool.mypy.overrides]]
7-
module = [
8-
"fixtures.*",
9-
"testresources.*",
10-
"testscenarios.*",
11-
]
12-
ignore_missing_imports = true
13-
141
[build-system]
15-
requires = ["setuptools>=61", "hatchling", "hatch_vcs"]
2+
requires = ["hatchling", "hatch_vcs"]
163
build-backend = "hatchling.build"
174

185
[project]
@@ -38,22 +25,16 @@ classifiers = [
3825
"Topic :: Software Development :: Libraries :: Python Modules",
3926
"Topic :: Software Development :: Testing",
4027
]
41-
dependencies = ["setuptools; python_version>='3.12'"]
4228
dynamic = ["version"]
4329
requires-python = ">=3.9"
4430

4531
[project.urls]
4632
Homepage = "https://github.com/testing-cabal/testtools"
4733

48-
[tool.setuptools]
49-
include-package-data = false
50-
51-
[tool.setuptools.packages.find]
52-
include = ["testtools*"]
53-
exclude = ["man*"]
54-
55-
[tool.files]
56-
packages = "testtools"
34+
[project.optional-dependencies]
35+
test = ["testscenarios", "testresources"]
36+
twisted = ["Twisted", "fixtures"]
37+
dev = ["ruff==0.9.7"]
5738

5839
[tool.hatch.version]
5940
source = "vcs"
@@ -67,7 +48,15 @@ version = {version!r}
6748
__version__ = {version_tuple!r}
6849
"""
6950

70-
[project.optional-dependencies]
71-
test = ["testscenarios", "testresources"]
72-
twisted = ["Twisted", "fixtures"]
73-
dev = ["ruff==0.9.7"]
51+
[tool.mypy]
52+
warn_redundant_casts = true
53+
warn_unused_configs = true
54+
check_untyped_defs = true
55+
56+
[[tool.mypy.overrides]]
57+
module = [
58+
"fixtures.*",
59+
"testresources.*",
60+
"testscenarios.*",
61+
]
62+
ignore_missing_imports = true

setup.py

Lines changed: 0 additions & 4 deletions
This file was deleted.

testtools/__init__.py

Lines changed: 5 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -109,21 +109,8 @@
109109
# Otherwise it is major.minor.micro~$(revno).
110110

111111
try:
112-
# If setuptools_scm is installed (e.g. in a development environment with
113-
# an editable install), then use it to determine the version dynamically.
114-
from setuptools_scm import get_version
115-
116-
# This will fail with LookupError if the package is not installed in
117-
# editable mode or if Git is not installed.
118-
version = get_version(root="..", relative_to=__file__)
119-
__version__ = tuple([int(v) if v.isdigit() else v for v in version.split(".")])
120-
except (ImportError, LookupError):
121-
# As a fallback, use the version that is hard-coded in the file.
122-
try:
123-
from ._version import __version__, version
124-
except ModuleNotFoundError:
125-
# The user is probably trying to run this without having installed
126-
# the package, so complain.
127-
raise RuntimeError(
128-
"Testtools is not correctly installed. Please install it with pip."
129-
)
112+
from ._version import __version__, version
113+
except ModuleNotFoundError:
114+
# package is not installed
115+
version = "0.0.0"
116+
__version__ = (0, 0, 0)

0 commit comments

Comments
 (0)