A previous release had provenance metadata, but this release does not. View details.
Stavrophora: Python client for the Crossref API
Discontinued. Stavrophora is now
bibliofabric.crossrefin the bibliofabric package. This is the last release ofstavrophora, and it receives no further updates. Installbibliofabricand follow the migration guide.
Samuel Mok -- s.mok@utwente.nl -- 2026
Stavrophora is a Python client for the Crossref REST API, built on bibliofabric. It ships an async variant and a generated sync twin (StavrophoraSyncClient).
License: MIT
Features
- Async by design -- built on
httpx+asynciowith proper connection pooling - Typed end-to-end -- Pydantic v2 models with
extra="allow"(the Crossref spec is incomplete; extra fields are preserved, never dropped) - Cursor pagination --
async for work in client.works.iterate(...)overnext-cursor - Polite pool by default -- one
mailto=line triples your rate limit - Batch DOI lookup -- comma-separated repeated
filter=doi:keys (Crossref's supported OR form) - Scoped works --
client.journals.works(issn),client.funders.works(id),client.members.works(id),client.prefixes.works(prefix),client.types.works(type) - Facets and sampling --
client.works.facets(...)returns{facet: {value: count}};client.works.sample(n)draws up to 100 random works - Sync twin --
StavrophoraSyncClientand theSync*resource classes are generated from the async source; same parameters, same errors, same pacing, no event loop required - Route-aware parameters -- works-only parameters (
sort,select, filters) are rejected client-side on routes that would answer 400
Installation
uv add stavrophora
Or with pip: pip install stavrophora. Requires Python >=3.12.
Quick Start
import asyncio
from stavrophora import StavrophoraClient, WorksFilters
async def main():
async with StavrophoraClient(mailto="you@example.org") as client:
# Get a single work by DOI (bare or doi.org-prefixed, mixed case)
work = await client.works.get("10.1038/nature12373")
print(work.title[0], work.issued.date_parts)
# Search: filters, sort/order split, field selection
page = await client.works.search(
WorksFilters(type="journal-article"),
query="crow nesting",
sort="is-referenced-by-count:desc",
select=["DOI", "title", "is-referenced-by-count"],
page_size=5,
)
for item in page.results:
print(item.doi, item.is_referenced_by_count)
# Facet distributions
facets = await client.works.facets(
WorksFilters(type="journal-article"), facets=("published",)
)
asyncio.run(main())
The same calls with the sync twin, in a plain script or a notebook:
from stavrophora import StavrophoraSyncClient
with StavrophoraSyncClient(mailto="you@example.org") as client:
work = client.works.get("10.1038/nature12373")
print(work.title[0], work.issued.date_parts)
page = client.works.search(
WorksFilters(type="journal-article"),
query="crow nesting",
sort="is-referenced-by-count:desc",
select=["DOI", "title", "is-referenced-by-count"],
page_size=5,
)
for item in page.results:
print(item.doi, item.is_referenced_by_count)
The sync client never starts or touches an event loop, so it also works when called from inside a running one.
search() returns a bibliofabric.Page: .results (typed models), .total, .next_cursor, and .meta (the raw envelope minus results, e.g. facets).
No authentication required. When rate limits are not explicitly configured, StavrophoraClient applies pool-aware defaults: Public Pool (no credentials) runs at 5 req/s single / 1 req/s list with concurrency 1; Polite Pool (mailto or STAVROPHORA_MAILTO) runs at 10 req/s single / 3 req/s list with concurrency 3; Metadata Plus (plus_token or STAVROPHORA_PLUS_TOKEN, sent as crossref-api-key: Bearer <key>) runs at 50 req/s for both classes with concurrency 10. When both are set, plus_token replaces the query-parameter mailto while mailto still rides the User-Agent. client.last_pool and client.last_rate_limit_headers expose Crossref's x-api-pool / x-rate-limit-* headers from the latest response.
Basic Usage
Get a single entity
work = await client.works.get("10.1038/nature12373") # DOI (bare or doi.org-prefixed)
journal = await client.journals.get("0028-0836") # ISSN or eISSN
funder = await client.funders.get("10.13039/501100000923")
member = await client.members.get("78") # e.g. Elsevier
prefix = await client.prefixes.get("10.1016") # no /prefixes list route exists
Search, sort, filter, select
from stavrophora import WorksFilters
response = await client.works.search(
filters=WorksFilters(type="journal-article", from_pub_date="2026-01-01"),
sort="is-referenced-by-count:desc",
select=["DOI", "title", "is-referenced-by-count"],
page_size=20,
)
Crossref has no publisher filter (400, verified live); scope by prefix, member or ror-id instead.
Iterate all results (cursor)
async for work in client.works.iterate(
filters={"from-created-date": "2026-08-01"},
page_size=1000,
on_page=checkpoint,
):
process(work)
Iteration defaults to 1000 rows per page and follows next-cursor until an empty page. Since 2026-08-24 cursor result sets are not stable and cursors must be re-read from every page (the client always repeats all parameters). Combining iteration with the issued / published* sorts raises a client-side error: the API rejects that combination with 400. For incremental sync prefer from-created-date / until-created-date windows over from-index-date (index-date windows drift); pass on_page(page_number, next_cursor) to checkpoint and resume with cursor=.
Scoped works
nature_works = client.journals.works("0028-0836")
response = await nature_works.search(page_size=5)
ut_works = client.prefixes.works("10.3990") # UT student theses
async for w in ut_works.iterate():
...
Batch DOI lookup
found = await client.works.batch_get_by_doi(
["10.1038/nature12373", "10.1103/PhysRevLett.116.061102"]
)
Keys are normalized bare lowercase DOIs; misses are absent from the dict. Requests are batched 50 DOIs per call via repeated filter=doi: keys (the pipe form doi:a|b returns zero results -- verified live).
Registration agency
agency = await client.works.agency("10.1038/nature12373")
print(agency.agency.label) # "Crossref"
Configuration
Settings load from env vars prefixed STAVROPHORA_ (or a .env file):
STAVROPHORA_MAILTO=s.mok@utwente.nl
Generic settings are inherited under the same prefix: STAVROPHORA_TIMEOUT, STAVROPHORA_MAX_RETRIES, STAVROPHORA_MAX_REQUESTS_PER_SECOND (default 3), STAVROPHORA_MAX_CONCURRENCY (default 3), STAVROPHORA_USER_AGENT. STAVROPHORA_PLUS_TOKEN holds a Metadata Plus key (sent as crossref-api-key: Bearer <key>).
Known Crossref API Quirks
- No pipe-OR in filters.
filter=doi:a|bsilently returns 0 results (OpenAlex-style). Repeatedkey:valuepairs (filter=doi:a,doi:b) are the supported OR form. - Unknown query parameters are rejected with 400 (no silent ignoring). The client therefore sends only
rows,offset,query,filter,sort,order,select,cursor,mailto. pageis not a parameter -- paging isoffsetwithoffset + rows <= 10000(the client raises before requesting past the cap; useiterate()) +rows(max 1000, 400 otherwise). Deep paging must usecursor.- Cursor requests reject publication-date sorts (400
sort-criteria-incompatible-with-cursor, since 2026-08-24):iterate(sort="published")raises client-side; sort byis-referenced-by-countor iterate unsorted. sample(max 100) cannot combine withrows/offset;client.works.sample(n)handles that for you.- Cursor exhaustion is implicit: the last non-empty page still returns a
next-cursor; only the following request returns an emptyitemsand no cursor. /prefixeshas no list route (404) -- only/prefixes/{prefix}and/prefixes/{prefix}/works./licenseshas no single-item route (404) -- only the list.- The
messageenvelope is one level deep for everything: single items live inmessage, lists inmessage.itemswith totals inmessage.total-results. - Rate limits changed 2025-12-01, split by request type 2026-07-21: polite pool 3 req/s for top-level
/workslists (x-api-pool: polite-array), 10 req/s for single records and scoped works routes (polite-single), 3 concurrent; limits apply permailtoaddress. Metadata Plus: 150/s via thecrossref-api-keyheader. On 429 back off (the client retries withRetry-After/exponential backoff); 403 means blocked. - API is served at both
https://api.crossref.organd.../v1with identical payloads (verified 2026-09); stavrophora pins/v1, the versioned form. - The Crossref spec is incomplete -- several returned fields are missing from the official schema. All models use
extra="allow", same defense as aletheca. - Schemas differ between list and single-item routes (verified live):
/journals/{issn}returnstitleas a bare string while/journalsreturns a list; memberprefixentries are{name, value}objects. The models normalize both shapes (SafeStrList, dict-typed prefix entries). /typesignoresrows/offset(verified live 2026-09): the route always returns the complete list (~30 types) regardless of paging parameters./prefixes/{prefix}returnsmemberandprefixas fullhttps://id.crossref.org/member/297-style URIs (verified live 2026-09). ThePrefixmodel normalizes both the URI and bare forms to bare values ("297","10.1038").
Development
Stavrophora lives in the bibliofabric uv workspace at packages/stavrophora. From the repository root:
uv sync --all-packages --all-groups # install everything
uv run pytest packages/stavrophora/tests # mocked tests (live tests excluded by default)
uv run pytest packages/stavrophora/tests -m live_api # live API smoke tests
Lint, type check, and docs run at the workspace root (uv run ruff check, uv run ty check packages/*/src, uv run mkdocs build --strict); see the root AGENTS.md.
License
MIT
Metadata
Release files for stavrophora 0.5.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Loss of provenance
These files do not have provenance metadata, despite files in a prior release including this data.
We recommend further investigation before installing these files. View details.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| stavrophora-0.5.1.tar.gz | 42.9 kB | Without provenance | Details for stavrophora-0.5.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| stavrophora-0.5.1-py3-none-any.whl | Python 3 | none | any | Details for stavrophora-0.5.1-py3-none-any.whl |
Total release size: 102.0 kB
Release files / stavrophora-0.5.1.tar.gz
Loss of provenance
This file belongs to a release without provenance metadata, despite a prior release including this data.
We recommend further investigation before installing this file. View details.
| Download URL | stavrophora-0.5.1.tar.gz |
|---|---|
| Size | 42.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
0ae7caff4c8c5562ad6d003d8648a193a74dccc901bf627cdb5cd335f01517ee
|
|
BLAKE2b-256 checksum How to use checksums |
903824f5405b392a73f2b49483d7bfd8e35cee0b3064189171913b933bdb2193
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.13.10 {"installer":{"name":"uv","version":"0.13.10","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Release files / stavrophora-0.5.1-py3-none-any.whl
Loss of provenance
This file belongs to a release without provenance metadata, despite a prior release including this data.
We recommend further investigation before installing this file. View details.
| Download URL | stavrophora-0.5.1-py3-none-any.whl |
|---|---|
| Size | 59.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
71b61ac68cadfd8db4101fabdc86d31a7a43f27f039c923c53b277cca113c43b
|
|
BLAKE2b-256 checksum How to use checksums |
cdd01584e83d8cb4b980fc258a616426758a8832fc494d652c639661ca210a3c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.13.10 {"installer":{"name":"uv","version":"0.13.10","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Security for stavrophora 0.5.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.
Loss of provenance
A previous release of these files had provenance metadata, but this release does not.
While this could reflect a routine change by the project maintainers, it may also indicate that the release files have been compromised.
Release comparison
- Removed 0.3.0 2 files With provenance
- Added 0.5.1 2 files Without provenance
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.