From 31b2b9eda5026126fcc56b531cade2957113d6b7 Mon Sep 17 00:00:00 2001 From: Tomas Janousek Date: Sun, 26 Feb 2023 15:40:15 +0000 Subject: [PATCH] Move from setup.cfg to pyproject.toml --- Makefile | 5 ++-- pyproject.toml | 70 ++++++++++++++++++++++++++++++++++++++++++++--- setup.cfg | 73 -------------------------------------------------- setup.py | 5 ---- 4 files changed, 70 insertions(+), 83 deletions(-) delete mode 100644 setup.py diff --git a/Makefile b/Makefile index a0d0823..ba12ad3 100644 --- a/Makefile +++ b/Makefile @@ -10,7 +10,7 @@ VENV_USE_SYSTEM_SITE_PACKAGES = $(wildcard $(VENV_SYSTEM_SITE_PACKAGES)) VENV_WHEEL = .venv-wheel VENV_WHEEL_PYTHON = $(VENV_WHEEL)/bin/python -PACKAGE = $(eval PACKAGE := $$(subst -,_,$$(shell python3 -c 'import setuptools; setuptools.setup()' --name)))$(PACKAGE) +PACKAGE := $(shell sed -ne '/^name / { y/-/_/; s/^.*=\s*"\(.*\)"/\1/p }' pyproject.toml) .PHONY: venv-system-site-packages venv-system-site-packages: @@ -101,6 +101,7 @@ endef define VENV_CREATE_SYSTEM_SITE_PACKAGES $(PYTHON) -m venv --system-site-packages --without-pip $(VENV) $(VENV_PYTHON) -m pip --version || $(PYTHON) -m venv --system-site-packages $(VENV) + $(VENV_PYTHON) -m pip install 'pip >= 22.3' # PEP-660 (editable without setup.py) touch $(VENV_SYSTEM_SITE_PACKAGES) endef @@ -112,7 +113,7 @@ $(VENV_DONE): export SETUPTOOLS_USE_DISTUTILS := stdlib endif endif -$(VENV_DONE): $(MAKEFILE_LIST) setup.py setup.cfg pyproject.toml +$(VENV_DONE): $(MAKEFILE_LIST) pyproject.toml $(if $(VENV_USE_SYSTEM_SITE_PACKAGES),$(VENV_CREATE_SYSTEM_SITE_PACKAGES),$(VENV_CREATE)) $(VENV_PYTHON) -m pip install -e $(VENV_PIP_INSTALL) touch $@ diff --git a/pyproject.toml b/pyproject.toml index b57b2c0..3caee6e 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,13 +1,77 @@ [build-system] requires = [ - "setuptools >= 42", - "setuptools_scm[toml] >= 3.4", - "wheel", + "setuptools >= 64.0", + "setuptools_scm[toml] >= 6.2", ] build-backend = "setuptools.build_meta" +[project] +name = "strava-gear" +dynamic = ["version"] +authors = [{name = "Tomáš Janoušek", email = "tomi@nomi.cz"}] +license = {text = "MIT"} +description = "Rule based tracker of gear and component wear primarily for Strava" +classifiers = [ + "Development Status :: 4 - Beta", + "Environment :: Console", + "License :: OSI Approved :: MIT License", + "Operating System :: OS Independent", + "Programming Language :: Python :: 3.7", + "Programming Language :: Python :: 3.8", + "Programming Language :: Python :: 3.9", + "Programming Language :: Python :: 3.10", + "Programming Language :: Python :: 3.11", + "Topic :: Utilities", +] +urls = {Homepage = "https://github.com/liskin/strava-gear"} +requires-python = "~= 3.7" +dependencies = [ + "PyYAML", + "click ~= 8.0", + "importlib-metadata; python_version<'3.10'", + "jsonschema", + "platformdirs >= 2.1", + "python-dateutil >= 2.7", + "tabulate", +] + +[project.readme] +file = "README.md" +content-type = "text/markdown" + +[project.optional-dependencies] +dev = [ + "build >= 0.7", + "cram", + "flake8 >= 3.7", + "isort >= 5.0", + "mypy >= 0.900", + "twine", + "types-PyYAML", + "types-python-dateutil", + "types-tabulate", +] +test = [ + "pytest", +] +strava = [ + "strava-offline ~= 1.0", +] + +[project.scripts] +strava-gear = "strava_gear.cli:main" +strava-gear-sync = "strava_gear.cli_strava_offline:cli_sqlite [strava]" + [tool.setuptools_scm] +[tool.setuptools.packages.find] +where = ["src"] +namespaces = false + +[tool.mypy] +python_executable = ".venv/bin/python3" +show_error_codes = true + [tool.isort] profile = "open_stack" diff --git a/setup.cfg b/setup.cfg index 04229a2..74042f2 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,76 +1,3 @@ -[metadata] -name = strava-gear -url = https://github.com/liskin/strava-gear - -author = Tomáš Janoušek -author_email = tomi@nomi.cz -license = MIT - -description = "Rule based tracker of gear and component wear primarily for Strava" -long_description = file: README.md -long_description_content_type = text/markdown - -classifiers = - Development Status :: 4 - Beta - Environment :: Console - License :: OSI Approved :: MIT License - Operating System :: OS Independent - Programming Language :: Python :: 3.7 - Programming Language :: Python :: 3.8 - Programming Language :: Python :: 3.9 - Programming Language :: Python :: 3.10 - Programming Language :: Python :: 3.11 - Topic :: Utilities - -[options] -package_dir = - =src -packages = find: -python_requires = ~= 3.7 -install_requires = - PyYAML - click ~= 8.0 - importlib-metadata; python_version<'3.10' - jsonschema - platformdirs >= 2.1 - python-dateutil >= 2.7 - tabulate -tests_require = - -[options.extras_require] -dev = - build >= 0.7 - cram - flake8 >= 3.7 - isort >= 5.0 - mypy >= 0.730 - twine - types-PyYAML - types-python-dateutil - types-tabulate -test = - pytest -strava = - strava-offline ~= 1.0 - -[options.packages.find] -where=src - -[options.package_data] -* = - py.typed - -[options.entry_points] -console_scripts = - strava-gear = strava_gear.cli:main - strava-gear-sync = strava_gear.cli_strava_offline:cli_sqlite [strava] - -[mypy] -python_executable = .venv/bin/python3 -show_error_codes = True - [flake8] extend-exclude = .venv max-line-length = 120 - -# vim:set et: diff --git a/setup.py b/setup.py deleted file mode 100644 index 082f3d4..0000000 --- a/setup.py +++ /dev/null @@ -1,5 +0,0 @@ -# dummy setup.py, required for pip install --editable - -import setuptools # type: ignore [import] - -setuptools.setup()