From 138ec568eed40f7ebacaf60ef80528cc4002b4b4 Mon Sep 17 00:00:00 2001 From: Will Barton Date: Wed, 11 Jan 2023 10:37:20 -0500 Subject: [PATCH] Switch to pyproject.toml MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit With [PEP 621 support added to setuptools](pypa/setuptools#2970) last year, and with pip supporting editable installs as of 21.3, we can move to `pyproject.toml` and deprecate `setup.py`. The file remains for legacy pip support. Because [flake8 does not want to support pyproject.tml yet](PyCQA/flake8#234), unlike all the other tools we use, I’m removing it in favor of [ruff](https://github.com/charliermarsh/ruff). --- .pre-commit-config.yaml | 7 ++-- pyproject.toml | 92 +++++++++++++++++++++++++++++++++++++---- setup.cfg | 76 ---------------------------------- tox.ini | 18 ++++---- 4 files changed, 96 insertions(+), 97 deletions(-) delete mode 100644 setup.cfg diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index b7efd01..d00e5b8 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -5,11 +5,10 @@ repos: - id: black args: ["wagtailflags", "setup.py", "--line-length=79"] exclude: migrations -- repo: https://gitlab.com/pycqa/flake8 - rev: 4.0.1 +- repo: https://github.com/charliermarsh/ruff-pre-commit + rev: v0.0.188 hooks: - - id: flake8 - additional_dependencies: [flake8-bugbear==22.1.11] + - id: ruff - repo: https://github.com/pycqa/isort rev: 5.10.1 hooks: diff --git a/pyproject.toml b/pyproject.toml index d237113..4cb64f2 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,54 @@ +[project] +name = "wagtail-flags" +version = "5.3.0" +description = "Feature flags for Wagtail sites" +readme = "README.md" +requires-python = ">=3.8" +license = {text = "CC0"} +authors = [ + {name = "CFPB", email = "tech@cfpb.gov" } +] +dependencies = [ + "wagtail>2.15,<4", + "django-flags>4.2,<5.1" +] +classifiers = [ + "Framework :: Django", + "Framework :: Django :: 3.2", + "Framework :: Django :: 4", + "Framework :: Wagtail", + "Framework :: Wagtail :: 3", + "License :: CC0 1.0 Universal (CC0 1.0) Public Domain Dedication", + "License :: Public Domain", + "Programming Language :: Python", + "Programming Language :: Python :: 3", +] + +[project.optional-dependencies] +testing = [ + "coverage[toml]", +] + +[project.urls] +"Homepage" = "https://github.com/cfpb/wagtail-flags" +"Bug Reports" = "https://github.com/cfpb/wagtail-flags/issues" +"Source" = "https://github.com/cfpb/wagtail-flags" + +[build-system] +requires = ["setuptools>=43.0.0", "wheel"] +build-backend = "setuptools.build_meta" + +[tool.setuptools.package-data] +treemodeladmin = [ + "templates/wagtailflags/*", + "templates/wagtailflags/flags/*", + "templates/wagtailflags/includes/*", + "static/wagtailflags/css/*", +] + [tool.black] line-length = 79 -target-version = ['py36', 'py38'] +target-version = ["py38"] include = '\.pyi?$' exclude = ''' ( @@ -14,15 +62,43 @@ exclude = ''' | dist | migrations | site - | \*.json - | \*.csv )/ ) ''' -[build-system] -requires = [ - "setuptools>=42", - "wheel" +[tool.isort] +profile = "black" +line_length = 79 +lines_after_imports = 2 +skip = [".tox", "migrations", ".venv", "venv"] +known_django = ["django"] +known_wagtail = ["wagtail"] +default_section = "THIRDPARTY" +sections = [ + "STDLIB", + "DJANGO", + "WAGTAIL", + "THIRDPARTY", + "FIRSTPARTY", + "LOCALFOLDER" +] + +[tool.ruff] +exclude = [ + ".git", + ".tox", + "__pycache__", + "*/migrations/*.py", + "*/tests/treemodeladmintest/migrations/*", +] +ignore = [] +select = [ + "E", + "F", + "W", +] + +[tool.coverage.run] +omit = [ + "treemodeladmin/tests/*", ] -build-backend = "setuptools.build_meta" diff --git a/setup.cfg b/setup.cfg deleted file mode 100644 index b2edf83..0000000 --- a/setup.cfg +++ /dev/null @@ -1,76 +0,0 @@ -[metadata] -name = wagtail-flags -version = 5.2.0 -author = CFPB -author_email = tech@cfpb.gov -description = Feature flags for Wagtail sites -long_description = file: README.md -long_description_content_type = text/markdown -license = CC0 -url = https://github.com/cfpb/wagtail-flags -classifiers = - Operating System :: OS Independent - Framework :: Django - Framework :: Django :: 3.2 - Framework :: Django :: 4.0 - Framework :: Wagtail - Framework :: Wagtail :: 2 - Framework :: Wagtail :: 3 - License :: CC0 1.0 Universal (CC0 1.0) Public Domain Dedication - License :: Public Domain - Programming Language :: Python - Programming Language :: Python :: 3 - -[options] -include_package_data = True -packages = find: -python_requires = >=3.8 -zip_safe = False -install_requires = - wagtail>=2.15,<4 - django-flags>=4.2,<5.1 - -[options.extras_require] -testing = - coverage - -[flake8] -ignore = E731,W503,W504 -exclude = - .git, - .tox, - __pycache__, - */migrations/*.py, - .eggs/*, - -[isort] -profile = black -combine_as_imports = 1 -lines_after_imports = 2 -include_trailing_comma = 1 -multi_line_output = 3 -skip = .tox,migrations -known_django = django -known_wagtail = wagtail -default_section = THIRDPARTY -sections = FUTURE,STDLIB,DJANGO,WAGTAIL,THIRDPARTY,FIRSTPARTY,LOCALFOLDER - -[mypy] -allow_redefinition = false -check_untyped_defs = true -disallow_untyped_decorators = true -disallow_any_explicit = true -disallow_any_generics = true -disallow_untyped_calls = true -ignore_errors = false -ignore_missing_imports = true -implicit_reexport = false -local_partial_types = true -strict_optional = true -strict_equality = true -no_implicit_optional = true -warn_unused_ignores = true -warn_redundant_casts = true -warn_unused_configs = true -warn_unreachable = true -warn_no_return = true diff --git a/tox.ini b/tox.ini index 0bc1cb8..8e0cf0f 100644 --- a/tox.ini +++ b/tox.ini @@ -2,8 +2,8 @@ skipsdist=True envlist= lint, - py{39,310}-dj{32}-wag{215}, - py{39,310}-dj{32,40}-wag{30,latest}, + py{38,311}-dj{32}-wag{215}, + py{38,311}-dj{32,40}-wag{30,latest}, coverage [testenv] @@ -14,29 +14,29 @@ setenv= DJANGO_SETTINGS_MODULE=wagtailflags.tests.settings basepython= - py39: python3.9 - py310: python3.10 + py38: python3.8 + py311: python3.11 deps= dj32: Django>=3.2,<3.3 dj40: Django>=4.0,<4.1 - wag215: wagtail>=2.15,<2.16 + wag215: wagtail>=2.15,<4 wag30: wagtail>=3.0,<3.1 waglatest: wagtail<4 [testenv:lint] -basepython=python3.10 +basepython=python3.8 deps= black - flake8 + ruff isort commands= black --check wagtailflags - flake8 wagtailflags + ruff wagtailflags isort --check-only --diff wagtailflags [testenv:coverage] -basepython=python3.10 +basepython=python3.8 deps= coverage diff_cover