Compare commits

..

No commits in common. "main" and "4.1.2" have entirely different histories.
main ... 4.1.2

14 changed files with 74 additions and 131 deletions

11
.flake8
View File

@ -1,11 +0,0 @@
[flake8]
exclude =
.venv,
.tox,
docs,
testproject,
js_client,
.eggs
extend-ignore = E123, E128, E266, E402, W503, E731, W601, B036
max-line-length = 120

View File

@ -5,10 +5,6 @@ on:
branches: branches:
- main - main
pull_request: pull_request:
workflow_dispatch:
permissions:
contents: read
jobs: jobs:
tests: tests:
@ -20,11 +16,11 @@ jobs:
- ubuntu - ubuntu
- windows - windows
python-version: python-version:
- "3.8"
- "3.9" - "3.9"
- "3.10" - "3.10"
- "3.11" - "3.11"
- "3.12" - "3.12"
- "3.13"
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4

1
.gitignore vendored
View File

@ -13,4 +13,3 @@ test_consumer*
.python-version .python-version
.pytest_cache/ .pytest_cache/
.vscode .vscode
.coverage

View File

@ -1,20 +1,20 @@
repos: repos:
- repo: https://github.com/asottile/pyupgrade - repo: https://github.com/asottile/pyupgrade
rev: v3.19.1 rev: v3.15.2
hooks: hooks:
- id: pyupgrade - id: pyupgrade
args: [--py39-plus] args: [--py38-plus]
- repo: https://github.com/psf/black - repo: https://github.com/psf/black
rev: 25.1.0 rev: 24.3.0
hooks: hooks:
- id: black - id: black
language_version: python3 language_version: python3
- repo: https://github.com/pycqa/isort - repo: https://github.com/pycqa/isort
rev: 6.0.1 rev: 5.13.2
hooks: hooks:
- id: isort - id: isort
- repo: https://github.com/PyCQA/flake8 - repo: https://github.com/PyCQA/flake8
rev: 7.2.0 rev: 7.0.0
hooks: hooks:
- id: flake8 - id: flake8
additional_dependencies: additional_dependencies:

View File

@ -1,14 +1,3 @@
4.2.0 (to be released)
------------------
* Added support for Python 3.13.
* Drop support for EOL Python 3.8.
* Removed unused pytest-runner
* Fixed sdist file to ensure it includes all tests
4.1.2 (2024-04-11) 4.1.2 (2024-04-11)
------------------ ------------------

View File

@ -1,2 +1 @@
include LICENSE include LICENSE
recursive-include tests *.py

View File

@ -108,7 +108,7 @@ should start with a slash, but not end with one; for example::
Python Support Python Support
-------------- --------------
Daphne requires Python 3.9 or later. Daphne requires Python 3.8 or later.
Contributing Contributing

View File

@ -1,6 +1,6 @@
import sys import sys
__version__ = "4.1.3" __version__ = "4.1.2"
# Windows on Python 3.8+ uses ProactorEventLoop, which is not compatible with # Windows on Python 3.8+ uses ProactorEventLoop, which is not compatible with

View File

@ -73,18 +73,6 @@ class Command(RunserverCommand):
"seconds (default: 5)" "seconds (default: 5)"
), ),
) )
parser.add_argument(
"--nostatic",
action="store_false",
dest="use_static_handler",
help="Tells Django to NOT automatically serve static files at STATIC_URL.",
)
parser.add_argument(
"--insecure",
action="store_true",
dest="insecure_serving",
help="Allows serving static files even if DEBUG is False.",
)
def handle(self, *args, **options): def handle(self, *args, **options):
self.http_timeout = options.get("http_timeout", None) self.http_timeout = options.get("http_timeout", None)

View File

@ -158,7 +158,7 @@ class DaphneProcess(multiprocessing.Process):
application=application, application=application,
endpoints=endpoints, endpoints=endpoints,
signal_handlers=False, signal_handlers=False,
**self.kwargs, **self.kwargs
) )
# Set up a poller to look for the port # Set up a poller to look for the port
reactor.callLater(0.1, self.resolve_port) reactor.callLater(0.1, self.resolve_port)

View File

