Skip to content

Commit 926ca5a

Browse files
refactor: consolidate config in pyproject.toml
Move ruff config (ruff.toml), project metadata (setup.py/setup.cfg)
1 parent 1279d24 commit 926ca5a

5 files changed

Lines changed: 49 additions & 49 deletions

File tree

‎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>=61"]
3+
build-backend = "setuptools.build_meta"
4+
5+
[project]
6+
name = "things.py"
7+
description = "A simple Python 3 library to read your Things app data."
8+
readme = "README.md"
9+
requires-python = ">=3.11"
10+
authors = [{ name = "Alexander Willner, Michael B.", email = "alex@willner.ws" }]
11+
urls = { Homepage = "https://github.com/thingsapi/things.py" }
12+
classifiers = [
13+
"Development Status :: 3 - Alpha",
14+
"Programming Language :: Python :: 3",
15+
"License :: OSI Approved :: Apache Software License",
16+
"Operating System :: MacOS :: MacOS X",
17+
"Natural Language :: English",
18+
]
19+
dependencies = []
20+
dynamic = ["version"]
21+
22+
[tool.setuptools.dynamic]
23+
version = { attr = "things.__version__" }
24+
25+
# Ruff-Konfiguration: Ziel ist die älteste unterstützte Version
26+
# (pyproject.toml: requires-python >= 3.11, CI testet 3.11+).
27+
# Damit sind moderne Annotations-Syntaxen (PEP 585/604) ok.
28+
[tool.ruff]
29+
target-version = "py311"
30+
31+
[tool.ruff.lint]
32+
# TRY004 will TypeError statt ValueError bei falschem Typ. ValueError ist
33+
# hier API-Vertrag: things/api.get() fängt ValueError, Tests erwarten ihn.
34+
ignore = ["TRY004"]
35+
# C901 kennt nur flake8 (max-complexity = 10 in setup.cfg). Die noqa dafür
36+
# in things/api.py muss bleiben; Ruff soll sie als verwendet werten.
37+
external = ["C901"]
38+
39+
[tool.pytest.ini_options]
40+
doctest_optionflags = ["NORMALIZE_WHITESPACE", "ELLIPSIS"]

‎requirements.txt‎

Whitespace-only changes.

‎ruff.toml‎

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

‎setup.cfg‎

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
1-
[metadata]
2-
version = attr: things.__version__
3-
1+
# Project metadata, ruff and pytest live in pyproject.toml.
2+
# flake8/pycodestyle/pydocstyle/pylint/isort stay here: they don't read pyproject.toml.
43
[pycodestyle]
54
max_line_length = 88
65
ignore = E501,E203,W503,E231,E241,E202
@@ -19,6 +18,3 @@ disable=C0412
1918
[isort]
2019
lines_after_imports = 2
2120
force_sort_within_sections = True
22-
23-
[tool:pytest]
24-
doctest_optionflags = NORMALIZE_WHITESPACE ELLIPSIS

‎setup.py‎

Lines changed: 7 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
"""A simple Python 3 library to read your Things app data."""
1+
"""Packaging shim (py2app): metadata lives in pyproject.toml."""
22

33
import os
44

@@ -15,38 +15,14 @@ def package_files(directory):
1515
return paths
1616

1717

18-
APP = [""]
19-
AUTHOR = "Alexander Willner, Michael B."
20-
AUTHOR_MAIL = "alex@willner.ws"
21-
DESCRIPTON = "A simple Python 3 library to read your Things app data."
22-
URL = "https://github.com/thingsapi/things.py"
23-
DATA_FILES = package_files("")
24-
OPTIONS = {
25-
"argv_emulation": False,
26-
}
27-
28-
with open("README.md", "r", encoding="utf-8") as fh:
29-
LONG_DESRIPTION = fh.read()
30-
3118
setup(
32-
app=APP,
33-
author=AUTHOR,
34-
author_email=AUTHOR_MAIL,
19+
# name stays here (not only in pyproject.toml): py2app's finalize hook
20+
# reads it before pyproject metadata is merged; without it every
21+
# setup.py invocation fails with "no script, modules or dest_base specified".
3522
name="things.py",
36-
description=DESCRIPTON,
37-
long_description=LONG_DESRIPTION,
38-
long_description_content_type="text/markdown",
39-
url=URL,
23+
app=[""],
4024
packages=find_packages(),
41-
classifiers=[
42-
"Development Status :: 3 - Alpha",
43-
"Programming Language :: Python :: 3",
44-
"License :: OSI Approved :: Apache Software License",
45-
"Operating System :: MacOS :: MacOS X",
46-
"Natural Language :: English",
47-
],
48-
python_requires=">=3.11",
49-
data_files=DATA_FILES,
50-
options={"py2app": OPTIONS},
25+
data_files=package_files(""),
26+
options={"py2app": {"argv_emulation": False}},
5127
setup_requires=["py2app"],
5228
)

0 commit comments

Comments
 (0)