Skip to content

Commit a730fcf

Browse files
Merge branch 'main' into access-logging-handler
2 parents 8cb79b4 + beef1c1 commit a730fcf

File tree

8 files changed

+118
-67
lines changed

8 files changed

+118
-67
lines changed

.flake8

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
[flake8]
2+
exclude =
3+
.venv,
4+
.tox,
5+
docs,
6+
testproject,
7+
js_client,
8+
.eggs
9+
10+
extend-ignore = E123, E128, E266, E402, W503, E731, W601, B036
11+
max-line-length = 120

.github/workflows/tests.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,10 @@ on:
55
branches:
66
- main
77
pull_request:
8+
workflow_dispatch:
9+
10+
permissions:
11+
contents: read
812

913
jobs:
1014
tests:

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,4 @@ test_consumer*
1313
.python-version
1414
.pytest_cache/
1515
.vscode
16+
.coverage

.pre-commit-config.yaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,20 @@
11
repos:
22
- repo: https://github.com/asottile/pyupgrade
3-
rev: v3.19.0
3+
rev: v3.19.1
44
hooks:
55
- id: pyupgrade
66
args: [--py39-plus]
77
- repo: https://github.com/psf/black
8-
rev: 24.10.0
8+
rev: 25.1.0
99
hooks:
1010
- id: black
1111
language_version: python3
1212
- repo: https://github.com/pycqa/isort
13-
rev: 5.13.2
13+
rev: 6.0.1
1414
hooks:
1515
- id: isort
1616
- repo: https://github.com/PyCQA/flake8
17-
rev: 7.1.1
17+
rev: 7.2.0
1818
hooks:
1919
- id: flake8
2020
additional_dependencies:

daphne/management/commands/runserver.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,18 @@ def add_arguments(self, parser):
7373
"seconds (default: 5)"
7474
),
7575
)
76+
parser.add_argument(
77+
"--nostatic",
78+
action="store_false",
79+
dest="use_static_handler",
80+
help="Tells Django to NOT automatically serve static files at STATIC_URL.",
81+
)
82+
parser.add_argument(
83+
"--insecure",
84+
action="store_true",
85+
dest="insecure_serving",
86+
help="Allows serving static files even if DEBUG is False.",
87+
)
7688

7789
def handle(self, *args, **options):
7890
self.http_timeout = options.get("http_timeout", None)

daphne/testing.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -126,14 +126,16 @@ class DaphneProcess(multiprocessing.Process):
126126
port it ends up listening on back to the parent process.
127127
"""
128128

129-
def __init__(self, host, get_application, kwargs=None, setup=None, teardown=None):
129+
def __init__(
130+
self, host, get_application, kwargs=None, setup=None, teardown=None, port=None
131+
):
130132
super().__init__()
131133
self.host = host
132134
self.get_application = get_application
133135
self.kwargs = kwargs or {}
134136
self.setup = setup
135137
self.teardown = teardown
136-
self.port = multiprocessing.Value("i")
138+
self.port = multiprocessing.Value("i", port if port is not None else 0)
137139
self.ready = multiprocessing.Event()
138140
self.errors = multiprocessing.Queue()
139141

@@ -153,12 +155,14 @@ def run(self):
153155

154156
try:
155157
# Create the server class
156-
endpoints = build_endpoint_description_strings(host=self.host, port=0)
158+
endpoints = build_endpoint_description_strings(
159+
host=self.host, port=self.port.value
160+
)
157161
self.server = Server(
158162
application=application,
159163
endpoints=endpoints,
160164
signal_handlers=False,
161-
**self.kwargs
165+
**self.kwargs,
162166
)
163167
# Set up a poller to look for the port
164168
reactor.callLater(0.1, self.resolve_port)

pyproject.toml

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,81 @@
1+
[project]
2+
name = "daphne"
3+
dynamic = ["version"]
4+
description = "Django ASGI (HTTP/WebSocket) server"
5+
requires-python = ">=3.9"
6+
authors = [
7+
{ name = "Django Software Foundation", email = "[email protected]" },
8+
]
9+
10+
license = { text = "BSD" }
11+
classifiers = [
12+
"Development Status :: 4 - Beta",
13+
"Environment :: Web Environment",
14+
"Intended Audience :: Developers",
15+
"License :: OSI Approved :: BSD License",
16+
"Operating System :: OS Independent",
17+
"Programming Language :: Python",
18+
"Programming Language :: Python :: 3",
19+
"Programming Language :: Python :: 3.9",
20+
"Programming Language :: Python :: 3.10",
21+
"Programming Language :: Python :: 3.11",
22+
"Programming Language :: Python :: 3.12",
23+
"Programming Language :: Python :: 3.13",
24+
"Topic :: Internet :: WWW/HTTP",
25+
]
26+
27+
dependencies = ["asgiref>=3.5.2,<4", "autobahn>=22.4.2", "twisted[tls]>=22.4"]
28+
29+
[project.optional-dependencies]
30+
tests = [
31+
"django",
32+
"hypothesis",
33+
"pytest",
34+
"pytest-asyncio",
35+
"pytest-cov",
36+
"black",
37+
"tox",
38+
"flake8",
39+
"flake8-bugbear",
40+
"mypy",
41+
]
42+
43+
[project.urls]
44+
homepage = "https://github.com/django/daphne"
45+
documentation = "https://channels.readthedocs.io"
46+
repository = "https://github.com/django/daphne.git"
47+
changelog = "https://github.com/django/daphne/blob/main/CHANGELOG.txt"
48+
issues = "https://github.com/django/daphne/issues"
49+
50+
[project.scripts]
51+
daphne = "daphne.cli:CommandLineInterface.entrypoint"
52+
153
[build-system]
254
requires = ["setuptools"]
355
build-backend = "setuptools.build_meta"
56+
57+
[tool.setuptools]
58+
packages = ["daphne"]
59+
60+
[tool.setuptools.dynamic]
61+
version = { attr = "daphne.__version__" }
62+
readme = { file = "README.rst", content-type = "text/x-rst" }
63+
64+
[tool.isort]
65+
profile = "black"
66+
67+
[tool.pytest]
68+
testpaths = ["tests"]
69+
asyncio_mode = "strict"
70+
filterwarnings = ["ignore::pytest.PytestDeprecationWarning"]
71+
72+
[tool.coverage.run]
73+
omit = ["tests/*"]
74+
concurrency = ["multiprocessing"]
75+
76+
[tool.coverage.report]
77+
show_missing = "true"
78+
skip_covered = "true"
79+
80+
[tool.coverage.html]
81+
directory = "reports/coverage_html_report"

setup.cfg

Lines changed: 0 additions & 59 deletions
This file was deleted.

0 commit comments

Comments
 (0)