From 02e24090eaaa9845fde699c511405e5defad977f Mon Sep 17 00:00:00 2001 From: Sergei Maertens Date: Fri, 10 May 2024 08:41:10 +0200 Subject: [PATCH] :package: Move package configuration to pyproject.toml --- .github/workflows/release.yml | 6 +- pyproject.toml | 111 ++++++++++++++++++++++++++++++++++ setup.cfg | 110 --------------------------------- setup.py | 3 - tbump.toml | 2 +- tox.ini | 2 +- 6 files changed, 115 insertions(+), 119 deletions(-) create mode 100644 pyproject.toml delete mode 100644 setup.py diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 35ca831..addd630 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -27,8 +27,7 @@ jobs: - name: Install dependencies run: | - python -m pip install -U pip - python -m pip install -U setuptools twine wheel + python -m pip install build twine - uses: ./.github/actions/build-js with: @@ -37,8 +36,7 @@ jobs: - name: Build package run: | - python setup.py --version - python setup.py sdist --format=gztar bdist_wheel + python -m build twine check dist/* - name: Upload packages to Jazzband private PyPI diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..603cc06 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,111 @@ +[build-system] +requires = ["setuptools>=61.0.0"] +build-backend = "setuptools.build_meta" + +[project] +name = "django-cookie-consent" +version = "0.5.0b0" +description = "Django cookie consent application" +authors = [ + {name = "Informatika Mihelac", email = "bmihelac@mihelac.org"} +] +readme = "README.md" +license = {file = "LICENSE"} +keywords = ["cookies", "cookie-consent", "cookie bar"] +classifiers = [ + "Development Status :: 4 - Beta", + "Framework :: Django", + "Framework :: Django :: 4.2", + "Framework :: Django :: 5.0", + "Intended Audience :: Developers", + "License :: OSI Approved :: BSD License", + "Operating System :: Unix", + "Operating System :: MacOS", + "Operating System :: Microsoft :: Windows", + "Operating System :: OS Independent", + "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", + "Topic :: Software Development :: Libraries :: Python Modules", +] +requires-python = ">=3.8" +dependencies = [ + "django>=4.2", + "django-appconf", +] + +[project.urls] +Documentation = "https://django-cookie-consent.readthedocs.io/en/latest/" +Changelog = "https://github.com/jazzband/django-cookie-consent/blob/master/docs/changelog.rst" +"Bug Tracker" = "https://github.com/jazzband/django-cookie-consent/issues" +"Source Code" = "https://github.com/jazzband/django-cookie-consent" + +[project.optional-dependencies] +tests = [ + "pytest", + "pytest-django", + "pytest-playwright", + "tox", + "isort", + "black", + "flake8", +] +coverage = [ + "pytest-cov", +] +docs = [ + "sphinx", + "sphinx-rtd-theme", +] +release = [ + "tbump", +] + +[tool.setuptools.packages.find] +include = ["cookie_consent*"] +namespaces = true + +[tool.isort] +profile = "black" +combine_as_imports = true +skip = ["env", ".tox", ".history", ".eggs"] +known_django = "django" +known_first_party="cookie_consent" +sections=["FUTURE", "STDLIB", "DJANGO", "THIRDPARTY", "FIRSTPARTY", "LOCALFOLDER"] + +[tool.pytest.ini_options] +testpaths = ["tests"] +DJANGO_SETTINGS_MODULE = "testapp.settings" +markers = [ + "e2e: mark tests as end-to-end tests, using playwright (deselect with '-m \"not e2e\"')", +] + +[tool.bumpversion] +current_version = "0.1.0" +files = [ + {filename = "pyproject.toml"}, + {filename = "README.rst"}, + {filename = "docs/conf.py"}, +] + +[tool.coverage.run] +branch = true +source = ["cookie_consent"] +omit = [ + # migrations run while django initializes the test db + "*/migrations/*", +] + +[tool.coverage.report] +skip_covered = true +exclude_also = [ + "if (typing\\.)?TYPE_CHECKING:", + "@(typing\\.)?overload", + "class .*\\(.*Protocol.*\\):", + "@(abc\\.)?abstractmethod", + "raise NotImplementedError", + "\\.\\.\\.", + "pass", +] diff --git a/setup.cfg b/setup.cfg index 37c3a3b..dd2a903 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,114 +1,4 @@ -# setuptools config -# see http://setuptools.readthedocs.io/en/latest/setuptools.html#configuring-setup-using-setup-cfg-files -[metadata] -name = django-cookie-consent -version = 0.5.0b0 -description = Django cookie consent application -long_description = file: README.md -long_description_content_type = text/markdown -url = https://github.com/jazzband/django-cookie-consent -project_urls = - Documentation = https://django-cookie-consent.readthedocs.io/en/latest/ - Changelog = https://github.com/jazzband/django-cookie-consent/blob/master/docs/changelog.rst - Bug Tracker = https://github.com/jazzband/django-cookie-consent/issues - Source Code = https://github.com/jazzband/django-cookie-consent -license = BSD -author = Informatika Mihelac -author_email = bmihelac@mihelac.org -keywords = cookies, cookie-consent, cookie bar -classifiers = - Development Status :: 4 - Beta - Framework :: Django - Framework :: Django :: 4.2 - Framework :: Django :: 5.0 - Intended Audience :: Developers - License :: OSI Approved :: BSD License - Operating System :: Unix - Operating System :: MacOS - Operating System :: Microsoft :: Windows - Operating System :: OS Independent - 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 - Topic :: Software Development :: Libraries :: Python Modules - -[options] -zip_safe = False -include_package_data = True -packages = find: -install_requires = - django >= 4.2 - django-appconf -tests_require = - pytest - pytest-django - pytest-playwright - tox - isort - black - flake8 - -[options.packages.find] -include = - cookie_consent - cookie_consent.* - -[options.extras_require] -tests = - pytest - pytest-django - pytest-playwright - tox - isort - black - flake8 -pep8 = flake8 -coverage = pytest-cov -docs = - sphinx - sphinx-rtd-theme -release = - tbump - twine - -# 3rd party configuration - -[aliases] -test=pytest - -[isort] -combine_as_imports = true -default_section = THIRDPARTY -include_trailing_comma = true -line_length = 88 -multi_line_output = 3 -force_grid_wrap = 0 -use_parentheses = True -ensure_newline_before_comments = True -skip = env,.tox,.history,.eggs -known_django=django -known_first_party=cookie_consent -sections=FUTURE,STDLIB,DJANGO,THIRDPARTY,FIRSTPARTY,LOCALFOLDER - -[tool:pytest] -testpaths = tests -DJANGO_SETTINGS_MODULE=testapp.settings -markers = - e2e: mark tests as end-to-end tests, using playwright (deselect with '-m "not e2e"') - [pep8] [flake8] max-line-length=88 exclude=env,.tox,docs - -[coverage:run] -branch = True -source = cookie_consent -omit = - # migrations run while django initializes the test db - */migrations/* - -[coverage:report] -skip_covered = True diff --git a/setup.py b/setup.py deleted file mode 100644 index 6068493..0000000 --- a/setup.py +++ /dev/null @@ -1,3 +0,0 @@ -from setuptools import setup - -setup() diff --git a/tbump.toml b/tbump.toml index be8c900..7a4b8f6 100644 --- a/tbump.toml +++ b/tbump.toml @@ -14,7 +14,7 @@ message_template = ":bookmark: Bump to {new_version}" tag_template = "{new_version}" [[file]] -src = "setup.cfg" +src = "pyproject.toml" version_template = "{major}.{minor}.{patch}{pre}" [[file]] diff --git a/tox.ini b/tox.ini index 9a7cefc..fa2b234 100644 --- a/tox.ini +++ b/tox.ini @@ -59,7 +59,7 @@ commands = isort --check-only --diff . [testenv:black] extras = tests skipsdist = True -commands = black --check cookie_consent docs tests testapp setup.py +commands = black --check cookie_consent docs tests testapp [testenv:flake8] extras = tests