foghttp 0.1.1__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (52) hide show
  1. foghttp-0.1.1/.github/workflows/release.yml +198 -0
  2. foghttp-0.1.1/.gitignore +35 -0
  3. foghttp-0.1.1/.pre-commit-config.yaml +53 -0
  4. foghttp-0.1.1/Cargo.lock +661 -0
  5. foghttp-0.1.1/Cargo.toml +19 -0
  6. foghttp-0.1.1/LICENSE +21 -0
  7. foghttp-0.1.1/PKG-INFO +90 -0
  8. foghttp-0.1.1/README.md +65 -0
  9. foghttp-0.1.1/foghttp/__init__.py +38 -0
  10. foghttp-0.1.1/foghttp/_foghttp.pyi +60 -0
  11. foghttp-0.1.1/foghttp/body.py +21 -0
  12. foghttp-0.1.1/foghttp/client.py +190 -0
  13. foghttp-0.1.1/foghttp/client_closed_error.py +5 -0
  14. foghttp-0.1.1/foghttp/connect_timeout.py +5 -0
  15. foghttp-0.1.1/foghttp/exceptions.py +26 -0
  16. foghttp-0.1.1/foghttp/fog_http_error.py +2 -0
  17. foghttp-0.1.1/foghttp/http_status_error.py +9 -0
  18. foghttp-0.1.1/foghttp/lifecycle_error.py +5 -0
  19. foghttp-0.1.1/foghttp/limits.py +10 -0
  20. foghttp-0.1.1/foghttp/messages.py +13 -0
  21. foghttp-0.1.1/foghttp/models.py +6 -0
  22. foghttp-0.1.1/foghttp/pool_stats.py +14 -0
  23. foghttp-0.1.1/foghttp/pool_timeout.py +5 -0
  24. foghttp-0.1.1/foghttp/py.typed +0 -0
  25. foghttp-0.1.1/foghttp/read_timeout.py +5 -0
  26. foghttp-0.1.1/foghttp/request_error.py +5 -0
  27. foghttp-0.1.1/foghttp/response.py +44 -0
  28. foghttp-0.1.1/foghttp/response_error.py +5 -0
  29. foghttp-0.1.1/foghttp/stats.py +4 -0
  30. foghttp-0.1.1/foghttp/timeout_error.py +5 -0
  31. foghttp-0.1.1/foghttp/timeouts.py +10 -0
  32. foghttp-0.1.1/foghttp/unclosed_client_error.py +2 -0
  33. foghttp-0.1.1/foghttp/url.py +12 -0
  34. foghttp-0.1.1/logo.png +0 -0
  35. foghttp-0.1.1/pyproject.toml +52 -0
  36. foghttp-0.1.1/ruff.toml +43 -0
  37. foghttp-0.1.1/src/core/client.rs +43 -0
  38. foghttp-0.1.1/src/core/headers.rs +31 -0
  39. foghttp-0.1.1/src/core/metrics.rs +50 -0
  40. foghttp-0.1.1/src/core/mod.rs +5 -0
  41. foghttp-0.1.1/src/core/request.rs +30 -0
  42. foghttp-0.1.1/src/core/response.rs +13 -0
  43. foghttp-0.1.1/src/errors.rs +12 -0
  44. foghttp-0.1.1/src/lib.rs +17 -0
  45. foghttp-0.1.1/src/messages.rs +3 -0
  46. foghttp-0.1.1/src/py/client.rs +139 -0
  47. foghttp-0.1.1/src/py/mod.rs +16 -0
  48. foghttp-0.1.1/src/py/response.rs +26 -0
  49. foghttp-0.1.1/src/py/stats.rs +40 -0
  50. foghttp-0.1.1/tests/__init__.py +0 -0
  51. foghttp-0.1.1/tests/test_client.py +85 -0
  52. foghttp-0.1.1/uv.lock +176 -0
