Skip to content

Commit b9bcb58

Browse files
committed
Switch from setup.py to pyproject.toml and use GitHub Actions for PyPI releases.
1 parent 3c2bef4 commit b9bcb58

File tree

5 files changed

+94
-74
lines changed

5 files changed

+94
-74
lines changed

.github/workflows/release.yml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
name: Publish to PyPI
2+
3+
on:
4+
push:
5+
tags:
6+
- 'v*'
7+
8+
jobs:
9+
release:
10+
name: Publish to PyPI
11+
runs-on: ubuntu-latest
12+
environment: pypi
13+
permissions:
14+
id-token: write
15+
steps:
16+
- uses: actions/checkout@v4
17+
18+
- name: Install uv and set up the Python version
19+
uses: astral-sh/setup-uv@v5
20+
21+
- name: Install the project
22+
run: uv sync --all-groups
23+
24+
- name: Build wheel
25+
run: uv build
26+
27+
- name: Publish package
28+
run: uv publish

dev/release.sh

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,12 +32,11 @@ sed -i -e "s/__version__ = \".*\"/__version__ = \"$VERSION\"/" vulture/version.p
3232
git commit -am "Update version number to ${VERSION} for release."
3333
git tag -a "v$VERSION" -m "v$VERSION" HEAD
3434

35-
python3 setup.py sdist bdist_wheel --universal
36-
twine upload dist/vulture-${VERSION}.tar.gz dist/vulture-${VERSION}-py2.py3-none-any.whl
37-
3835
git push
3936
git push --tags
4037

38+
# PyPI release is created via GitHub Actions on tag push.
39+
4140
# Add changelog to Github release.
4241
./dev/make-release-notes.py "$VERSION" CHANGELOG.md "$CHANGES"
43-
hub release create v"$VERSION" --file="$CHANGES"
42+
gh release create v"$VERSION" --notes-file="$CHANGES"

pyproject.toml

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,59 @@
1+
[build-system]
2+
requires = ["setuptools>=68", "wheel"]
3+
build-backend = "setuptools.build_meta"
4+
5+
[project]
6+
name = "vulture"
7+
dynamic = ["version"]
8+
description = "Find dead code"
9+
readme = { file = "README.md", content-type = "text/markdown" }
10+
keywords = ["dead code removal"]
11+
requires-python = ">=3.8"
12+
license = { file = "LICENSE.txt" }
13+
authors = [
14+
{ name = "Jendrik Seipp", email = "[email protected]" },
15+
]
16+
classifiers = [
17+
"Development Status :: 5 - Production/Stable",
18+
"Environment :: Console",
19+
"Intended Audience :: Developers",
20+
"License :: OSI Approved :: MIT License",
21+
"Programming Language :: Python",
22+
"Programming Language :: Python :: 3",
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+
"Programming Language :: Python :: Implementation :: CPython",
30+
"Programming Language :: Python :: Implementation :: PyPy",
31+
"Topic :: Software Development :: Quality Assurance",
32+
]
33+
dependencies = [
34+
"tomli >= 1.1.0; python_version < '3.11'",
35+
]
36+
37+
[project.urls]
38+
Homepage = "https://github.com/jendrikseipp/vulture"
39+
Repository = "https://github.com/jendrikseipp/vulture"
40+
Changelog = "https://github.com/jendrikseipp/vulture/blob/main/CHANGELOG.md"
41+
42+
[project.scripts]
43+
vulture = "vulture.core:main"
44+
45+
[tool.setuptools]
46+
include-package-data = true
47+
48+
[tool.setuptools.packages.find]
49+
exclude = ["tests", "tests.*"]
50+
51+
[tool.setuptools.package-data]
52+
vulture = ["whitelists/*.py"]
53+
54+
[tool.setuptools.dynamic]
55+
version = { attr = "vulture.version.__version__" }
56+
157
[tool.ruff]
258
exclude = [
359
".eggs",
@@ -73,3 +129,10 @@ docstring-code-format = false
73129
# This only has an effect when the `docstring-code-format` setting is
74130
# enabled.
75131
docstring-code-line-length = "dynamic"
132+
133+
[tool.coverage.run]
134+
omit = [".tox/*"]
135+
parallel = true
136+
137+
[tool.pytest.ini_options]
138+
addopts = "--cov vulture --cov-report=html --cov-report=term --cov-report=xml --cov-append"

setup.cfg

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

setup.py

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

0 commit comments

Comments
 (0)