From 080cf6a3c9b9b16f508fd2f154e98d428d21778d Mon Sep 17 00:00:00 2001 From: Tomas Janousek Date: Thu, 23 Feb 2023 23:13:23 +0000 Subject: [PATCH] Move from setup.cfg to pyproject.toml --- Makefile | 5 ++-- pyproject.toml | 74 +++++++++++++++++++++++++++++++++++++++++++++-- setup.cfg | 78 -------------------------------------------------- setup.py | 4 --- 4 files changed, 74 insertions(+), 87 deletions(-) delete mode 100644 setup.py diff --git a/Makefile b/Makefile index db146c4..f1fe99b 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..879a447 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,13 +1,81 @@ [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-offline" +dynamic = ["version"] +authors = [{name = "Tomáš Janoušek", email = "tomi@nomi.cz"}] +license = {text = "MIT"} +description = "Leep a local mirror of Strava activities for further analysis/processing" +classifiers = [ + "Development Status :: 5 - Production/Stable", + "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 :: Database", + "Topic :: Utilities", +] +urls = {Homepage = "https://github.com/liskin/strava-offline"} +requires-python = "~= 3.7" +dependencies = [ + "PyYAML", + "bottle", + "click ~= 8.0", + "click-config-file", + "click-option-group", + "importlib-metadata; python_version<'3.10'", + "platformdirs >= 2.1", + "requests", + "requests_oauthlib", + "tabulate", + "typing-extensions", # python 3.7 compat +] + +[project.readme] +file = "README.md" +content-type = "text/markdown" + +[project.optional-dependencies] +dev = [ + "build >= 0.7", + "cram", + "flake8", + "isort >= 5.0", + "mypy >= 0.900", + "pyflakes >= 2.2.0", + "twine", + "types-PyYAML", + "types-requests", + "types-tabulate", +] +test = [ + "pytest", + "pytest-recording", + "vcrpy >= 2.1.0", +] + +[project.scripts] +strava-offline = "strava_offline.cli:cli" + [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 2ef3681..74042f2 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,81 +1,3 @@ -[metadata] -name = strava-offline -url = https://github.com/liskin/strava-offline - -author = Tomáš Janoušek -author_email = tomi@nomi.cz -license = MIT - -description = "Leep a local mirror of Strava activities for further analysis/processing" -long_description = file: README.md -long_description_content_type = text/markdown - -classifiers = - Development Status :: 5 - Production/Stable - 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 :: Database - Topic :: Utilities - -[options] -package_dir = - =src -packages = find: -python_requires = ~= 3.7 -install_requires = - PyYAML - bottle - click ~= 8.0 - click-config-file - click-option-group - importlib-metadata; python_version<'3.10' - platformdirs >= 2.1 - requests - requests_oauthlib - tabulate - typing-extensions # python 3.7 compat -tests_require = - -[options.extras_require] -dev = - build >= 0.7 - cram - flake8 - isort >= 5.0 - mypy >= 0.730 - pyflakes >= 2.2.0 - twine - types-PyYAML - types-requests - types-tabulate -test = - pytest - pytest-recording - vcrpy >= 2.1.0 - -[options.packages.find] -where=src - -[options.package_data] -* = - py.typed - -[options.entry_points] -console_scripts = - strava-offline = strava_offline.cli:cli - -[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 fc8081c..0000000 --- a/setup.py +++ /dev/null @@ -1,4 +0,0 @@ -# dummy setup.py, required for pip install --editable - -import setuptools # type: ignore [import] -setuptools.setup()