Skip to content

Commit 7a0ee32

Browse files
committed
chore: use hatchling instead of setuptools setup.py
Signed-off-by: Henry Schreiner <[email protected]>
1 parent e82b1bf commit 7a0ee32

File tree

7 files changed

+108
-118
lines changed

7 files changed

+108
-118
lines changed

.circleci/prepare.sh

+3-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,9 @@ set -o xtrace
44

55
$PYTHON --version
66
$PYTHON -m pip --version
7-
$PYTHON -m virtualenv -p "$PYTHON" venv
7+
$PYTHON -m virtualenv --version
8+
$PYTHON -m virtualenv --no-setuptools --no-wheel -p "$PYTHON" venv
9+
venv/bin/python -m pip install -U pip
810
venv/bin/python -m pip install -e ".[dev]"
911
venv/bin/python -m pip freeze
1012
venv/bin/python --version

.pre-commit-config.yaml

-6
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,6 @@ repos:
2020
args: ["--fix", "--show-fixes"]
2121
- id: ruff-format
2222

23-
- repo: https://github.com/asottile/setup-cfg-fmt
24-
rev: v2.5.0
25-
hooks:
26-
- id: setup-cfg-fmt
27-
args: [--include-version-classifiers, --min-py-version=3.8, --max-py-version=3.12]
28-
2923
- repo: https://github.com/pre-commit/mirrors-mypy
3024
rev: v1.10.0
3125
hooks:

MANIFEST.in

-6
This file was deleted.

bin/bump_version.py

+8-7
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,12 @@
11
#!/usr/bin/env python3
22

33
# /// script
4-
# dependencies = ["click", "packaging"]
4+
# dependencies = ["click", "packaging", "tomli; python_version<'3.11'"]
55
# ///
66

77

88
from __future__ import annotations
99

10-
import configparser
1110
import glob
1211
import os
1312
import subprocess
@@ -18,6 +17,11 @@
1817
import click
1918
from packaging.version import InvalidVersion, Version
2019

20+
if sys.version_info < (3, 11):
21+
import tomli as tomllib
22+
else:
23+
import tomllib
24+
2125
config = [
2226
# file path, version find/replace format
2327
("README.md", "cibuildwheel=={}"),
@@ -27,7 +31,6 @@
2731
("docs/setup.md", "cibuildwheel=={}"),
2832
("examples/*", "cibuildwheel=={}"),
2933
("examples/*", "cibuildwheel@v{}"),
30-
("setup.cfg", "version = {}"),
3134
]
3235

3336
RED = "\u001b[31m"
@@ -37,10 +40,8 @@
3740

3841
@click.command()
3942
def bump_version() -> None:
40-
# Update if moving setup.cfg to pyproject.toml
41-
cfg = configparser.ConfigParser()
42-
cfg.read("setup.cfg")
43-
current_version = cfg["metadata"]["version"]
43+
with open("pyproject.toml", "rb") as f:
44+
current_version = tomllib.load(f)["project"]["version"]
4445

4546
try:
4647
commit_date_str = subprocess.run(

pyproject.toml

+97-3
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,102 @@
11
[build-system]
2-
requires = [
3-
"setuptools>=42",
2+
requires = ["hatchling"]
3+
build-backend = "hatchling.build"
4+
5+
[project]
6+
name = "cibuildwheel"
7+
dynamic = ["version"]
8+
description = "Build Python wheels on CI with minimal configuration."
9+
readme = "README.md"
10+
license = "BSD-2-Clause"
11+
requires-python = ">=3.8"
12+
authors = [
13+
{ name = "Joe Rickerby", email = "[email protected]" },
14+
]
15+
keywords = [
16+
"appveyor",
17+
"ci",
18+
"linux",
19+
"macos",
20+
"packaging",
21+
"pypi",
22+
"travis",
23+
"wheel",
24+
"windows",
25+
]
26+
classifiers = [
27+
"Development Status :: 5 - Production/Stable",
28+
"Intended Audience :: Developers",
29+
"License :: OSI Approved :: BSD License",
30+
"Natural Language :: English",
31+
"Programming Language :: Python :: 3",
32+
"Programming Language :: Python :: 3 :: Only",
33+
"Programming Language :: Python :: 3.8",
34+
"Programming Language :: Python :: 3.9",
35+
"Programming Language :: Python :: 3.10",
36+
"Programming Language :: Python :: 3.11",
37+
"Programming Language :: Python :: 3.12",
38+
"Programming Language :: Python :: Implementation :: CPython",
39+
"Topic :: Software Development :: Build Tools",
40+
]
41+
dependencies = [
42+
"bashlex!=0.13",
43+
"bracex",
44+
"certifi",
45+
"filelock",
46+
"packaging>=20.9",
47+
"platformdirs",
48+
"tomli;python_version < '3.11'",
49+
"typing-extensions>=4.1.0;python_version < '3.11'",
50+
]
51+
52+
[project.optional-dependencies]
53+
bin = [
54+
"click",
55+
"packaging>=21.0",
56+
"pip-tools",
57+
"pygithub",
58+
"pyyaml",
59+
"requests",
60+
"rich>=9.6",
61+
]
62+
dev = [
63+
"cibuildwheel[test,bin]",
464
]
5-
build-backend = "setuptools.build_meta"
65+
docs = [
66+
"jinja2>=3.1.2",
67+
"mkdocs-include-markdown-plugin==2.8.0",
68+
"mkdocs-macros-plugin",
69+
"mkdocs==1.3.1",
70+
"pymdown-extensions",
71+
]
72+
test = [
73+
"build",
74+
"jinja2",
75+
"pytest-timeout",
76+
"pytest-xdist",
77+
"pytest>=6",
78+
"tomli_w",
79+
"validate-pyproject",
80+
]
81+
82+
[project.scripts]
83+
cibuildwheel = "cibuildwheel.__main__:main"
84+
85+
[project.entry-points."validate_pyproject.tool_schema"]
86+
cibuildwheel = "cibuildwheel.schema:get_schema"
687

88+
[project.urls]
89+
Changelog = "https://github.com/pypa/cibuildwheel#changelog"
90+
Documentation = "https://cibuildwheel.pypa.io"
91+
Homepage = "https://github.com/pypa/cibuildwheel"
92+
93+
[tool.hatch.version]
94+
path = "cibuildwheel/__init__.py"
95+
96+
[tool.hatch.build.targets.sdist]
97+
include = [
98+
"/cibuildwheel",
99+
]
7100

8101
[tool.pytest.ini_options]
9102
minversion = "6.0"
@@ -162,6 +255,7 @@ flake8-unused-arguments.ignore-variadic-names = true
162255
[tool.ruff.lint.per-file-ignores]
163256
"unit_test/*" = ["PLC1901"]
164257
"cibuildwheel/_compat/**.py" = ["TID251"]
258+
"bin/*" = ["TID251"]
165259

166260
[tool.repo-review]
167261
ignore = ["PC170", "PP303"]

setup.cfg

-57
This file was deleted.

setup.py

-38
This file was deleted.

0 commit comments

Comments
 (0)