Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade to pyproject, bump pyupgrade #542

Merged
merged 12 commits into from
Jan 22, 2025
Merged
4 changes: 4 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ on:
branches:
- main
pull_request:
workflow_dispatch:

permissions:
contents: read

jobs:
tests:
Expand Down
24 changes: 22 additions & 2 deletions .gitignore
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not seeing the value of the changes to this file.

e.g. this adds nothing:

# Tox
/.tox

Copy link
Contributor Author

@asears asears Jan 7, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Generally I would lean towards commenting the gitignores so if and when you switch tooling you can update.

Github's template provides this example comment for tox though I don't think that's quite accurate.

# Unit test / coverage reports
https://github.com/github/gitignore/blob/main/Python.gitignore

I'll remove them though, feel free to edit the PR.

Original file line number Diff line number Diff line change
@@ -1,15 +1,35 @@
# Intellij
.idea/
*.egg-info

# Python binary files
*.pyc
__pycache__

# Wheel builds
dist/
build/
.eggs

# Tox
/.tox

# Hypothesis
.hypothesis

# Cache
.cache
.eggs
.pytest_cache/

# Tests
test_layer*
test_consumer*

.python-version
.pytest_cache/

# Vscode
.vscode

# pytest-cov code coverage
.coverage
.coverage.**
3 changes: 2 additions & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
repos:
- repo: https://github.com/asottile/pyupgrade
rev: v3.19.0
rev: v3.19.1
hooks:
- id: pyupgrade
args: [--py39-plus]
Expand All @@ -19,5 +19,6 @@ repos:
- id: flake8
additional_dependencies:
- flake8-bugbear
- Flake8-pyproject
asears marked this conversation as resolved.
Show resolved Hide resolved
ci:
autoupdate_schedule: quarterly
2 changes: 1 addition & 1 deletion daphne/testing.py
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ def run(self):
application=application,
endpoints=endpoints,
signal_handlers=False,
**self.kwargs
**self.kwargs,
)
# Set up a poller to look for the port
reactor.callLater(0.1, self.resolve_port)
Expand Down
99 changes: 96 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,96 @@
[build-system]
requires = ["setuptools"]
build-backend = "setuptools.build_meta"
[project]
name = "daphne"
dynamic = ["version"]
description = "Django ASGI (HTTP/WebSocket) server"
requires-python = ">=3.9"
authors = [
{ name = "Django Software Foundation", email = "[email protected]" },
]

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"

[tool.setuptools]
packages = ["daphne"]

[tool.setuptools.dynamic]
version = { attr = "daphne.__version__" }
readme = { file = "README.rst", content-type = "text/x-rst" }

[tool.flake8]
exclude = [
"venv/*",
"tox/*",
"docs/*",
"testproject/*",
"js_client/*",
".eggs/*",
]
extend-ignore = ["E123", "E128", "E266", "E402", "W503", "E731", "W601", "B036"]
max-line-length = 120

[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"

[tool.tox]
envlist = ["py39", "py310", "py311", "py312", "py313"]

[tool.tox.testenv]
extras = ["tests"]
commands = ["pytest -v {posargs}"]
59 changes: 0 additions & 59 deletions setup.cfg

This file was deleted.

8 changes: 0 additions & 8 deletions tox.ini

This file was deleted.

Loading