diff --git a/README.md b/README.md index 6dfbca3..013ec7f 100644 --- a/README.md +++ b/README.md @@ -9,6 +9,34 @@ Get sdk versions curl https://version-vault.cdn.dog/python/pyenv ``` +### uv-build versions + +Fetch the Python builds list provided by [`astral-sh/uv`](https://github.com/astral-sh/uv) (sourced from `crates/uv-python/download-metadata.json` of the latest release). + +```sh +curl https://version-vault.cdn.dog/python/uv-build +``` + +You can narrow down the result by passing query parameters. Filtering happens server-side, so the response is smaller and faster to consume. + +| Query | Description | Example values | +| ----- | ----------- | -------------- | +| `os` | Operating system / platform | `darwin`, `linux`, `windows` | +| `arch` | CPU architecture family | `x86_64`, `aarch64`, `armv7` | +| `libc` | C library type | `none`, `gnu`, `musl` | + +Examples: + +```sh +# Linux + aarch64 + glibc builds only +curl "https://version-vault.cdn.dog/python/uv-build?os=linux&arch=aarch64&libc=gnu" + +# All macOS builds +curl "https://version-vault.cdn.dog/python/uv-build?os=darwin" +``` + +Pass `force=1` to bypass the cache for this endpoint. + ## Development Install dependencies: diff --git a/src/utils/cache-helper.ts b/src/utils/cache-helper.ts index 3fe4315..1e8ec10 100644 --- a/src/utils/cache-helper.ts +++ b/src/utils/cache-helper.ts @@ -67,10 +67,16 @@ export async function withCache( } /** - * Create cache key from request, ignoring query params + * Create cache key from request. + * + * Query parameters are preserved so that filtered responses (e.g. `?os=darwin`) + * are cached separately from unfiltered ones. The `force` parameter is stripped + * because it only controls cache-bypass behavior and must not affect the key. */ export function createCacheKey(request: Request): Request { const cacheUrl = new URL(request.url); - cacheUrl.search = ""; + cacheUrl.searchParams.delete("force"); + // Sort remaining params so equivalent queries map to the same cache entry + cacheUrl.searchParams.sort(); return new Request(cacheUrl.toString(), request); }