From d8961232c453f14ea7054523f109e773327401a1 Mon Sep 17 00:00:00 2001 From: Hugo Osvaldo Barrera Date: Mon, 7 Apr 2025 18:00:30 +0200 Subject: [PATCH] Remove setup.py in favour of pyproject.toml Implements: https://github.com/pimutils/vdirsyncer/issues/1164 --- Makefile | 3 +- pyproject.toml | 47 +++++++++++++++++++++++++++++++ setup.py | 76 -------------------------------------------------- 3 files changed, 49 insertions(+), 77 deletions(-) delete mode 100644 setup.py diff --git a/Makefile b/Makefile index 81742d5..42c2431 100644 --- a/Makefile +++ b/Makefile @@ -52,7 +52,8 @@ install-dev: pip install -e . pip install -Ur test-requirements.txt -r docs-requirements.txt pre-commit set -xe && if [ "$(REQUIREMENTS)" = "minimal" ]; then \ - pip install -U --force-reinstall $$(python setup.py --quiet minimal_requirements); \ + pip install pyproject-dependencies && \ + pip install -U --force-reinstall $$(pyproject-dependencies . | sed 's/>/=/'); \ fi .PHONY: docs diff --git a/pyproject.toml b/pyproject.toml index 2930c19..0584ec0 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,7 +1,51 @@ +# Vdirsyncer synchronizes calendars and contacts. +# +# Please refer to https://vdirsyncer.pimutils.org/en/stable/packaging.html for +# how to package vdirsyncer. + [build-system] requires = ["setuptools>=64", "setuptools_scm>=8"] build-backend = "setuptools.build_meta" +[project] +name = "vdirsyncer" +authors = [ + {name = "Markus Unterwaditzer", email = "markus@unterwaditzer.net"}, +] +description = "Synchronize calendars and contacts" +readme = "README.rst" +requires-python = ">=3.8" +keywords = ["todo", "task", "icalendar", "cli"] +license = {text = "ISC"} +classifiers = [ + "Development Status :: 4 - Beta", + "Environment :: Console", + "License :: OSI Approved :: BSD License", + "Operating System :: POSIX", + "Programming Language :: Python :: 3", + "Programming Language :: Python :: 3.10", + "Programming Language :: Python :: 3.11", + "Programming Language :: Python :: 3.7", + "Programming Language :: Python :: 3.8", + "Programming Language :: Python :: 3.9", + "Topic :: Internet", + "Topic :: Utilities", +] +dependencies = [ + "click>=5.0,<9.0", + "click-log>=0.3.0,<0.5.0", + "requests>=2.20.0", + "aiohttp>=3.8.2,<4.0.0", + "aiostream>=0.4.3,<0.5.0", +] +dynamic = ["version"] + +[project.optional-dependencies] +google = ["aiohttp-oauthlib"] + +[project.scripts] +vdirsyncer = "vdirsyncer.cli:app" + [tool.ruff] select = [ "E", @@ -39,6 +83,9 @@ exclude_lines = [ "if TYPE_CHECKING:", ] +[tool.setuptools] +packages = ["vdirsyncer"] + [tool.setuptools_scm] write_to = "vdirsyncer/version.py" version_scheme = "no-guess-dev" diff --git a/setup.py b/setup.py deleted file mode 100644 index 17d198e..0000000 --- a/setup.py +++ /dev/null @@ -1,76 +0,0 @@ -""" -Vdirsyncer synchronizes calendars and contacts. - -Please refer to https://vdirsyncer.pimutils.org/en/stable/packaging.html for -how to package vdirsyncer. -""" - -from __future__ import annotations - -from setuptools import Command -from setuptools import find_packages -from setuptools import setup - -requirements = [ - "click>=5.0,<9.0", - "click-log>=0.3.0, <0.5.0", - "requests >=2.20.0", - "aiohttp>=3.8.2,<4.0.0", - "aiostream>=0.4.3,<0.5.0", -] - - -class PrintRequirements(Command): - description = "Prints minimal requirements" - user_options: list = [] - - def initialize_options(self): - pass - - def finalize_options(self): - pass - - def run(self): - for requirement in requirements: - print(requirement.replace(">", "=").replace(" ", "")) - - -with open("README.rst") as f: - long_description = f.read() - - -setup( - # General metadata - name="vdirsyncer", - author="Markus Unterwaditzer", - author_email="markus@unterwaditzer.net", - url="https://github.com/pimutils/vdirsyncer", - description="Synchronize calendars and contacts", - license="BSD", - long_description=long_description, - # Runtime dependencies - install_requires=requirements, - # Optional dependencies - extras_require={ - "google": ["aiohttp-oauthlib"], - }, - # Other - packages=find_packages(exclude=["tests.*", "tests"]), - include_package_data=True, - cmdclass={"minimal_requirements": PrintRequirements}, - entry_points={"console_scripts": ["vdirsyncer = vdirsyncer.cli:app"]}, - classifiers=[ - "Development Status :: 4 - Beta", - "Environment :: Console", - "License :: OSI Approved :: BSD License", - "Operating System :: POSIX", - "Programming Language :: Python :: 3", - "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 :: Internet", - "Topic :: Utilities", - ], -)