From 3af5f872a1dd33ac56b9621f3f35339471ecde50 Mon Sep 17 00:00:00 2001 From: Pravin Kamble Date: Mon, 22 Dec 2025 19:04:44 +0530 Subject: [PATCH 1/4] Removed dependency of `setup.cfg` from project --- pyproject.toml | 74 ++++++++++++++++++++++++++++++++++++++++++++++++++ setup.cfg | 66 -------------------------------------------- 2 files changed, 74 insertions(+), 66 deletions(-) delete mode 100644 setup.cfg diff --git a/pyproject.toml b/pyproject.toml index fed528d4a..0b46e51bc 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,3 +1,77 @@ [build-system] requires = ["setuptools"] build-backend = "setuptools.build_meta" + +[project] +name = "channels" +description = "Brings async, event-driven capabilities to Django." +readme = "README.rst" +license = "BSD-3-Clause" +license-files = [ "LICENSE" ] +authors = [ { name = "Django Software Foundation", email = "foundation@djangoproject.com" } ] +requires-python = ">=3.10" +classifiers = [ + "Development Status :: 5 - Production/Stable", + "Environment :: Web Environment", + "Intended Audience :: Developers", + "Operating System :: OS Independent", + "Programming Language :: Python", + "Programming Language :: Python :: 3", + "Programming Language :: Python :: 3.10", + "Programming Language :: Python :: 3.11", + "Programming Language :: Python :: 3.12", + "Programming Language :: Python :: 3.13", + "Programming Language :: Python :: 3.14", + "Framework :: Django", + "Framework :: Django :: 5.2", + "Framework :: Django :: 6.0", + "Topic :: Internet :: WWW/HTTP", +] +dynamic = [ "version" ] + +dependencies = [ + "Django>=5.2", + "asgiref>=3.9.0,<4", +] + +[project.optional-dependencies] +tests = [ + "async-timeout", + "coverage~=4.5", + "pytest", + "pytest-django", + "pytest-asyncio", + "selenium", +] +daphne = [ + "daphne>=4.0.0", +] +types = [ + "types-channels", +] + +[project.urls] +Documentation = "https://channels.readthedocs.io/" +Source = "http://github.com/django/channels" + +[tool.setuptools] + +[tool.setuptools.dynamic] +version = { attr = "channels.__version__" } + +[tool.setuptools.packages.find] +include = [ "channels*" ] + +[tool.flake8] +exclude = ["venv/*", "tox/*", "docs/*", "testproject/*", "build/*"] +max-line-length = 88 +extend-ignore = ["E203", "W503"] +[tool.flake8.per-file-ignores] +"tests/sample_project/config/asgi.py" = ["E402"] + +[tool.isort] +profile = "black" + +[tool.pytest.ini_options] +testpaths = ["tests"] +asyncio_mode = "auto" diff --git a/setup.cfg b/setup.cfg deleted file mode 100644 index 0dfcf097f..000000000 --- a/setup.cfg +++ /dev/null @@ -1,66 +0,0 @@ -[metadata] -name = channels -version = attr: channels.__version__ -url = http://github.com/django/channels -author = Django Software Foundation -author_email = foundation@djangoproject.com -description = Brings async, event-driven capabilities to Django. -long_description = file: README.rst -long_description_content_type = text/x-rst -license = BSD -classifiers = - Development Status :: 5 - Production/Stable - Environment :: Web Environment - Intended Audience :: Developers - License :: OSI Approved :: BSD License - Operating System :: OS Independent - Programming Language :: Python - Programming Language :: Python :: 3 - Programming Language :: Python :: 3.10 - Programming Language :: Python :: 3.11 - Programming Language :: Python :: 3.12 - Programming Language :: Python :: 3.13 - Programming Language :: Python :: 3.14 - Framework :: Django - Framework :: Django :: 5.2 - Framework :: Django :: 6.0 - Topic :: Internet :: WWW/HTTP - -[options] -packages = find: -include_package_data = True -install_requires = - Django>=5.2 - asgiref>=3.9.0,<4 -python_requires = >=3.9 - -[options.extras_require] -tests = - async-timeout - coverage~=4.5 - pytest - pytest-django - pytest-asyncio - selenium -daphne = - daphne>=4.0.0 -types = - types-channels - -[options.packages.find] -exclude = - tests - -[flake8] -exclude = venv/*,tox/*,docs/*,testproject/*,build/* -max-line-length = 88 -extend-ignore = E203, W503 -per-file-ignores = - tests/sample_project/config/asgi.py:E402 - -[isort] -profile = black - -[tool:pytest] -testpaths = tests -asyncio_mode = auto From 9b202b59f1e3c7e43340fd808d840d3a7d71a578 Mon Sep 17 00:00:00 2001 From: Pravin Kamble Date: Wed, 22 Apr 2026 16:03:55 +0530 Subject: [PATCH 2/4] Loading flak8 configuration in tox.ini --- pyproject.toml | 7 +++---- tox.ini | 1 + 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 0b46e51bc..4a73d5eda 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -63,11 +63,10 @@ version = { attr = "channels.__version__" } include = [ "channels*" ] [tool.flake8] -exclude = ["venv/*", "tox/*", "docs/*", "testproject/*", "build/*"] +exclude = "venv/*,tox/*,docs/*,testproject/*,build/*" max-line-length = 88 -extend-ignore = ["E203", "W503"] -[tool.flake8.per-file-ignores] -"tests/sample_project/config/asgi.py" = ["E402"] +extend-ignore = "E203,W503" +per-file-ignores = "tests/sample_project/config/asgi.py:E402" [tool.isort] profile = "black" diff --git a/tox.ini b/tox.ini index b11ca9834..27c47937f 100644 --- a/tox.ini +++ b/tox.ini @@ -19,6 +19,7 @@ skip_install=true deps = black flake8 + flake8-pyproject isort commands = flake8 channels tests From 54489b3ca61e5e43797399ef544daa2da936a1d9 Mon Sep 17 00:00:00 2001 From: Pravin Kamble Date: Wed, 22 Apr 2026 16:58:56 +0530 Subject: [PATCH 3/4] migrate to PEP 735 dependency-groups --- pyproject.toml | 2 +- tox.ini | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 4a73d5eda..3950c6395 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -34,7 +34,7 @@ dependencies = [ "asgiref>=3.9.0,<4", ] -[project.optional-dependencies] +[dependency-groups] tests = [ "async-timeout", "coverage~=4.5", diff --git a/tox.ini b/tox.ini index 27c47937f..8fe69dc18 100644 --- a/tox.ini +++ b/tox.ini @@ -1,4 +1,6 @@ [tox] +requires = + tox>=4.22 envlist = py{310,311,312,313,314}-dj52 py{312,313,314}-dj60 @@ -6,7 +8,9 @@ envlist = qa [testenv] -extras = tests, daphne +dependency_groups = + tests + daphne commands = pytest -v {posargs} deps = From 3258386e335d260ed2ebe1fcff9c86ac2d5a8cef Mon Sep 17 00:00:00 2001 From: Pravin Kamble Date: Thu, 23 Apr 2026 11:06:05 +0530 Subject: [PATCH 4/4] keep tests under [dependency-groups] and update tox and docs accordingly. --- CONTRIBUTING.rst | 10 ++-------- docs/contributing.rst | 6 +++--- pyproject.toml | 15 +++++++++------ tox.ini | 2 +- 4 files changed, 15 insertions(+), 18 deletions(-) diff --git a/CONTRIBUTING.rst b/CONTRIBUTING.rst index fc35f8840..46548b9f3 100644 --- a/CONTRIBUTING.rst +++ b/CONTRIBUTING.rst @@ -25,16 +25,10 @@ Make sure the tests pass: .. code-block:: sh - python -m pip install -e .[tests,daphne] + python -m pip install -e . --group tests + python -m pip install -e ".[daphne]" pytest -.. note:: - If you're using ``zsh`` for your shell, the above command will fail with a - ``zsh: no matches found: .[tests]`` error. - To fix this use ``noglob``:: - - noglob python -m pip install -e .[tests] - Make your change. Add tests for your change. Make the tests pass: .. code-block:: sh diff --git a/docs/contributing.rst b/docs/contributing.rst index 5f61bc4b4..a62adac82 100644 --- a/docs/contributing.rst +++ b/docs/contributing.rst @@ -74,10 +74,10 @@ your environment: .. code-block:: sh cd channels/ - python -m pip install -e .[tests] + python -m pip install -e . --group tests -Note the ``[tests]`` section there; that tells ``pip`` that you want to install -the ``tests`` extra, which will bring in testing dependencies like +Note the ``--group tests`` section there; that tells ``pip`` that you want to install +the ``tests`` dependency group from ``pyproject.toml``, which will bring in testing dependencies like ``pytest-django``. Then, you can run the tests: diff --git a/pyproject.toml b/pyproject.toml index 3950c6395..83a1ef812 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -34,6 +34,15 @@ dependencies = [ "asgiref>=3.9.0,<4", ] + +[project.optional-dependencies] +daphne = [ + "daphne>=4.0.0", +] +types = [ + "types-channels", +] + [dependency-groups] tests = [ "async-timeout", @@ -43,12 +52,6 @@ tests = [ "pytest-asyncio", "selenium", ] -daphne = [ - "daphne>=4.0.0", -] -types = [ - "types-channels", -] [project.urls] Documentation = "https://channels.readthedocs.io/" diff --git a/tox.ini b/tox.ini index 8fe69dc18..f3c072fa0 100644 --- a/tox.ini +++ b/tox.ini @@ -8,9 +8,9 @@ envlist = qa [testenv] +extras = daphne dependency_groups = tests - daphne commands = pytest -v {posargs} deps =