From 6af1cafaa258c5337cafd249f0f81730cba3e8f0 Mon Sep 17 00:00:00 2001 From: Trim21 Date: Sun, 2 Jun 2024 00:11:04 +0800 Subject: [PATCH] Replace "setup.py" with "pyproject.toml" for builds (#1140) See PEP 517 and PEP 631. --- MANIFEST.in | 2 -- pyproject.toml | 81 ++++++++++++++++++++++++++++++++++++++++++++ setup.py | 91 -------------------------------------------------- tox.ini | 1 + 4 files changed, 82 insertions(+), 93 deletions(-) delete mode 100644 MANIFEST.in delete mode 100644 setup.py diff --git a/MANIFEST.in b/MANIFEST.in deleted file mode 100644 index ee0a39f2..00000000 --- a/MANIFEST.in +++ /dev/null @@ -1,2 +0,0 @@ -include LICENSE -recursive-include tests *.py *.txt *.yml diff --git a/pyproject.toml b/pyproject.toml index afb57159..76b76210 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,8 +1,89 @@ +[build-system] +build-backend = "flit_core.buildapi" +requires = ["flit_core>=3,<4"] + +[project] +authors = [ + {name = "Delgan", email = "delgan.py@gmail.com"} +] +classifiers = [ + "Development Status :: 5 - Production/Stable", + "Topic :: System :: Logging", + "Intended Audience :: Developers", + "Natural Language :: English", + "License :: OSI Approved :: MIT License", + "Operating System :: OS Independent", + "Programming Language :: Python", + "Programming Language :: Python :: 3", + "Programming Language :: Python :: 3.5", + "Programming Language :: Python :: 3.6", + "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", + "Programming Language :: Python :: 3.12", + "Programming Language :: Python :: 3.13", + "Programming Language :: Python :: 3 :: Only", + "Programming Language :: Python :: Implementation :: PyPy", + "Programming Language :: Python :: Implementation :: CPython" +] +dependencies = [ + "colorama>=0.3.4 ; sys_platform=='win32'", + "aiocontextvars>=0.2.0 ; python_version<'3.7'", + "win32-setctime>=1.0.0 ; sys_platform=='win32'" +] +description = "Python logging made (stupidly) simple" +dynamic = ['version'] +keywords = ["loguru", "logging", "logger", "log"] +license = {text = "MIT"} +name = "loguru" +readme = 'README.rst' +requires-python = ">=3.5,<4.0" + +[project.optional-dependencies] +dev = [ + # Setup. + "pre-commit==3.7.0 ; python_version>='3.9'", + "tox==3.27.1 ; python_version<'3.8'", + "tox==4.15.0 ; python_version>='3.8'", + # Testing framework. + "pytest==6.1.2 ; python_version<'3.8'", + "pytest==8.2.1 ; python_version>='3.8'", + "pytest-cov==2.12.1 ; python_version<'3.8'", + "pytest-cov==5.0.0 ; python_version>='3.8'", + "pytest-mypy-plugins==1.9.3 ; python_version>='3.6' and python_version<'3.8'", + "pytest-mypy-plugins==3.1.0 ; python_version>='3.8'", + # Testing utils. + "colorama==0.4.5 ; python_version<'3.8'", + "colorama==0.4.6 ; python_version>='3.8'", + "freezegun==1.1.0 ; python_version<'3.8'", + "freezegun==1.5.0 ; python_version>='3.8'", + "exceptiongroup==1.1.3 ; python_version>='3.7' and python_version<'3.11'", + # Type checking. + "mypy==v0.910 ; python_version<'3.6'", + "mypy==v0.971 ; python_version>='3.6' and python_version<'3.7'", + "mypy==v1.4.1 ; python_version>='3.7' and python_version<'3.8'", + "mypy==v1.10.0 ; python_version>='3.8'", + # Docs. + "Sphinx==7.3.7 ; python_version>='3.9'", + "sphinx-autobuild==2024.4.16 ; python_version>='3.9'", + "sphinx-rtd-theme==2.0.0 ; python_version>='3.9'" +] + +[project.urls] +Changelog = "https://github.com/Delgan/loguru/blob/master/CHANGELOG.rst" +Documentation = "https://loguru.readthedocs.io/en/stable/index.html" +Homepage = "https://github.com/Delgan/loguru" + [tool.black] force-exclude = "tests/exceptions/source/modern/*" line-length = 100 target-version = ["py35"] +[tool.flit.module] +name = "loguru" + [tool.mypy] strict = true diff --git a/setup.py b/setup.py deleted file mode 100644 index de086831..00000000 --- a/setup.py +++ /dev/null @@ -1,91 +0,0 @@ -import re - -try: - from setuptools import setup -except ImportError: - from distutils.core import setup - -with open("loguru/__init__.py", "r") as file: - regex_version = r'^__version__\s*=\s*[\'"]([^\'"]*)[\'"]' - version = re.search(regex_version, file.read(), re.MULTILINE).group(1) - -with open("README.rst", "rb") as file: - readme = file.read().decode("utf-8") - -setup( - name="loguru", - version=version, - packages=["loguru"], - package_data={"loguru": ["__init__.pyi", "py.typed"]}, - description="Python logging made (stupidly) simple", - long_description=readme, - long_description_content_type="text/x-rst", - author="Delgan", - author_email="delgan.py@gmail.com", - url="https://github.com/Delgan/loguru", - download_url="https://github.com/Delgan/loguru/archive/{}.tar.gz".format(version), - project_urls={ - "Changelog": "https://github.com/Delgan/loguru/blob/master/CHANGELOG.rst", - "Documentation": "https://loguru.readthedocs.io/en/stable/index.html", - }, - keywords=["loguru", "logging", "logger", "log"], - license="MIT license", - classifiers=[ - "Development Status :: 5 - Production/Stable", - "Topic :: System :: Logging", - "Intended Audience :: Developers", - "Natural Language :: English", - "License :: OSI Approved :: MIT License", - "Operating System :: OS Independent", - "Programming Language :: Python", - "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.5", - "Programming Language :: Python :: 3.6", - "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", - "Programming Language :: Python :: 3.12", - "Programming Language :: Python :: 3.13", - "Programming Language :: Python :: 3 :: Only", - "Programming Language :: Python :: Implementation :: PyPy", - "Programming Language :: Python :: Implementation :: CPython", - ], - install_requires=[ - "colorama>=0.3.4 ; sys_platform=='win32'", - "aiocontextvars>=0.2.0 ; python_version<'3.7'", - "win32-setctime>=1.0.0 ; sys_platform=='win32'", - ], - extras_require={ - "dev": [ - # Setup. - "pre-commit==3.7.0 ; python_version>='3.9'", - "tox==3.27.1 ; python_version<'3.8'", - "tox==4.15.0 ; python_version>='3.8'", - # Testing framework. - "pytest==6.1.2 ; python_version<'3.8'", - "pytest==8.2.1 ; python_version>='3.8'", - "pytest-cov==2.12.1 ; python_version<'3.8'", - "pytest-cov==5.0.0 ; python_version>='3.8'", - "pytest-mypy-plugins==1.9.3 ; python_version>='3.6' and python_version<'3.8'", - "pytest-mypy-plugins==3.1.0 ; python_version>='3.8'", - # Testing utils. - "colorama==0.4.5 ; python_version<'3.8'", - "colorama==0.4.6 ; python_version>='3.8'", - "freezegun==1.1.0 ; python_version<'3.8'", - "freezegun==1.5.0 ; python_version>='3.8'", - "exceptiongroup==1.1.3 ; python_version>='3.7' and python_version<'3.11'", - # Type checking. - "mypy==v0.910 ; python_version<'3.6'", - "mypy==v0.971 ; python_version>='3.6' and python_version<'3.7'", - "mypy==v1.4.1 ; python_version>='3.7' and python_version<'3.8'", - "mypy==v1.10.0 ; python_version>='3.8'", - # Docs. - "Sphinx==7.3.7 ; python_version>='3.9'", - "sphinx-autobuild==2024.4.16 ; python_version>='3.9'", - "sphinx-rtd-theme==2.0.0 ; python_version>='3.9'", - ] - }, - python_requires=">=3.5", -) diff --git a/tox.ini b/tox.ini index 4caea782..5ebb350a 100644 --- a/tox.ini +++ b/tox.ini @@ -1,5 +1,6 @@ [tox] envlist = lint, tests, docs +isolated_build = True [testenv] setenv = PYTHONPATH = {toxinidir}