From c118c35adeb481937eff640445ded3e834be9a38 Mon Sep 17 00:00:00 2001 From: Mathieu Dupuy Date: Tue, 23 Jul 2024 22:22:58 +0200 Subject: [PATCH] migrate setup.cfg to pyproject.toml --- pyproject.toml | 135 +++++++++++++++++++++++++++++++++++++++++++++++++ setup.cfg | 99 ------------------------------------ setup.py | 3 -- 3 files changed, 135 insertions(+), 102 deletions(-) create mode 100644 pyproject.toml delete mode 100644 setup.py diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 000000000..85aaeefa2 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,135 @@ +[build-system] +requires = ["setuptools>=61.2"] +build-backend = "setuptools.build_meta" + +[project] +name = "Radicale" +version = "3.dev" +authors = [{name = "Guillaume Ayoub", email = "guillaume.ayoub@kozea.fr"}] +license = {text = "GNU GPL v3"} +description = "CalDAV and CardDAV Server" +keywords = ["calendar", "addressbook", "CalDAV", "CardDAV"] +classifiers = [ + "Development Status :: 5 - Production/Stable", + "Environment :: Console", + "Environment :: Web Environment", + "Intended Audience :: End Users/Desktop", + "Intended Audience :: Information Technology", + "License :: OSI Approved :: GNU General Public License (GPL)", + "Operating System :: OS Independent", + "Programming Language :: Python :: 3", + "Programming Language :: Python :: 3.8", + "Programming Language :: Python :: 3.9", + "Programming Language :: Python :: 3.10", + "Programming Language :: Python :: 3.11", + "Programming Language :: Python :: 3.12", + "Programming Language :: Python :: Implementation :: CPython", + "Programming Language :: Python :: Implementation :: PyPy", + "Topic :: Office/Business :: Groupware", +] +urls = {Homepage = "https://radicale.org/"} +requires-python = ">=3.8.0" +dependencies = [ + "defusedxml", + "passlib", + "vobject>=0.9.6", + "python-dateutil>=2.7.3", + "pika>=1.1.0", +] + +[project.readme] +file = "README.md" +content-type = "text/markdown" + +[project.optional-dependencies] +test = [ + "pytest>=7", + "typeguard<4.3", + "waitress", + "bcrypt", +] +bcrypt = ["bcrypt"] + +[project.scripts] +radicale = "radicale.__main__:run" + +[tool] + +[tool.setuptools] +platforms = ["Any"] +include-package-data = false + +[tool.setuptools.packages.find] +exclude = ["*.tests"] # *.tests.*; tests.*; tests +namespaces = false + +[tool.setuptools.package-data] +radicale = [ + "web/internal_data/css/icon.png", + "web/internal_data/css/loading.svg", + "web/internal_data/css/logo.svg", + "web/internal_data/css/main.css", + "web/internal_data/css/icons/delete.svg", + "web/internal_data/css/icons/download.svg", + "web/internal_data/css/icons/edit.svg", + "web/internal_data/css/icons/new.svg", + "web/internal_data/css/icons/upload.svg", + "web/internal_data/fn.js", + "web/internal_data/index.html", + "py.typed", +] + +[tool.pytest.ini_options] +addopts = "--typeguard-packages=radicale" + +[tool.testenv] +extras = "test" +deps = """ +flake8 +isort +# mypy installation fails with pypy<3.9 +mypy; implementation_name!='pypy' or python_version>='3.9' +types-setuptools +pytest-cov""" +commands = ''' +flake8 . +isort --check --diff . +# Run mypy if it's installed +python -c 'import importlib.util, subprocess, sys; \ +importlib.util.find_spec("mypy") \ +and sys.exit(subprocess.run(["mypy", "."]).returncode) \ +or print("Skipped: mypy is not installed")' +pytest -r s --cov --cov-report=term --cov-report=xml .''' + +[tool.isort] +known_standard_library = "_dummy_thread,_thread,abc,aifc,argparse,array,ast,asynchat,asyncio,asyncore,atexit,audioop,base64,bdb,binascii,binhex,bisect,builtins,bz2,cProfile,calendar,cgi,cgitb,chunk,cmath,cmd,code,codecs,codeop,collections,colorsys,compileall,concurrent,configparser,contextlib,contextvars,copy,copyreg,crypt,csv,ctypes,curses,dataclasses,datetime,dbm,decimal,difflib,dis,distutils,doctest,dummy_threading,email,encodings,ensurepip,enum,errno,faulthandler,fcntl,filecmp,fileinput,fnmatch,formatter,fpectl,fractions,ftplib,functools,gc,getopt,getpass,gettext,glob,grp,gzip,hashlib,heapq,hmac,html,http,imaplib,imghdr,imp,importlib,inspect,io,ipaddress,itertools,json,keyword,lib2to3,linecache,locale,logging,lzma,macpath,mailbox,mailcap,marshal,math,mimetypes,mmap,modulefinder,msilib,msvcrt,multiprocessing,netrc,nis,nntplib,ntpath,numbers,operator,optparse,os,ossaudiodev,parser,pathlib,pdb,pickle,pickletools,pipes,pkgutil,platform,plistlib,poplib,posix,posixpath,pprint,profile,pstats,pty,pwd,py_compile,pyclbr,pydoc,queue,quopri,random,re,readline,reprlib,resource,rlcompleter,runpy,sched,secrets,select,selectors,shelve,shlex,shutil,signal,site,smtpd,smtplib,sndhdr,socket,socketserver,spwd,sqlite3,sre,sre_compile,sre_constants,sre_parse,ssl,stat,statistics,string,stringprep,struct,subprocess,sunau,symbol,symtable,sys,sysconfig,syslog,tabnanny,tarfile,telnetlib,tempfile,termios,test,textwrap,threading,time,timeit,tkinter,token,tokenize,trace,traceback,tracemalloc,tty,turtle,turtledemo,types,typing,unicodedata,unittest,urllib,uu,uuid,venv,warnings,wave,weakref,webbrowser,winreg,winsound,wsgiref,xdrlib,xml,xmlrpc,zipapp,zipfile,zipimport,zlib" +known_third_party = "defusedxml,passlib,pkg_resources,pytest,vobject" + +[tool.flake8] +# Only enable default tests (https://github.com/PyCQA/flake8/issues/790#issuecomment-812823398) +# DNE: DOES-NOT-EXIST +select = "E,F,W,C90,DNE000" +ignore = "E121,E123,E126,E226,E24,E704,W503,W504,DNE000,E501" +extend-exclude = "build" + +[tool.mypy] +ignore_missing_imports = true +show_error_codes = true +exclude = "(^|/)build($|/)" + +[tool.coverage.run] +branch = true +source = ["radicale"] +omit = ["tests/*", "*/tests/*"] + +[tool.coverage.report] +# Regexes for lines to exclude from consideration +exclude_lines = [ + # Have to re-enable the standard pragma + "pragma: no cover", + # Don't complain if tests don't hit defensive assertion code: + "raise AssertionError", + "raise NotImplementedError", + # Don't complain if non-runnable code isn't run: + "if __name__ == .__main__.:", +] diff --git a/setup.cfg b/setup.cfg index 3effad822..655861666 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,75 +1,3 @@ -[metadata] -name = Radicale -version = 3.dev -author = Guillaume Ayoub -author_email = guillaume.ayoub@kozea.fr -license = GNU GPL v3 -description = CalDAV and CardDAV Server -keywords = calendar, addressbook, CalDAV, CardDAV -url = https://radicale.org/ -long_description = file: README.md -long_description_content_type = text/markdown -classifiers = - Development Status :: 5 - Production/Stable - Environment :: Console - Environment :: Web Environment - Intended Audience :: End Users/Desktop - Intended Audience :: Information Technology - License :: OSI Approved :: GNU General Public License (GPL) - Operating System :: OS Independent - Programming Language :: Python :: 3 - Programming Language :: Python :: 3.8 - Programming Language :: Python :: 3.9 - Programming Language :: Python :: 3.10 - Programming Language :: Python :: 3.11 - Programming Language :: Python :: 3.12 - Programming Language :: Python :: Implementation :: CPython - Programming Language :: Python :: Implementation :: PyPy - Topic :: Office/Business :: Groupware -platforms = Any - -[options] -packages = find: -install_requires = - defusedxml - passlib - vobject>=0.9.6 - python-dateutil>=2.7.3 - pika>=1.1.0 -python_requires = >=3.8.0 - -[options.packages.find] -exclude = *.tests; *.tests.*; tests.*; tests - -[options.entry_points] -console_scripts = radicale = radicale.__main__:run - -[options.extras_require] -test = - pytest>=7 - typeguard<4.3 - waitress - bcrypt -bcrypt = bcrypt - -[options.package_data] -radicale = - web/internal_data/css/icon.png - web/internal_data/css/loading.svg - web/internal_data/css/logo.svg - web/internal_data/css/main.css - web/internal_data/css/icons/delete.svg - web/internal_data/css/icons/download.svg - web/internal_data/css/icons/edit.svg - web/internal_data/css/icons/new.svg - web/internal_data/css/icons/upload.svg - web/internal_data/fn.js - web/internal_data/index.html - py.typed - -[tool:pytest] -addopts = --typeguard-packages=radicale - [tox:tox] [testenv] @@ -91,36 +19,9 @@ commands = or print("Skipped: mypy is not installed")' pytest -r s --cov --cov-report=term --cov-report=xml . -[tool:isort] -known_standard_library = _dummy_thread,_thread,abc,aifc,argparse,array,ast,asynchat,asyncio,asyncore,atexit,audioop,base64,bdb,binascii,binhex,bisect,builtins,bz2,cProfile,calendar,cgi,cgitb,chunk,cmath,cmd,code,codecs,codeop,collections,colorsys,compileall,concurrent,configparser,contextlib,contextvars,copy,copyreg,crypt,csv,ctypes,curses,dataclasses,datetime,dbm,decimal,difflib,dis,distutils,doctest,dummy_threading,email,encodings,ensurepip,enum,errno,faulthandler,fcntl,filecmp,fileinput,fnmatch,formatter,fpectl,fractions,ftplib,functools,gc,getopt,getpass,gettext,glob,grp,gzip,hashlib,heapq,hmac,html,http,imaplib,imghdr,imp,importlib,inspect,io,ipaddress,itertools,json,keyword,lib2to3,linecache,locale,logging,lzma,macpath,mailbox,mailcap,marshal,math,mimetypes,mmap,modulefinder,msilib,msvcrt,multiprocessing,netrc,nis,nntplib,ntpath,numbers,operator,optparse,os,ossaudiodev,parser,pathlib,pdb,pickle,pickletools,pipes,pkgutil,platform,plistlib,poplib,posix,posixpath,pprint,profile,pstats,pty,pwd,py_compile,pyclbr,pydoc,queue,quopri,random,re,readline,reprlib,resource,rlcompleter,runpy,sched,secrets,select,selectors,shelve,shlex,shutil,signal,site,smtpd,smtplib,sndhdr,socket,socketserver,spwd,sqlite3,sre,sre_compile,sre_constants,sre_parse,ssl,stat,statistics,string,stringprep,struct,subprocess,sunau,symbol,symtable,sys,sysconfig,syslog,tabnanny,tarfile,telnetlib,tempfile,termios,test,textwrap,threading,time,timeit,tkinter,token,tokenize,trace,traceback,tracemalloc,tty,turtle,turtledemo,types,typing,unicodedata,unittest,urllib,uu,uuid,venv,warnings,wave,weakref,webbrowser,winreg,winsound,wsgiref,xdrlib,xml,xmlrpc,zipapp,zipfile,zipimport,zlib -known_third_party = defusedxml,passlib,pkg_resources,pytest,vobject - [flake8] # Only enable default tests (https://github.com/PyCQA/flake8/issues/790#issuecomment-812823398) # DNE: DOES-NOT-EXIST select = E,F,W,C90,DNE000 ignore = E121,E123,E126,E226,E24,E704,W503,W504,DNE000,E501 extend-exclude = build - -[mypy] -ignore_missing_imports = True -show_error_codes = True -exclude = (^|/)build($|/) - -[coverage:run] -branch = True -source = radicale -omit = tests/*,*/tests/* - -[coverage:report] -# Regexes for lines to exclude from consideration -exclude_lines = - # Have to re-enable the standard pragma - pragma: no cover - - # Don't complain if tests don't hit defensive assertion code: - raise AssertionError - raise NotImplementedError - - # Don't complain if non-runnable code isn't run: - if __name__ == .__main__.: diff --git a/setup.py b/setup.py deleted file mode 100644 index 606849326..000000000 --- a/setup.py +++ /dev/null @@ -1,3 +0,0 @@ -from setuptools import setup - -setup()