@@ -0,0 +1,198 @@
1
+ name: Release
2
+
3
+ on:
4
+ push:
5
+ tags:
6
+ - "v*"
7
+ release:
8
+ types: [published]
9
+
10
+ permissions:
11
+ contents: read
12
+
13
+ jobs:
14
+ validate-version:
15
+ name: Validate release version
16
+ runs-on: ubuntu-latest
17
+ steps:
18
+ - name: Checkout
19
+ uses: actions/checkout@v4
20
+
21
+ - name: Check tag, Python version, and Cargo version
22
+ shell: python
23
+ run: |
24
+ import os
25
+ import re
26
+ import tomllib
27
+ from pathlib import Path
28
+
29
+ ref = os.environ["GITHUB_REF"]
30
+ if not ref.startswith("refs/tags/v"):
31
+ raise SystemExit(f"release workflow must run from a v* tag, got {ref!r}")
32
+
33
+ tag_version = ref.removeprefix("refs/tags/v")
34
+ pyproject_version = tomllib.loads(Path("pyproject.toml").read_text())["project"]["version"]
35
+ cargo_toml = Path("Cargo.toml").read_text()
36
+ cargo_version = re.search(r'^version\s*=\s*"([^"]+)"', cargo_toml, re.MULTILINE)
37
+
38
+ if cargo_version is None:
39
+ raise SystemExit("Cargo.toml package version was not found")
40
+
41
+ versions = {
42
+ "tag": tag_version,
43
+ "pyproject.toml": pyproject_version,
44
+ "Cargo.toml": cargo_version.group(1),
45
+ }
46
+ if len(set(versions.values())) != 1:
47
+ raise SystemExit(f"release versions do not match: {versions}")
48
+
49
+ linux-wheels:
50
+ name: Build Linux wheels (${{ matrix.python-version }}, ${{ matrix.target }})
51
+ runs-on: ubuntu-latest
52
+ needs: validate-version
53
+ timeout-minutes: 45
54
+ strategy:
55
+ fail-fast: false
56
+ matrix:
57
+ python-version: ["3.11", "3.12", "3.13", "3.14"]
58
+ target: [x86_64, aarch64]
59
+ steps:
60
+ - name: Checkout
61
+ uses: actions/checkout@v4
62
+
63
+ - name: Set up QEMU
64
+ if: matrix.target == 'aarch64'
65
+ uses: docker/setup-qemu-action@v3
66
+
67
+ - name: Build wheel
68
+ uses: PyO3/maturin-action@v1
69
+ env:
70
+ CFLAGS_aarch64_unknown_linux_gnu: ${{ matrix.target == 'aarch64' && '-D__ARM_ARCH=8' || '' }}
71
+ with:
72
+ command: build
73
+ target: ${{ matrix.target }}
74
+ args: --release --out dist --interpreter python${{ matrix.python-version }}
75
+ manylinux: "2014"
76
+ sccache: true
77
+
78
+ - name: Upload wheel artifact
79
+ uses: actions/upload-artifact@v4
80
+ with:
81
+ name: wheels-linux-${{ matrix.target }}-py${{ matrix.python-version }}
82
+ path: dist/*.whl
83
+ if-no-files-found: error
84
+
85
+ macos-wheels:
86
+ name: Build macOS wheels (${{ matrix.python-version }}, ${{ matrix.platform.name }})
87
+ runs-on: ${{ matrix.platform.runner }}
88
+ needs: validate-version
89
+ timeout-minutes: 45
90
+ strategy:
91
+ fail-fast: false
92
+ matrix:
93
+ python-version: ["3.11", "3.12", "3.13", "3.14"]
94
+ platform:
95
+ - name: x86_64
96
+ runner: macos-15-intel
97
+ target: x86_64
98
+ - name: aarch64
99
+ runner: macos-15
100
+ target: aarch64
101
+ steps:
102
+ - name: Checkout
103
+ uses: actions/checkout@v4
104
+
105
+ - name: Set up Python
106
+ uses: actions/setup-python@v5
107
+ with:
108
+ python-version: ${{ matrix.python-version }}
109
+
110
+ - name: Build wheel
111
+ uses: PyO3/maturin-action@v1
112
+ with:
113
+ command: build
114
+ target: ${{ matrix.platform.target }}
115
+ args: --release --out dist --interpreter python
116
+ sccache: true
117
+
118
+ - name: Upload wheel artifact
119
+ uses: actions/upload-artifact@v4
120
+ with:
121
+ name: wheels-macos-${{ matrix.platform.name }}-py${{ matrix.python-version }}
122
+ path: dist/*.whl
123
+ if-no-files-found: error
124
+
125
+ windows-wheels:
126
+ name: Build Windows wheels (${{ matrix.python-version }}, x64)
127
+ runs-on: windows-latest
128
+ needs: validate-version
129
+ timeout-minutes: 45
130
+ strategy:
131
+ fail-fast: false
132
+ matrix:
133
+ python-version: ["3.11", "3.12", "3.13", "3.14"]
134
+ steps:
135
+ - name: Checkout
136
+ uses: actions/checkout@v4
137
+
138
+ - name: Set up Python
139
+ uses: actions/setup-python@v5
140
+ with:
141
+ python-version: ${{ matrix.python-version }}
142
+ architecture: x64
143
+
144
+ - name: Build wheel
145
+ uses: PyO3/maturin-action@v1
146
+ with:
147
+ command: build
148
+ args: --release --out dist --interpreter python
149
+ sccache: true
150
+
151
+ - name: Upload wheel artifact
152
+ uses: actions/upload-artifact@v4
153
+ with:
154
+ name: wheels-windows-x64-py${{ matrix.python-version }}
155
+ path: dist/*.whl
156
+ if-no-files-found: error
157
+
158
+ sdist:
159
+ name: Build source distribution
160
+ runs-on: ubuntu-latest
161
+ needs: validate-version
162
+ timeout-minutes: 15
163
+ steps:
164
+ - name: Checkout
165
+ uses: actions/checkout@v4
166
+
167
+ - name: Build sdist
168
+ uses: PyO3/maturin-action@v1
169
+ with:
170
+ command: sdist
171
+ args: --out dist
172
+
173
+ - name: Upload sdist artifact
174
+ uses: actions/upload-artifact@v4
175
+ with:
176
+ name: sdist
177
+ path: dist/*.tar.gz
178
+ if-no-files-found: error
179
+
180
+ publish:
181
+ name: Publish to PyPI
182
+ runs-on: ubuntu-latest
183
+ needs: [linux-wheels, macos-wheels, windows-wheels, sdist]
184
+ environment: pypi
185
+ timeout-minutes: 15
186
+ permissions:
187
+ contents: read
188
+ id-token: write
189
+ steps:
190
+ - name: Download distributions
191
+ uses: actions/download-artifact@v4
192
+ with:
193
+ pattern: "*"
194
+ path: dist
195
+ merge-multiple: true
196
+
197
+ - name: Publish package distributions to PyPI
198
+ uses: pypa/gh-action-pypi-publish@release/v1
@@ -0,0 +1,35 @@
1
+ # Rust / Cargo
2
+ /debug/
3
+ /target/
4
+
5
+ # Python
6
+ __pycache__/
7
+ *.py[cod]
8
+ *.so
9
+ .venv/
10
+ .pytest_cache/
11
+ .mypy_cache/
12
+ .ruff_cache/
13
+ .tox/
14
+ .nox/
15
+ .coverage
16
+ coverage.xml
17
+ htmlcov/
18
+ build/
19
+ dist/
20
+ *.egg-info/
21
+
22
+ # These are backup files generated by rustfmt
23
+ **/*.rs.bk
24
+
25
+ # MSVC Windows builds of rustc generate these, which store debugging information
26
+ *.pdb
27
+
28
+ # Generated by cargo mutants
29
+ # Contains mutation testing data
30
+ **/mutants.out*/
31
+
32
+ # Editors / OS
33
+ .idea/
34
+ .vscode/
35
+ .DS_Store
@@ -0,0 +1,53 @@
1
+ repos:
2
+ - repo: https://github.com/pre-commit/pre-commit-hooks
3
+ rev: v6.0.0
4
+ hooks:
5
+ - id: check-added-large-files
6
+ - id: pretty-format-json
7
+ args:
8
+ - "--indent=2"
9
+ - "--autofix"
10
+ - id: check-json
11
+ - id: check-yaml
12
+ exclude: ^\.github/
13
+ - id: check-toml
14
+ - id: end-of-file-fixer
15
+ - id: trailing-whitespace
16
+
17
+ - repo: https://github.com/asottile/add-trailing-comma
18
+ rev: v4.0.0
19
+ hooks:
20
+ - id: add-trailing-comma
21
+
22
+ - repo: https://github.com/crate-ci/typos
23
+ rev: v1.46.0
24
+ hooks:
25
+ - id: typos
26
+
27
+ - repo: https://github.com/Yelp/detect-secrets
28
+ rev: v1.5.0
29
+ hooks:
30
+ - id: detect-secrets
31
+
32
+ - repo: https://github.com/astral-sh/uv-pre-commit
33
+ rev: 0.11.8
34
+ hooks:
35
+ - id: uv-lock
36
+
37
+ - repo: https://github.com/astral-sh/ruff-pre-commit
38
+ rev: v0.15.12
39
+ hooks:
40
+ - id: ruff-format
41
+ - id: ruff-check
42
+ args: [--fix, --unsafe-fixes]
43
+
44
+ - repo: https://github.com/pre-commit/mirrors-mypy
45
+ rev: v1.20.2
46
+ hooks:
47
+ - id: mypy
48
+ additional_dependencies:
49
+ - no_implicit_optional
50
+ - orjson>=3.10
51
+ - typing-extensions>=4.3.0,<5
52
+ args: [--config-file=pyproject.toml, --install-types, --non-interactive]
53
+ files: ^foghttp/.*\.pyi?$