Skip to content

Commit 4e5fd32

Browse files
Update build process to current standards
* setup.py → pyproject.toml * use setuptools_scm to retrieve version from Git tags at build time * use importlib.metadata.version to retrieve version at run time * setuptools_scm pulls all files under version control, adapt MANIFEST.in * update years of copyright under doc
1 parent f3d5bed commit 4e5fd32

File tree

10 files changed

+61
-194
lines changed

10 files changed

+61
-194
lines changed

.github/workflows/run-tests.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,4 +36,4 @@ jobs:
3636
pip install -r .github/requirements.txt
3737
- name: Test with pytest
3838
run: |
39-
python setup.py test
39+
python -m pytest

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
__pycache__/
22
/.env
33
/MANIFEST
4-
/_meta.py
54
/build/
65
/dist/

.readthedocs.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ build:
1111
post_checkout:
1212
- git fetch --unshallow
1313
post_install:
14-
- python setup.py build
14+
- python -m pip install -e .
1515

1616
sphinx:
1717
configuration: doc/src/conf.py

.rtd-require

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
git-props
22
pytest >=3.7.0
33
setuptools
4+
build
5+
pip
46
sphinx-copybutton
57
sphinx_rtd_theme

MANIFEST.in

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
1-
include CHANGES.rst
2-
include LICENSE.txt
3-
include MANIFEST.in
4-
include README.rst
5-
include _meta.py
1+
recursive-exclude .github *
2+
exclude .gitignore
3+
exclude .readthedocs.yaml
4+
exclude .rtd-require
5+
recursive-exclude doc *
66
include doc/examples/*.py
7-
include tests/conftest.py
8-
include tests/pytest.ini
9-
include tests/test_*.py
7+
exclude Makefile
8+
exclude python-pytest-dependency.spec

Makefile

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,13 @@ BUILDLIB = $(CURDIR)/build/lib
33

44

55
build:
6-
$(PYTHON) setup.py build
6+
$(PYTHON) -m build
77

88
test:
9-
$(PYTHON) setup.py test
9+
$(PYTHON) -m pytest
1010

1111
sdist:
12-
$(PYTHON) setup.py sdist
12+
$(PYTHON) -m build --sdist
1313

1414
doc-html: build
1515
$(MAKE) -C doc html PYTHONPATH=$(BUILDLIB)
@@ -19,13 +19,9 @@ clean:
1919
rm -rf __pycache__
2020

2121
distclean: clean
22-
rm -f MANIFEST _meta.py
2322
rm -rf dist
2423
rm -rf tests/.pytest_cache
2524
$(MAKE) -C doc distclean
2625

27-
meta:
28-
$(PYTHON) setup.py meta
2926

30-
31-
.PHONY: build test sdist doc-html clean distclean meta
27+
.PHONY: build test sdist doc-html clean distclean

doc/src/conf.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
1-
# -*- coding: utf-8 -*-
2-
#
31
# Configuration file for the Sphinx documentation builder.
42
#
53
# This file does only contain a selection of the most common options. For a
64
# full list see the documentation:
75
# http://www.sphinx-doc.org/en/master/config
86

7+
from importlib.metadata import version, PackageNotFoundError
98
from pathlib import Path
109
import sys
1110

@@ -19,11 +18,14 @@
1918
# -- Project information -----------------------------------------------------
2019

2120
project = 'pytest-dependency'
22-
copyright = '2016–2023, Rolf Krahl'
21+
copyright = '2016–2025, Rolf Krahl'
2322
author = 'Rolf Krahl'
2423

2524
# The full version, including alpha/beta/rc tags
26-
release = pytest_dependency.__version__
25+
try:
26+
release = version(project)
27+
except PackageNotFoundError:
28+
release = '0.0.0'
2729
# The short X.Y version
2830
version = ".".join(release.split(".")[0:2])
2931

pyproject.toml

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
[build-system]
2+
requires = ["setuptools>=77.0.3", "setuptools-scm>=8"]
3+
build-backend = "setuptools.build_meta"
4+
5+
[project]
6+
name = "pytest-dependency"
7+
description = "Manage dependencies of tests"
8+
authors = [{name = "Rolf Krahl", email = "[email protected]"}]
9+
readme = "README.rst"
10+
license = "Apache-2.0"
11+
requires-python = ">=3.7"
12+
dependencies = [
13+
"pytest >= 3.7.0",
14+
]
15+
dynamic = ["version"]
16+
classifiers = [
17+
"Development Status :: 4 - Beta",
18+
"Framework :: Pytest",
19+
"Intended Audience :: Developers",
20+
"Operating System :: OS Independent",
21+
"Programming Language :: Python",
22+
"Programming Language :: Python :: 3.7",
23+
"Programming Language :: Python :: 3.8",
24+
"Programming Language :: Python :: 3.9",
25+
"Programming Language :: Python :: 3.10",
26+
"Programming Language :: Python :: 3.11",
27+
"Programming Language :: Python :: 3.12",
28+
"Programming Language :: Python :: 3.13",
29+
"Topic :: Software Development :: Testing",
30+
]
31+
32+
[project.urls]
33+
Homepage = "https://github.com/RKrahl/pytest-dependency"
34+
Documentation = "https://pytest-dependency.readthedocs.io"
35+
Source = "https://github.com/RKrahl/pytest-dependency.git"
36+
Download = "https://github.com/RKrahl/pytest-dependency/releases/"
37+
Changelog = "https://pytest-dependency.readthedocs.io/en/latest/changelog.html"
38+
39+
[project.entry-points.pytest11]
40+
dependency = "pytest_dependency"

setup.py

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

src/pytest_dependency.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
"""$DOC"""
22

3-
__version__ = "$VERSION"
4-
53
import logging
64
import pytest
75

0 commit comments

Comments
 (0)