From 3612b9bf426dfa54967e0ac01b93064e588a79c6 Mon Sep 17 00:00:00 2001 From: Christian Clauss Date: Sat, 1 Oct 2022 21:19:55 +0200 Subject: [PATCH 1/7] Migrate metadata from setup.py to setup.cfg --- setup.cfg | 44 ++++++++++++++++++++++++++++++++++++++++++++ setup.py | 41 ----------------------------------------- 2 files changed, 44 insertions(+), 41 deletions(-) delete mode 100644 setup.py diff --git a/setup.cfg b/setup.cfg index 61d986f3..20ee28d7 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,3 +1,46 @@ +[metadata] +name = django-waffle +version = 3.0.0 +author = James Socol +author_email = me@jamessocol.com +license = BSD +description = A feature flipper for Django. +url = http://github.com/django-waffle/django-waffle +long_description = file: README.rst +classifiers = + Development Status :: 5 - Production/Stable + Environment :: Web Environment + Framework :: Django + Intended Audience :: Developers + License :: OSI Approved :: BSD License + Operating System :: OS Independent + Framework :: Django + Framework :: Django :: 3.2 + Framework :: Django :: 4.0 + Framework :: Django :: 4.1 + Programming Language :: Python + Programming Language :: Python :: 3 + Programming Language :: Python :: 3 :: Only + Programming Language :: Python :: 3.7 + Programming Language :: Python :: 3.8 + Programming Language :: Python :: 3.9 + Programming Language :: Python :: 3.10 + Topic :: Software Development :: Libraries :: Python Modules + +[options] +packages = find: +zip_safe = False +install_requires = django>=3.2 +include_package_data = True +python_requires = >=3.7 + +[options.packages.find] +exclude = test_app; test_settings + +[options.package_data] + = README.rst +waffle = py.typed + [flake8] # Use a line length of 120 instead of pep8's default 79 max-line-length = 120 @@ -14,5 +57,6 @@ disallow_incomplete_defs = True disallow_untyped_calls = True disallow_untyped_decorators = True strict_equality = True + [mypy-django.*] ignore_missing_imports = True diff --git a/setup.py b/setup.py deleted file mode 100644 index 2925eae8..00000000 --- a/setup.py +++ /dev/null @@ -1,41 +0,0 @@ -from setuptools import setup, find_packages - -setup( - name='django-waffle', - version='3.0.0', - description='A feature flipper for Django.', - long_description=open('README.rst').read(), - author='James Socol', - author_email='me@jamessocol.com', - url='http://github.com/django-waffle/django-waffle', - license='BSD', - packages=find_packages(exclude=['test_app', 'test_settings']), - include_package_data=True, - package_data={ - '': ['README.rst'], - 'waffle': ['py.typed'], - }, - zip_safe=False, - python_requires='>=3.7', - install_requires=['django>=3.2'], - classifiers=[ - 'Development Status :: 5 - Production/Stable', - 'Environment :: Web Environment', - 'Framework :: Django', - 'Intended Audience :: Developers', - 'License :: OSI Approved :: BSD License', - 'Operating System :: OS Independent', - 'Framework :: Django', - 'Framework :: Django :: 3.2', - 'Framework :: Django :: 4.0', - 'Framework :: Django :: 4.1', - 'Programming Language :: Python', - 'Programming Language :: Python :: 3', - 'Programming Language :: Python :: 3 :: Only', - 'Programming Language :: Python :: 3.7', - 'Programming Language :: Python :: 3.8', - 'Programming Language :: Python :: 3.9', - 'Programming Language :: Python :: 3.10', - 'Topic :: Software Development :: Libraries :: Python Modules', - ], -) From 9d6c171eecef23b6fd1d193f64cff5e7ff8b5116 Mon Sep 17 00:00:00 2001 From: Christian Clauss Date: Sat, 1 Oct 2022 21:22:14 +0200 Subject: [PATCH 2/7] Migrate metadata from setup.py to setup.cfg --- setup.cfg | 1 - 1 file changed, 1 deletion(-) diff --git a/setup.cfg b/setup.cfg index 20ee28d7..8d813455 100644 --- a/setup.cfg +++ b/setup.cfg @@ -38,7 +38,6 @@ python_requires = >=3.7 exclude = test_app; test_settings [options.package_data] - = README.rst waffle = py.typed [flake8] From fcb93a3d4fc28c94c52ae07a455b0a58de603636 Mon Sep 17 00:00:00 2001 From: Christian Clauss Date: Sat, 1 Oct 2022 21:31:49 +0200 Subject: [PATCH 3/7] Switch to pyproject.toml --- .flake8 | 8 +++++++ pyproject.toml | 59 ++++++++++++++++++++++++++++++++++++++++++++++++ setup.cfg | 61 -------------------------------------------------- 3 files changed, 67 insertions(+), 61 deletions(-) create mode 100644 .flake8 create mode 100644 pyproject.toml delete mode 100644 setup.cfg diff --git a/.flake8 b/.flake8 new file mode 100644 index 00000000..5840e7ac --- /dev/null +++ b/.flake8 @@ -0,0 +1,8 @@ +[flake8] +# Use a line length of 120 instead of pep8's default 79 +max-line-length = 120 +# Files not checked: +# - migrations: most of these are autogenerated and don't need a check +# - docs: contains autogenerated code that doesn't need a check +exclude = */migrations/*,docs +ignore = E731 diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 00000000..11a4fc83 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,59 @@ +[build-system] +requires = ["setuptools>=61.2"] +build-backend = "setuptools.build_meta" + +[project] +name = "django-waffle" +version = "3.0.0" +authors = [{name = "James Socol", email = "me@jamessocol.com"}] +license = {text = "BSD"} +description = "A feature flipper for Django." +readme = "README.rst" +classifiers = [ + "Development Status :: 5 - Production/Stable", + "Environment :: Web Environment", + "Framework :: Django", + "Intended Audience :: Developers", + "License :: OSI Approved :: BSD License", + "Operating System :: OS Independent", + "Framework :: Django", + "Framework :: Django :: 3.2", + "Framework :: Django :: 4.0", + "Framework :: Django :: 4.1", + "Programming Language :: Python", + "Programming Language :: Python :: 3", + "Programming Language :: Python :: 3 :: Only", + "Programming Language :: Python :: 3.7", + "Programming Language :: Python :: 3.8", + "Programming Language :: Python :: 3.9", + "Programming Language :: Python :: 3.10", + "Topic :: Software Development :: Libraries :: Python Modules", +] +requires-python = ">=3.7" +dependencies = ["django>=3.2"] + +[project.urls] +Homepage = "http://github.com/django-waffle/django-waffle" + +[tool.setuptools] +zip-safe = false +include-package-data = true + +[tool.setuptools.packages.find] +exclude = ["test_app"] # test_settings +namespaces = false + +[tool.setuptools.package-data] +waffle = ["py.typed"] + +[tool.mypy] +python_version = "3.7" +exclude = "waffle/tests" +disallow_incomplete_defs = true +disallow_untyped_calls = true +disallow_untyped_decorators = true +strict_equality = true + +[[tool.mypy.overrides]] +module = ["django.*"] +ignore_missing_imports = true diff --git a/setup.cfg b/setup.cfg deleted file mode 100644 index 8d813455..00000000 --- a/setup.cfg +++ /dev/null @@ -1,61 +0,0 @@ -[metadata] -name = django-waffle -version = 3.0.0 -author = James Socol -author_email = me@jamessocol.com -license = BSD -description = A feature flipper for Django. -url = http://github.com/django-waffle/django-waffle -long_description = file: README.rst -classifiers = - Development Status :: 5 - Production/Stable - Environment :: Web Environment - Framework :: Django - Intended Audience :: Developers - License :: OSI Approved :: BSD License - Operating System :: OS Independent - Framework :: Django - Framework :: Django :: 3.2 - Framework :: Django :: 4.0 - Framework :: Django :: 4.1 - Programming Language :: Python - Programming Language :: Python :: 3 - Programming Language :: Python :: 3 :: Only - Programming Language :: Python :: 3.7 - Programming Language :: Python :: 3.8 - Programming Language :: Python :: 3.9 - Programming Language :: Python :: 3.10 - Topic :: Software Development :: Libraries :: Python Modules - -[options] -packages = find: -zip_safe = False -install_requires = django>=3.2 -include_package_data = True -python_requires = >=3.7 - -[options.packages.find] -exclude = test_app; test_settings - -[options.package_data] -waffle = py.typed - -[flake8] -# Use a line length of 120 instead of pep8's default 79 -max-line-length = 120 -# Files not checked: -# - migrations: most of these are autogenerated and don't need a check -# - docs: contains autogenerated code that doesn't need a check -exclude = */migrations/*,docs -ignore = E731 - -[mypy] -python_version = 3.7 -exclude = waffle/tests -disallow_incomplete_defs = True -disallow_untyped_calls = True -disallow_untyped_decorators = True -strict_equality = True - -[mypy-django.*] -ignore_missing_imports = True From d9512b42cff618929ed075a33b84a9661fd136f4 Mon Sep 17 00:00:00 2001 From: Christian Clauss Date: Sat, 1 Oct 2022 21:36:24 +0200 Subject: [PATCH 4/7] [tox] isolated_build = True --- tox.ini | 1 + 1 file changed, 1 insertion(+) diff --git a/tox.ini b/tox.ini index 1312dfb3..f33e22b1 100644 --- a/tox.ini +++ b/tox.ini @@ -2,6 +2,7 @@ envlist = py{37,38,39,310}-django{32} py{38,39,310}-django{40,41} +isolated_build = True [gh-actions] python = From 00525ed9aa433997f50325fd7b250bcda38e70fc Mon Sep 17 00:00:00 2001 From: Christian Clauss Date: Sat, 1 Oct 2022 22:22:00 +0200 Subject: [PATCH 5/7] [tool.setuptools.dynamic] version = {attr = "waffle.__version__"} --- RELEASING.rst | 7 +++---- pyproject.toml | 4 +++- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/RELEASING.rst b/RELEASING.rst index 31ed7412..50044ba4 100644 --- a/RELEASING.rst +++ b/RELEASING.rst @@ -5,14 +5,13 @@ These are the steps necessary to release a new version of Django Waffle. 1. Update the version number in the following files: - a. `setup.py` - b. `docs/conf.py` - c. `waffle/__init__.py` + a. `docs/conf.py` + b. `waffle/__init__.py` 2. Update the changelog in `CHANGES`. 3. Merge these changes to the `master` branch. -4. Create a new release on GitHub. This will also create a Git tag, and trigger a push to PyPI. +4. Create a new release on GitHub. This will also create a git tag, and trigger a push to PyPI. 5. Ensure the documentation build passes: https://readthedocs.org/projects/waffle/ diff --git a/pyproject.toml b/pyproject.toml index 11a4fc83..d4591c0e 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,6 @@ build-backend = "setuptools.build_meta" [project] name = "django-waffle" -version = "3.0.0" authors = [{name = "James Socol", email = "me@jamessocol.com"}] license = {text = "BSD"} description = "A feature flipper for Django." @@ -39,6 +38,9 @@ Homepage = "http://github.com/django-waffle/django-waffle" zip-safe = false include-package-data = true +[tool.setuptools.dynamic] +version = {attr = "waffle.__version__"} + [tool.setuptools.packages.find] exclude = ["test_app"] # test_settings namespaces = false From e58a210703686ef83fc77d7fbd59625fee19e15d Mon Sep 17 00:00:00 2001 From: Christian Clauss Date: Sat, 1 Oct 2022 22:26:38 +0200 Subject: [PATCH 6/7] [project] dynamic = ["version"] --- pyproject.toml | 1 + 1 file changed, 1 insertion(+) diff --git a/pyproject.toml b/pyproject.toml index d4591c0e..6738b880 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,6 +4,7 @@ build-backend = "setuptools.build_meta" [project] name = "django-waffle" +dynamic = ["version"] authors = [{name = "James Socol", email = "me@jamessocol.com"}] license = {text = "BSD"} description = "A feature flipper for Django." From ca707d0c601b1070c4e820603fb49b8885a46513 Mon Sep 17 00:00:00 2001 From: Christian Clauss Date: Sat, 1 Oct 2022 22:39:49 +0200 Subject: [PATCH 7/7] [tool.setuptools.dynamic] version = {attr = "waffle.__version__"} --- waffle/__init__.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/waffle/__init__.py b/waffle/__init__.py index 8d48519e..df3745d9 100755 --- a/waffle/__init__.py +++ b/waffle/__init__.py @@ -12,8 +12,7 @@ if TYPE_CHECKING: from waffle.models import AbstractBaseFlag, AbstractBaseSample, AbstractBaseSwitch -VERSION = (3, 0, 0) -__version__ = '.'.join(map(str, VERSION)) +__version__ = '3.0.0' def flag_is_active(request: HttpRequest, flag_name: str, read_only: bool = False) -> bool | None: