From 0475c17f0f7fc14733cd44fefd100036be3c4617 Mon Sep 17 00:00:00 2001 From: Francky Date: Thu, 21 Aug 2025 15:41:57 +0200 Subject: [PATCH] feat: replace setup.py with pyproject.toml --- .flake8 | 10 +++++++ pyproject.toml | 72 +++++++++++++++++++++++++++++++++++++++++++++++- requirements.txt | 10 +++---- setup.py | 56 ------------------------------------- 4 files changed, 85 insertions(+), 63 deletions(-) create mode 100644 .flake8 delete mode 100644 setup.py diff --git a/.flake8 b/.flake8 new file mode 100644 index 0000000..c98b73b --- /dev/null +++ b/.flake8 @@ -0,0 +1,10 @@ +[flake8] +max-line-length = 120 +# Enable flake8-mutable +enable-extensions = M511 +# W503 line break before binary operator. Black causes this error +# E203 whitespace before ':' +# E231 missing whitespace after ','. Black causes this error but seems to be right (see pep8) +# E501 line too long +ignore = W503, E203, E231, E501 +jobs = 4 diff --git a/pyproject.toml b/pyproject.toml index 17de5f2..63854ee 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,76 @@ +[project] +name = "chartreuse" +description="Helper for Alembic migrations within Kubernetes." +dynamic = ["version"] +authors = [{ name = "wiremind", email = "dev@wiremind.io" }] +license="LGPL-3.0-or-later" +urls = { github = "https://github.com/wiremind/chartreuse"} +scripts = {chartreuse-upgrade = "chartreuse.chartreuse_upgrade:main"} +requires-python = ">=3.11.0" + +dependencies = [ + "alembic", + "psycopg2", + "wiremind-kubernetes~=7.0", +] + +[build-system] +requires = ["setuptools>=71.1"] +build-backend = "setuptools.build_meta" + +[tool.setuptools] +include-package-data = true +zip-safe = true +[tool.setuptools.dynamic] +version = { file = "VERSION" } +[tool.setuptools.packages.find] +where = ["src"] +exclude = ["*.tests", "*.tests.*", "tests.*", "tests"] + +[project.optional-dependencies] +test = [ + "mock", + "pytest", + "pytest-mock", +] +mypy = [ + "mypy", +] +dev = [ + "black", + "flake8", + "flake8-mutable", + "pip-tools", + + "mock", + "pytest", + "pytest-mock", + + "mypy" +] + [tool.black] line-length = 120 -target-version = ['py37'] +target-version = ['py311'] [tool.isort] line_length = 120 + +[tool.mypy] +python_version = "3.11" +ignore_missing_imports = true +check_untyped_defs = true +disallow_untyped_defs = true +disallow_incomplete_defs = true +warn_redundant_casts = true +warn_unused_ignores = true +warn_unused_configs = true +no_implicit_optional = true +show_error_codes = true +files = [ "src", "example/alembic"] + +[tool.pytest.ini_options] +log_level = "INFO" +# Deterministic ordering for tests; useful for pytest-xdist. +env = ["PYTHONHASHSEED=0"] +filterwarnings = ["ignore::pytest.PytestUnknownMarkWarning"] diff --git a/requirements.txt b/requirements.txt index 71c26cb..9066c80 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,9 +1,5 @@ -# -# This file is autogenerated by pip-compile with Python 3.11 -# by the following command: -# -# pip-compile --no-emit-index-url --output-file=requirements.txt pyproject.toml -# +# This file was autogenerated by uv via the following command: +# uv pip compile --no-emit-index-url --output-file=requirements.txt pyproject.toml alembic==1.13.2 # via chartreuse (pyproject.toml) cachetools==5.4.0 @@ -16,6 +12,8 @@ charset-normalizer==3.3.2 # via requests google-auth==2.32.0 # via kubernetes +greenlet==3.2.4 + # via sqlalchemy idna==3.7 # via requests kubernetes==30.1.0 diff --git a/setup.py b/setup.py deleted file mode 100644 index d5fcc09..0000000 --- a/setup.py +++ /dev/null @@ -1,56 +0,0 @@ -""" -Chartreuse -""" -from setuptools import find_packages, setup - -with open("VERSION") as version_file: - version = version_file.read().strip() - - -extra_require_test = [ - "mock", - "pytest", - "pytest-mock", -] -extra_require_mypy = [ - "mypy", -] -extra_require_dev = ( - [ - "black", - "flake8", - "flake8-mutable", - "pip-tools", - ] - + extra_require_mypy - + extra_require_test -) - - -setup( - name="chartreuse", - version=version, - description="Helper for Alembic migrations within Kubernetes.", - long_description="Helper for Alembic migrations within Kubernetes.", - platforms=["posix"], - author="wiremind", - author_email="dev@wiremind.io", - url="https://github.com/wiremind/chartreuse", - license="LGPLv3+", - packages=find_packages("src", exclude=["*.tests", "*.tests.*", "tests.*", "tests"]), - package_dir={"": "src"}, - include_package_data=True, - zip_safe=True, - python_requires=">=3.11.0", - install_requires=[ - "alembic", - "psycopg2", - "wiremind-kubernetes~=7.0", - ], - extras_require={ - "dev": extra_require_dev, - "mypy": extra_require_mypy, - "test": extra_require_test, - }, - entry_points={"console_scripts": ["chartreuse-upgrade=chartreuse.chartreuse_upgrade:main"]}, -)