Skip to content

CS-2094: Python 3.7 compatibility#1

Closed
martinPavesio wants to merge 23 commits intomainfrom
python37-compat
Closed

CS-2094: Python 3.7 compatibility#1
martinPavesio wants to merge 23 commits intomainfrom
python37-compat

Conversation

@martinPavesio
Copy link
Copy Markdown
Collaborator

@martinPavesio martinPavesio commented Apr 14, 2026

Summary

  • Replace walrus operators (:=) with explicit assignments and add try/except fallbacks for importlib.metadata and typing.TypedDict to support Python 3.7 runtime
  • Replace build backend (hatchling + hatch-vcs + setuptools-scm, all requiring Python ≥3.8) with setuptools<69 + wheel; hardcode version 2.6.3.1 in [project] and a new static src/urllib3/_version.py
  • Fix PEP 639 license = "MIT" syntax (triggers setuptools 77+ upgrade, which requires Python ≥3.8); replace with license = {text = "MIT"}
  • Lower requires-python to >=3.7; add conditional runtime dependencies on typing_extensions and importlib_metadata for Python <3.8

Test plan

  • Build sdist/wheel under Python 3.7 interpreter and confirm no build-time errors
  • import urllib3; urllib3.__version__ returns "2.6.3.1" on Python 3.7
  • Run existing test suite on Python 3.7

🤖 Generated with Claude Code

dependabot Bot and others added 23 commits December 3, 2025 11:45
Bumps [actions/setup-python](https://github.com/actions/setup-python) from 6.0.0 to 6.1.0.
- [Release notes](https://github.com/actions/setup-python/releases)
- [Commits](actions/setup-python@e797f83...83679a8)

---
updated-dependencies:
- dependency-name: actions/setup-python
  dependency-version: 6.1.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
* Prevent decompression bomb for zstd in Python 3.14

* Add experimental `decompress_iter` for Brotli

* Update changes for Brotli

* Add `GzipDecoder.decompress_iter`

* Test python-hyper/brotlicffi#207

* Pin Brotli

* Add `decompress_iter` to all decoders and make tests pass

* Pin brotlicffi to an official release

* Revert changes to response.py

* Add `max_length` parameter to all `decompress` methods

* Fix the `test_brotlipy` session

* Unset `_data` on gzip error

* Add a test for memory usage

* Test more methods

* Fix the test for `stream`

* Cover more lines with tests

* Add more coverage

* Make `read1` a bit more efficient

* Fix PyPy tests for Brotli

* Revert an unnecessarily moved check

* Add some comments

* Leave just one `self._obj.decompress` call in `GzipDecoder`

* Refactor test params

* Test reads with all data already in the decompressor

* Prevent needless copying of data decoded with `max_length`

* Rename the changed test

* Note that responses of unknown length should be streamed too

* Add a changelog entry

* Avoid returning a memory view from `BytesQueueBuffer`

* Add one more note to the changelog entry
* Add a hard-coded limit for the decompression chain

* Reuse new list
…der's buffer (urllib3#3736)

* Fix `HTTPResponse.read_chunked`when data is present in decoder's buffer

* Simplify solution based on urllib3#3735

Co-authored-by: Rui Xi <Cycloctane@outlook.com>

---------

Co-authored-by: Rui Xi <Cycloctane@outlook.com>
Bumps [actions/setup-node](https://github.com/actions/setup-node) from 6.0.0 to 6.1.0.
- [Release notes](https://github.com/actions/setup-node/releases)
- [Commits](actions/setup-node@2028fbc...395ad32)

---
updated-dependencies:
- dependency-name: actions/setup-node
  dependency-version: 6.1.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
* README: Add more emphasis on security and longevity

Added a point about security to the features and another note about our maintainers.

I want to highlight that urllib3 prioritizes security/safety/longevity in ways that most other projects don't, not sure this is sufficient but perhaps a good starting point.

* README: More iteration on the preamble, getting started, maintainers

Taking some of the phrasing from the docs landing page

* README: Update maintainers phrasing

---------

Co-authored-by: Quentin Pradet <quentin.pradet@gmail.com>
Bumps [actions/download-artifact](https://github.com/actions/download-artifact) from 6.0.0 to 7.0.0.
- [Release notes](https://github.com/actions/download-artifact/releases)
- [Commits](actions/download-artifact@018cc2c...37930b1)

---
updated-dependencies:
- dependency-name: actions/download-artifact
  dependency-version: 7.0.0
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Bumps [actions/cache](https://github.com/actions/cache) from 4.3.0 to 5.0.1.
- [Release notes](https://github.com/actions/cache/releases)
- [Changelog](https://github.com/actions/cache/blob/main/RELEASES.md)
- [Commits](actions/cache@0057852...9255dc7)

---
updated-dependencies:
- dependency-name: actions/cache
  dependency-version: 5.0.1
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Bumps [actions/upload-artifact](https://github.com/actions/upload-artifact) from 5.0.0 to 6.0.0.
- [Release notes](https://github.com/actions/upload-artifact/releases)
- [Commits](actions/upload-artifact@330a01c...b7c566a)

---
updated-dependencies:
- dependency-name: actions/upload-artifact
  dependency-version: 6.0.0
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Illia Volochii <illia.volochii@gmail.com>
…ib3#3747)

* Move "v2.0 Migration Guide" to the end of the table of contents

* Mention v2 instead of v2.0 in the documentation

---------

Co-authored-by: Quentin Pradet <quentin.pradet@gmail.com>
…3755)

* Upgrade filelock with `uv sync --upgrade-package filelock`

* Upgrade h2 with `uv sync --upgrade-package h2`

* Upgrade werkzeug with `uv sync --upgrade-package werkzeug`

* Add other changes uv wants to make to the lock file

* Fix mypy errors after upgrading h2

* Make Scorecard ignore dev dependencies
* Stop decoding response content during redirects needlessly

* Rename the new query parameter

* Add a changelog entry
Replace walrus operators (:=) with explicit assignments to support
Python 3.7 which lacks this syntax (PEP 572, Python 3.8+). Add
try/except fallbacks for importlib.metadata (3.8+) and
typing.TypedDict (3.8+) to their backport packages. Lower
requires-python to >=3.7 and add conditional dependencies on
typing_extensions and importlib_metadata for Python <3.8.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
hatchling>=1.27, hatch-vcs>=0.4, and setuptools-scm>=8 all require
Python >=3.8 and execute under the build interpreter, making the
package unbuildable on Python 3.7.

Replace the build backend with setuptools<69 + wheel, which support
Python 3.7 as the build interpreter. Hardcode version "2.6.3.1" in
[project] and in a new static src/urllib3/_version.py (previously
generated at build time by hatch-vcs). Remove all [tool.hatch.*]
configuration blocks. Add [tool.setuptools.packages.find] to locate
packages under the src/ layout. Remove license-files from [project]
as that field (PEP 639) is not supported by setuptools<69.

Remove src/urllib3/_version.py from .gitignore since it is now a
committed static file rather than a generated artifact.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
The bare string form `license = "MIT"` in [project] is PEP 639 syntax.
setuptools detects this and attempts to upgrade itself to 77.0.3+ for
PEP 639 support, but setuptools 77.0.3 requires Python >=3.8, causing
the build to fail on Python 3.7.

Replace with the legacy TOML table form `license = {text = "MIT"}`,
which is recognised by setuptools<69 without triggering an upgrade.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@martinPavesio
Copy link
Copy Markdown
Collaborator Author

Closing — base was wrong, PR included upstream commits. Recreating with correct base.

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.

6 participants