@ -1,81 +1,3 @@
[project]
name = "daphne"
dynamic = ["version"]
description = "Django ASGI (HTTP/WebSocket) server"
requires-python = ">=3.9"
authors = [
{ name = "Django Software Foundation", email = "foundation@djangoproject.com" },
]
license = { text = "BSD" }
classifiers = [
"Development Status :: 4 - Beta",
"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.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
"Topic :: Internet :: WWW/HTTP",
]
dependencies = ["asgiref>=3.5.2,<4", "autobahn>=22.4.2", "twisted[tls]>=22.4"]
[project.optional-dependencies]
tests = [
"django",
"hypothesis",
"pytest",
"pytest-asyncio",
"pytest-cov",
"black",
"tox",
"flake8",
"flake8-bugbear",
"mypy",
]
[project.urls]
homepage = "https://github.com/django/daphne"
documentation = "https://channels.readthedocs.io"
repository = "https://github.com/django/daphne.git"
changelog = "https://github.com/django/daphne/blob/main/CHANGELOG.txt"
issues = "https://github.com/django/daphne/issues"
[project.scripts]
daphne = "daphne.cli:CommandLineInterface.entrypoint"
[build-system] [build-system]
requires = ["setuptools"] requires = ["setuptools"]
build-backend = "setuptools.build_meta" build-backend = "setuptools.build_meta"
[tool.setuptools]
packages = ["daphne"]
[tool.setuptools.dynamic]
version = { attr = "daphne.__version__" }
readme = { file = "README.rst", content-type = "text/x-rst" }
[tool.isort]
profile = "black"
[tool.pytest]
testpaths = ["tests"]
asyncio_mode = "strict"
filterwarnings = ["ignore::pytest.PytestDeprecationWarning"]
[tool.coverage.run]
omit = ["tests/*"]
concurrency = ["multiprocessing"]
[tool.coverage.report]
show_missing = "true"
skip_covered = "true"
[tool.coverage.html]
directory = "reports/coverage_html_report"

61
setup.cfg Normal file
View File

@ -0,0 +1,61 @@
[metadata]
name = daphne
version = attr: daphne.__version__
url = https://github.com/django/daphne
author = Django Software Foundation
author_email = foundation@djangoproject.com
description = Django ASGI (HTTP/WebSocket) server
long_description = file: README.rst
long_description_content_type = text/x-rst
license = BSD
classifiers =
Development Status :: 4 - Beta
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.8
Programming Language :: Python :: 3.9
Programming Language :: Python :: 3.10
Programming Language :: Python :: 3.11
Programming Language :: Python :: 3.12
Topic :: Internet :: WWW/HTTP
[options]
package_dir =
daphne=daphne
twisted=daphne/twisted
include_package_data = True
install_requires =
asgiref>=3.5.2,<4
autobahn>=22.4.2
twisted[tls]>=22.4
python_requires = >=3.8
setup_requires =
pytest-runner
zip_safe = False
[options.entry_points]
console_scripts =
daphne = daphne.cli:CommandLineInterface.entrypoint
[options.extras_require]
tests =
django
hypothesis
pytest
pytest-asyncio
[flake8]
exclude = venv/*,tox/*,docs/*,testproject/*,js_client/*,.eggs/*
extend-ignore = E123, E128, E266, E402, W503, E731, W601, B036
max-line-length = 120
[isort]
profile = black
[tool:pytest]
testpaths = tests
asyncio_mode = strict

View File

@ -304,12 +304,12 @@ class TestHTTPRequest(DaphneTestCase):
response = self.run_daphne_raw( response = self.run_daphne_raw(
b"GET /\xc3\xa4\xc3\xb6\xc3\xbc HTTP/1.0\r\n\r\n" b"GET /\xc3\xa4\xc3\xb6\xc3\xbc HTTP/1.0\r\n\r\n"
) )
self.assertTrue(b"400 Bad Request" in response) self.assertTrue(response.startswith(b"HTTP/1.0 400 Bad Request"))
# Bad querystring # Bad querystring
response = self.run_daphne_raw( response = self.run_daphne_raw(
b"GET /?\xc3\xa4\xc3\xb6\xc3\xbc HTTP/1.0\r\n\r\n" b"GET /?\xc3\xa4\xc3\xb6\xc3\xbc HTTP/1.0\r\n\r\n"
) )
self.assertTrue(b"400 Bad Request" in response) self.assertTrue(response.startswith(b"HTTP/1.0 400 Bad Request"))
def test_invalid_header_name(self): def test_invalid_header_name(self):
""" """
@ -321,4 +321,4 @@ class TestHTTPRequest(DaphneTestCase):
response = self.run_daphne_raw( response = self.run_daphne_raw(
f"GET / HTTP/1.0\r\n{header_name}: baz\r\n\r\n".encode("ascii") f"GET / HTTP/1.0\r\n{header_name}: baz\r\n\r\n".encode("ascii")
) )
self.assertTrue(b"400 Bad Request" in response) self.assertTrue(response.startswith(b"HTTP/1.0 400 Bad Request"))

View File

@ -1,6 +1,6 @@
[tox] [tox]
envlist = envlist =
py{39,310,311,312,313} py{38,39,310,311,312}
[testenv] [testenv]
extras = tests extras = tests