Skip to content

Modernize packaging and development tooling with uv and Ruff - #204

Open
gorewilliams wants to merge 3 commits into
python-hyper:masterfrom
gorewilliams:modernize-uv-python-support
Open

Modernize packaging and development tooling with uv and Ruff#204
gorewilliams wants to merge 3 commits into
python-hyper:masterfrom
gorewilliams:modernize-uv-python-support

Conversation

@gorewilliams

Copy link
Copy Markdown

h11's packaging and development configuration was spread across setup.py, tox.ini, and requirements files, with outdated Python support declarations. This PR follows h2's approach by consolidating metadata and tool configuration in pyproject.toml and using uv with a committed lockfile for development and CI.

  • Require Python 3.10+, with CI coverage for CPython 3.10–3.14 and PyPy 3.10/3.11; drop Python 3.8 and 3.9 support.
  • Replace Black and isort with Ruff for linting, import sorting, and formatting, retaining the 88-column layout.
  • Update Read the Docs, Sphinx compatibility, contributor instructions, and release notes.
  • Preserve dependency-free runtime installation and the existing package layout, including the typing marker and exclusion of tests from wheels.

Validation: all 78 tests pass on each of the seven interpreters; Ruff, mypy, the strict Sphinx build, and wheel/sdist metadata and contents checks pass. A parallel tox run hit a coverage-file collision on Python 3.13; that environment passed when rerun separately.

Closes #203

@sigmavirus24 sigmavirus24 left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Clearly ruff is not a drop-in replacement at all. And it looks like it's modifying some fairly deliberate styles.

There's significant churn to "modernize" things. Also seems unlikely that the news fragments you added are of any real value (aside from python support removal) to users. ruff and uv are development only so thusly unimportant for end users.

Comment on lines 1105 to +1106
c.receive_data(
b"POST / HTTP/1.1\r\n"
b"Host: example.com\r\n"
b"Transfer-Encoding: chunked\r\n\r\n"
b"POST / HTTP/1.1\r\nHost: example.com\r\nTransfer-Encoding: chunked\r\n\r\n"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

fyi this is tracked in astral-sh/ruff#18436 and the general suggestion is to use explicit string concatenation (e.g., with +) rather than implicit, but perhaps we'll add a setting 🤷‍♀️

@zanieb zanieb Sep 9, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

(I don't really condone external contributors migrating repositories to our tooling, I just happen to watch this repository because I work on the HTTP stack and figured I'd look at that was objectionable here to get a sense for where our tools aren't doing the right thing)

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Np, appreciate it! Thx for bringing the issue to my attention.

Comment thread h11/tests/helpers.py
Comment on lines +1 to +3
from typing import List, Type, Union, ValuesView, cast

from .._connection import Connection, NEED_DATA, PAUSED
from .._connection import NEED_DATA, PAUSED, Connection

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

I agree with Zanie's comment and am not trying to push this PR forward necessarily, but if you would like to adopt Ruff's isort implementation, you may want to check out the order-by-type and case-sensitive settings, which I think could avoid these changes.

That looks like the main source of churn to me besides the implicit concatenation changes.

@gorewilliams

Copy link
Copy Markdown
Author

@sigmavirus24 thx for the review. You're right, ruff isn't a drop-in currently. I think I'll drop it unless you say otherwise (see @zanieb's and @ntBre's comments). Other than that and the news fragments which I'll drop as well, anything else?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Modernize packaging and development tooling with uv and Ruff

4 participants