fetchurl-sdk 0.2.0__tar.gz → 0.2.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.
@@ -0,0 +1,83 @@
1
+ name: Autorelease
2
+
3
+ on:
4
+ push:
5
+ branches: [main]
6
+ pull_request:
7
+ branches: [main]
8
+ workflow_dispatch:
9
+ inputs:
10
+ new_version:
11
+ description: "Version bump mode (svu) or explicit x.y.z"
12
+ type: choice
13
+ default: next
14
+ options: [next, patch, minor, major]
15
+
16
+ jobs:
17
+ autorelease:
18
+ runs-on: ubuntu-latest
19
+ permissions:
20
+ contents: write
21
+ # Trusted publishing (PyPI) — enable if you configure OIDC on PyPI instead of UV_PUBLISH_TOKEN
22
+ id-token: write
23
+ steps:
24
+ - uses: actions/checkout@93cb6efe18208431cddfb8368fd83d5badbf9bfd # v5.0.1
25
+ with:
26
+ # svu needs full history + tags
27
+ fetch-depth: 0
28
+
29
+ - name: Setup git config
30
+ run: |
31
+ git config user.name actions-bot
32
+ git config user.email actions-bot@users.noreply.github.com
33
+
34
+ - uses: jdx/mise-action@6d1e696aa24c1aa1bcc1adea0212707c71ab78a8 # v3
35
+
36
+ - name: Sync deps
37
+ run: uv sync --extra test
38
+
39
+ - name: Unit tests
40
+ run: uv run python -m unittest test_fetchurl.py
41
+
42
+ - name: Integration tests (optional)
43
+ if: vars.FETCHURL_TEST_IMAGE != ''
44
+ env:
45
+ FETCHURL_TEST_IMAGE: ${{ vars.FETCHURL_TEST_IMAGE }}
46
+ run: uv run --extra test python -m unittest test_fetchurl_integration.py
47
+ continue-on-error: true
48
+
49
+ - name: Bump version (svu)
50
+ if: github.event_name == 'workflow_dispatch'
51
+ env:
52
+ NEW_VERSION: ${{ github.event.inputs.new_version }}
53
+ run: |
54
+ VERSION="$(NO_TAG=1 ./make_release "$NEW_VERSION")"
55
+ echo "RELEASE_VERSION=$VERSION" >> "$GITHUB_ENV"
56
+ echo "New version: $VERSION (from svu $NEW_VERSION)" >> "$GITHUB_STEP_SUMMARY"
57
+
58
+ - name: Create GitHub release
59
+ if: env.RELEASE_VERSION != ''
60
+ env:
61
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
62
+ TAG: ${{ env.RELEASE_VERSION }}
63
+ run: |
64
+ git tag "$TAG"
65
+ git push origin "$TAG"
66
+ git push origin HEAD:main
67
+ gh release create "$TAG" --title "Release $TAG" --generate-notes
68
+
69
+ - name: Build
70
+ if: env.RELEASE_VERSION != ''
71
+ run: uv build
72
+
73
+ - name: Publish to PyPI
74
+ if: env.RELEASE_VERSION != ''
75
+ env:
76
+ UV_PUBLISH_TOKEN: ${{ secrets.PYPI_TOKEN }}
77
+ run: |
78
+ if [[ -z "${UV_PUBLISH_TOKEN:-}" ]]; then
79
+ echo "PYPI_TOKEN not set; trying trusted publishing (OIDC)..."
80
+ uv publish
81
+ else
82
+ uv publish --token "$UV_PUBLISH_TOKEN"
83
+ fi
@@ -0,0 +1,2 @@
1
+ tag.prefix: ""
2
+ v0: true
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Lucas Eduardo
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,78 @@
1
+ Metadata-Version: 2.4
2
+ Name: fetchurl-sdk
3
+ Version: 0.2.1
4
+ Summary: Protocol-level client SDK for fetchurl content-addressable cache servers
5
+ Project-URL: Homepage, https://pypi.org/project/fetchurl-sdk/
6
+ Project-URL: Repository, https://github.com/fetchurl/sdk-python
7
+ Project-URL: Bug Tracker, https://github.com/fetchurl/sdk-python/issues
8
+ Author: lucasew
9
+ License: MIT
10
+ License-File: LICENSE
11
+ Keywords: cache,content-addressable,fetchurl,hash,sha256
12
+ Classifier: Development Status :: 3 - Alpha
13
+ Classifier: Intended Audience :: Developers
14
+ Classifier: License :: OSI Approved :: MIT License
15
+ Classifier: Programming Language :: Python :: 3
16
+ Classifier: Topic :: Internet :: WWW/HTTP
17
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
18
+ Requires-Python: >=3.8
19
+ Provides-Extra: test
20
+ Requires-Dist: httpx>=0.27.0; extra == 'test'
21
+ Requires-Dist: testcontainers>=3.7.0; extra == 'test'
22
+ Description-Content-Type: text/markdown
23
+
24
+ # fetchurl Python SDK
25
+
26
+ Protocol-level client for [fetchurl](https://github.com/fetchurl/spec) content-addressable cache servers.
27
+
28
+ Zero runtime dependencies — uses only the Python standard library. Works with any HTTP library via `Fetcher` / `AsyncFetcher` protocols.
29
+
30
+ ## Install
31
+
32
+ ```bash
33
+ pip install fetchurl-sdk
34
+ # or
35
+ uv add fetchurl-sdk
36
+ ```
37
+
38
+ ## Protocol
39
+
40
+ Normative behavior: **[fetchurl/spec](https://github.com/fetchurl/spec)** (`SPEC.md`).
41
+
42
+ Reference server: **[fetchurl/fetchurl](https://github.com/fetchurl/fetchurl)**.
43
+
44
+ ## Usage
45
+
46
+ ```python
47
+ from fetchurl import fetch, UrllibFetcher, parse_fetchurl_server
48
+ import os
49
+
50
+ servers = parse_fetchurl_server(os.environ.get("FETCHURL_SERVER", ""))
51
+ # Or drive FetchSession yourself with your HTTP client — see package docstring.
52
+ ```
53
+
54
+ Clients **must** treat the server as untrusted and verify the hash (this SDK does that for you).
55
+
56
+ ## Environment
57
+
58
+ | Variable | Meaning |
59
+ |----------|---------|
60
+ | `FETCHURL_SERVER` | Server base URL(s) per the [spec](https://github.com/fetchurl/spec/blob/main/SPEC.md). Empty/absent disables server use. |
61
+
62
+ ## Development
63
+
64
+ ```bash
65
+ uv sync --dev
66
+ uv run python -m unittest test_fetchurl.py
67
+ # Integration (Docker + image):
68
+ # FETCHURL_TEST_IMAGE=fetchurl:local uv run --extra test python -m unittest test_fetchurl_integration.py
69
+ ```
70
+
71
+ ## Related
72
+
73
+ | Repo | Role |
74
+ |------|------|
75
+ | [fetchurl/spec](https://github.com/fetchurl/spec) | Protocol |
76
+ | [fetchurl/fetchurl](https://github.com/fetchurl/fetchurl) | Go server |
77
+ | [fetchurl/sdk-js](https://github.com/fetchurl/sdk-js) | JavaScript SDK |
78
+ | [fetchurl/sdk-rust](https://github.com/fetchurl/sdk-rust) | Rust SDK |
@@ -0,0 +1,55 @@
1
+ # fetchurl Python SDK
2
+
3
+ Protocol-level client for [fetchurl](https://github.com/fetchurl/spec) content-addressable cache servers.
4
+
5
+ Zero runtime dependencies — uses only the Python standard library. Works with any HTTP library via `Fetcher` / `AsyncFetcher` protocols.
6
+
7
+ ## Install
8
+
9
+ ```bash
10
+ pip install fetchurl-sdk
11
+ # or
12
+ uv add fetchurl-sdk
13
+ ```
14
+
15
+ ## Protocol
16
+
17
+ Normative behavior: **[fetchurl/spec](https://github.com/fetchurl/spec)** (`SPEC.md`).
18
+
19
+ Reference server: **[fetchurl/fetchurl](https://github.com/fetchurl/fetchurl)**.
20
+
21
+ ## Usage
22
+
23
+ ```python
24
+ from fetchurl import fetch, UrllibFetcher, parse_fetchurl_server
25
+ import os
26
+
27
+ servers = parse_fetchurl_server(os.environ.get("FETCHURL_SERVER", ""))
28
+ # Or drive FetchSession yourself with your HTTP client — see package docstring.
29
+ ```
30
+
31
+ Clients **must** treat the server as untrusted and verify the hash (this SDK does that for you).
32
+
33
+ ## Environment
34
+
35
+ | Variable | Meaning |
36
+ |----------|---------|
37
+ | `FETCHURL_SERVER` | Server base URL(s) per the [spec](https://github.com/fetchurl/spec/blob/main/SPEC.md). Empty/absent disables server use. |
38
+
39
+ ## Development
40
+
41
+ ```bash
42
+ uv sync --dev
43
+ uv run python -m unittest test_fetchurl.py
44
+ # Integration (Docker + image):
45
+ # FETCHURL_TEST_IMAGE=fetchurl:local uv run --extra test python -m unittest test_fetchurl_integration.py
46
+ ```
47
+
48
+ ## Related
49
+
50
+ | Repo | Role |
51
+ |------|------|
52
+ | [fetchurl/spec](https://github.com/fetchurl/spec) | Protocol |
53
+ | [fetchurl/fetchurl](https://github.com/fetchurl/fetchurl) | Go server |
54
+ | [fetchurl/sdk-js](https://github.com/fetchurl/sdk-js) | JavaScript SDK |
55
+ | [fetchurl/sdk-rust](https://github.com/fetchurl/sdk-rust) | Rust SDK |
@@ -0,0 +1,28 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+
4
+ # Usage: ./make_release [next|major|minor|patch|<x.y.z>]
5
+ # Only the semver is printed on stdout; everything else goes to stderr.
6
+ MODE="${1:-next}"
7
+
8
+ case "$MODE" in
9
+ next|major|minor|patch)
10
+ VERSION="$(svu "$MODE")"
11
+ ;;
12
+ *)
13
+ VERSION="${MODE#v}"
14
+ ;;
15
+ esac
16
+ VERSION="${VERSION#v}"
17
+
18
+ sed -i "s/^version = .*/version = \"$VERSION\"/" pyproject.toml
19
+ git add pyproject.toml
20
+
21
+ git commit -sm "bump to $VERSION" 1>&2 || true
22
+ if [[ ! -v NO_TAG ]]; then
23
+ git tag "$VERSION"
24
+ git push origin "$VERSION" 1>&2
25
+ fi
26
+ git push origin HEAD 1>&2
27
+
28
+ printf '%s\n' "$VERSION"
@@ -1,3 +1,4 @@
1
1
  [tools]
2
2
  ruff = "0.14.13"
3
+ svu = "3.3.0"
3
4
  uv = "0.9.28"
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
4
4
 
5
5
  [project]
6
6
  name = "fetchurl-sdk"
7
- version = "0.2.0"
7
+ version = "0.2.1"
8
8
  description = "Protocol-level client SDK for fetchurl content-addressable cache servers"
9
9
  readme = "README.md"
10
10
  requires-python = ">=3.8"
@@ -22,9 +22,9 @@ classifiers = [
22
22
  ]
23
23
 
24
24
  [project.urls]
25
- Homepage = "https://github.com/lucasew/fetchurl"
26
- Repository = "https://github.com/lucasew/fetchurl"
27
- "Bug Tracker" = "https://github.com/lucasew/fetchurl/issues"
25
+ Homepage = "https://pypi.org/project/fetchurl-sdk/"
26
+ Repository = "https://github.com/fetchurl/sdk-python"
27
+ "Bug Tracker" = "https://github.com/fetchurl/sdk-python/issues"
28
28
 
29
29
  [project.optional-dependencies]
30
30
  test = ["testcontainers>=3.7.0", "httpx>=0.27.0"]
@@ -57,6 +57,7 @@ class TestIntegration(unittest.TestCase):
57
57
  DockerContainer(image_ref)
58
58
  .with_command("server")
59
59
  .with_network(net)
60
+ .with_env("FETCHURL_ALLOW_PRIVATE_IPS", "1")
60
61
  .with_exposed_ports(8080)
61
62
  ).start()
62
63
 
@@ -237,7 +237,7 @@ wheels = [
237
237
 
238
238
  [[package]]
239
239
  name = "fetchurl-sdk"
240
- version = "0.1.0"
240
+ version = "0.2.1"
241
241
  source = { editable = "." }
242
242
 
243
243
  [package.optional-dependencies]
@@ -1,2 +0,0 @@
1
- .venv
2
- __pycache__
@@ -1 +0,0 @@
1
- 3.13
@@ -1,25 +0,0 @@
1
- Metadata-Version: 2.4
2
- Name: fetchurl-sdk
3
- Version: 0.2.0
4
- Summary: Protocol-level client SDK for fetchurl content-addressable cache servers
5
- Project-URL: Homepage, https://github.com/lucasew/fetchurl
6
- Project-URL: Repository, https://github.com/lucasew/fetchurl
7
- Project-URL: Bug Tracker, https://github.com/lucasew/fetchurl/issues
8
- Author: lucasew
9
- License: MIT
10
- Keywords: cache,content-addressable,fetchurl,hash,sha256
11
- Classifier: Development Status :: 3 - Alpha
12
- Classifier: Intended Audience :: Developers
13
- Classifier: License :: OSI Approved :: MIT License
14
- Classifier: Programming Language :: Python :: 3
15
- Classifier: Topic :: Internet :: WWW/HTTP
16
- Classifier: Topic :: Software Development :: Libraries :: Python Modules
17
- Requires-Python: >=3.8
18
- Provides-Extra: test
19
- Requires-Dist: httpx>=0.27.0; extra == 'test'
20
- Requires-Dist: testcontainers>=3.7.0; extra == 'test'
21
- Description-Content-Type: text/markdown
22
-
23
- # fetchurl
24
-
25
- Simple caching server for URLs with a hash.
@@ -1,3 +0,0 @@
1
- # fetchurl
2
-
3
- Simple caching server for URLs with a hash.