zenodo-mock
A local, credential-free stand-in for the Zenodo API, so a full publish round-trip can run on a dev VM or in CI without a Zenodo token.
Stdlib only — no runtime dependencies.
Install
pip install zenodo-mock
Run
zenodo-mock --port 8766
# Deposit API: http://127.0.0.1:8766/api/deposit/depositions
(Or python -m zenodo_mock --port 8766.)
The deposit API always runs. Pass --source-outputs <dir> to also serve a fixed
pre-staged read record (the fetch/consume demo); omit it to run deposit-only,
which is all a bare VM needs. Uploaded deposit files land under --storage-dir.
Publish round-trip (no token)
Point any Zenodo publisher at the mock. For example, marinerg-data:
marinerg-data publish <bundle> --zenodo-url http://127.0.0.1:8766/api --skip-ckan
# → mints a DOI (10.5072/zenodo.<id>), uploads files, and the record becomes
# resolvable at /api/records/<id>. --new-version works too.
The DOI is pre-reserved on the draft and returned in
metadata.prereserve_doi, as Zenodo's deposit API does — so a publisher can
record the identifier before it takes the step it cannot undo.
Use it from a test
from zenodo_mock.testing import spawn
def test_publish_round_trip(tmp_path):
with spawn(tmp_path / "deposits") as base_url:
publish_against(f"{base_url}/api")
spawn runs the mock in a subprocess on a kernel-chosen port, waits for it to
be serving, and tears it down — so concurrent suites cannot collide, and no
caller has to reimplement the readiness wait. Add zenodo-mock to your dev
dependency group.
What it implements
The subset of the Zenodo deposit API a publisher drives: create deposition, bucket upload, delete file, set metadata, publish (mints a DOI and registers a resolvable record), and new-version. State is in-memory. Not a faithful Zenodo — just enough for the round-trip.
Provenance
Extracted from marinerg-i/data-access-service (infra/zenodo_mock/) when that
repo was archived, so the mock could be reused independently of the catalogue.
tests/test_server.py covers the deposit store, tests/test_http.py the HTTP
layer over it, and tests/test_spawn.py the subprocess helper. The mock is
also driven by the suites of marinerg-data and ckanext-marinerg, which is
what proves their encodings of the Zenodo API and this one agree.
Licence
AGPL-3.0-or-later. See LICENSE.
Metadata
Release files for zenodo-mock 0.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| zenodo_mock-0.1.1.tar.gz | 25.7 kB | Without provenance | Details for zenodo_mock-0.1.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| zenodo_mock-0.1.1-py3-none-any.whl | Python 3 | none | any | Details for zenodo_mock-0.1.1-py3-none-any.whl |
Total release size: 47.7 kB
Release files / zenodo_mock-0.1.1.tar.gz
| Download URL | zenodo_mock-0.1.1.tar.gz |
|---|---|
| Size | 25.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
34942382f6f1a9dd941645c275e6399f73c8154aefb38acd4dd5dc7fb71491e6
|
|
BLAKE2b-256 checksum How to use checksums |
2e7fccbfb8c8e1935c71cf0d0ec0a567ac670ff6611d7b7271523e87e842dab5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.14.6
|
Release files / zenodo_mock-0.1.1-py3-none-any.whl
| Download URL | zenodo_mock-0.1.1-py3-none-any.whl |
|---|---|
| Size | 22.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
e710a21c4217bebdbf4508758bf58dd93eb7bc9a1917ca71da93313bc920c4a0
|
|
BLAKE2b-256 checksum How to use checksums |
9e8225ed87ad5e5c817da1d147ffc2530a3a805536b1a719295f90e6be73c076
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.14.6
|
Security for zenodo-mock 0.1.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.