Skip to content

Commit 6d121ea

Browse files
committed
Adopt uv
1 parent def4778 commit 6d121ea

6 files changed

Lines changed: 620 additions & 54 deletions

File tree

.github/workflows/test-suite.yml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,12 @@ jobs:
1818

1919
steps:
2020
- uses: "actions/checkout@v4"
21-
- uses: "actions/setup-python@v6"
21+
- name: Install uv (official Astral action)
22+
uses: astral-sh/setup-uv@v5
2223
with:
23-
python-version: "${{ matrix.python-version }}"
24-
allow-prereleases: true
24+
version: "0.9.13"
25+
enable-cache: true
26+
python-version: ${{ matrix.python-version }}
2527
- name: "Install dependencies"
2628
run: "scripts/install"
2729
- name: "Run linting checks"

pyproject.toml

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,40 @@ Documentation = "https://www.python-httpx.org"
6464
Homepage = "https://github.com/encode/httpx"
6565
Source = "https://github.com/encode/httpx"
6666

67+
[dependency-groups]
68+
dev = [
69+
# Install httpx with all optional dependencies
70+
{ include-group = "test" },
71+
{ include-group = "docs" },
72+
{ include-group = "package" },
73+
{ include-group = "lint" },
74+
]
75+
test = [
76+
# Optional charset auto-detection (used in test cases)
77+
"chardet==5.2.0",
78+
# Testing dependencies
79+
"coverage[toml]==7.10.6",
80+
"cryptography==45.0.7",
81+
"pytest==8.4.1",
82+
"trio==0.31.0",
83+
"trio-typing==0.10.0",
84+
"trustme==1.2.1",
85+
"uvicorn==0.35.0",
86+
]
87+
docs = [
88+
"mkdocs==1.6.1",
89+
"mkautodoc==0.2.0",
90+
"mkdocs-material==9.6.18",
91+
]
92+
package = [
93+
"build==1.3.0",
94+
"twine==6.1.0",
95+
]
96+
lint = [
97+
"mypy==1.17.1",
98+
"ruff==0.12.11",
99+
]
100+
67101
[tool.hatch.version]
68102
path = "httpx/__version__.py"
69103

requirements.txt

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

scripts/install

Lines changed: 4 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,7 @@
11
#!/bin/sh -e
22

3-
# Use the Python executable provided from the `-p` option, or a default.
4-
[ "$1" = "-p" ] && PYTHON=$2 || PYTHON="python3"
3+
echo "==> Installing Python"
4+
uv python install
55

6-
REQUIREMENTS="requirements.txt"
7-
VENV="venv"
8-
9-
set -x
10-
11-
if [ -z "$GITHUB_ACTIONS" ]; then
12-
"$PYTHON" -m venv "$VENV"
13-
PIP="$VENV/bin/pip"
14-
else
15-
PIP="pip"
16-
fi
17-
18-
"$PIP" install -U pip
19-
"$PIP" install -r "$REQUIREMENTS"
6+
echo "==> Installing Python dependencies…"
7+
uv sync --all-extras

tests/test_content.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -489,18 +489,18 @@ def test_response_invalid_argument():
489489
def test_ensure_ascii_false_with_french_characters():
490490
data = {"greeting": "Bonjour, ça va ?"}
491491
response = httpx.Response(200, json=data)
492-
assert "ça va" in response.text, (
493-
"ensure_ascii=False should preserve French accented characters"
494-
)
492+
assert (
493+
"ça va" in response.text
494+
), "ensure_ascii=False should preserve French accented characters"
495495
assert response.headers["Content-Type"] == "application/json"
496496

497497

498498
def test_separators_for_compact_json():
499499
data = {"clé": "valeur", "liste": [1, 2, 3]}
500500
response = httpx.Response(200, json=data)
501-
assert response.text == '{"clé":"valeur","liste":[1,2,3]}', (
502-
"separators=(',', ':') should produce a compact representation"
503-
)
501+
assert (
502+
response.text == '{"clé":"valeur","liste":[1,2,3]}'
503+
), "separators=(',', ':') should produce a compact representation"
504504
assert response.headers["Content-Type"] == "application/json"
505505

506506

0 commit comments

Comments
 (0)