Skip to content

2.11.0 — one command to start, pytest fixtures and storage snapshots

Choose a tag to compare

@andared andared released this 05 Sep 21:11
· 18 commits to main since this release
ea96e07

Quality-of-life release: starting the service no longer needs Docker or a uvicorn command line,
the pytest fixtures ship with the package, and the whole mock storage can be saved to a JSON file
and loaded back. Everything here is additive — no endpoint, response or client method changes
behaviour.

pip install proxy_mock
proxy-mock --port 5000

Or with nothing installed permanently: uvx proxy-mock --port 5000.

Highlights

  • Console entry point: proxy-mock --host --port --log-level --mocks, also available as
    python -m proxy_mock. --workers > 1 is refused with an explanation, because mocks and
    traffic live in the memory of a single process
  • pytest fixtures ship with the package through a pytest11 entry point: proxy_mock (a
    client, with mocks and traffic reset after every test) and proxy_mock_url (a session-scoped
    instance on a free port). PROXY_MOCK_URL points them at an instance that is already running.
    The fixture boilerplate previously copied out of the README is no longer needed
  • JSON snapshots of the storage: GET /storage/snapshot exports every mock as one document,
    POST /storage/snapshot?mode=merge|replace loads it back, and proxy-mock --mocks file.json
    preloads it at startup. The clients gained export_mocks() and import_mocks(). The document
    carries "format": 1 and a protocol field so snapshots stay readable across releases;
    binary bodies travel base64-encoded in body_b64. An invalid snapshot is rejected before
    anything is written, so the storage is never left half-loaded
  • Importing proxy_mock.client no longer pulls in FastAPI and uvicorn: create_app is
    resolved lazily, so a project that only talks to a running instance stops paying the import
    cost of the server

Fixed: two lower bounds that were not safe

Both affect anyone who installed 2.10.1 into an existing project.

  • fastapi>=0.136 allowed versions where a user mock shadows the service endpoints — a mock
    configured for /proxy_mock is what that path returns. The first safe version is 0.137.0, and
    that is the new bound
  • yarl>=1.8.0 was not installable on any supported Python: no wheels for 3.11+, and the
    generated C sources no longer compile. The new bound is 1.9.4

Deprecated, removed in 3.0

DELETE /traffic and PATCH /traffic/settings were added first, so every deprecated endpoint has
a replacement available today. The deprecated ones keep working unchanged, but answer with a
Deprecation: true header and a Link to the successor.

Deprecated Replacement
POST /storage/clean DELETE /storage
POST /traffic/clean DELETE /traffic
POST /traffic/settings PATCH /traffic/settings
POST /cache/clean and the cache_time field none — response caching is removed in 3.0

Project and infrastructure

  • A container image is published to GHCR for each release, and now carries a default command, so
    it starts without build arguments
  • CI gained a job that resolves and tests the declared lowest dependency versions (it found
    both bounds above on its first run), a smoke test that installs the built wheel into a clean
    environment and exercises the console script and the shipped fixtures, and a check that the
    image actually serves. GitHub Actions are pinned by commit SHA
  • Free-threaded interpreters are no longer supported: the service measured slower there,
    because its work is CPU-bound. Regular 3.11–3.14 is unaffected
  • New documentation: ROADMAP.md —
    the scope, the non-goals, the dependency budget, and what 2.12 and 3.0 change — plus
    CONTRIBUTING.md, SECURITY.md and AGENTS.md

The full list of changes is in
CHANGELOG.md.