Skip to main content

inkwire-receiver-core

The Python Inkwire receiver: a core that validates requests, derives SEO metadata, renders and sanitizes Markdown, resolves slugs and talks to a store, plus a ready-to-run FastAPI app. It implements the whole protocol specification.

pip install "inkwire-receiver-core[fastapi]" uvicorn

Run it

export INKWIRE_API_KEYS=dev-key,audit-key:ro   # ":ro" marks a read-only key
export INKWIRE_ROOT=./content                  # entries are written as content/<kind>/<slug>.md
uvicorn inkwire_receiver.app:create_app --factory
Variable Default
INKWIRE_API_KEYS (required) comma-separated bearer keys; a :ro suffix makes one read-only
INKWIRE_KINDS post,page the kinds the receiver holds
INKWIRE_STORE file file (a folder of Markdown files) or memory
INKWIRE_ROOT ./content the file store's folder
INKWIRE_MEDIA_URL_BASE /inkwire-media public base of uploaded files; a path is served by the app from <root>/media
INKWIRE_SITE_NAME, INKWIRE_SITE_URL discovery; the URL is also the base of entry URLs
INKWIRE_SITE_DESCRIPTION, INKWIRE_SITE_LANGUAGE discovery (a BCP 47 tag such as en)
INKWIRE_URL_TEMPLATE /blog/<slug> for posts entry URL with {site}, {kind}, {slug}
INKWIRE_MARKDOWN_LIMIT_BYTES 1000000 over it: 413 too_large
INKWIRE_MEDIA_LIMIT_BYTES 10000000 over it: 413 too_large

Endpoints

Every endpoint is under /api, takes Authorization: Bearer <key> and answers with Inkwire-Version: 1. A read-only key may call every GET.

GET /api/inkwire discovery: site, features, kinds, limits
POST /api/content create or update an entry, upserting on external_id and kind
GET /api/content, GET /api/content/{id} list (status, kind, tag, category, search, external_id, slug, limit, cursor) and read, newest first
PATCH /api/content/{id} edit part of an entry; honours If-Match
DELETE /api/content/{id} remove an entry
GET /api/terms the tags and categories entries use (kind, search, limit)
POST /api/media upload an image (multipart) or have the receiver fetch a public URL
GET /api/media the media library, newest first (search, limit, cursor)
PATCH /api/media/{id} set or clear (null) a media item's alt and title

The advertised features follow what the store can do: terms is always there, media, media_list and media_update appear when the store saves, lists and updates media, and schedule only when InkwireConfig(schedule=True) says the site holds a future-dated entry back until its time. The file store has no renderer, so the reference app does not.

Use the core in your own app

create_app takes a store, the keys and a config, so a site with its own database or routes builds the app from its own parts:

from inkwire_receiver import InkwireConfig, Limits, Site, parse_api_keys
from inkwire_receiver.app import create_app

app = create_app(
    store=MyStore(),  # see below
    api_keys=parse_api_keys("dev-key,audit-key:ro"),
    config=InkwireConfig(
        site=Site(name="Acme", url="https://acme.com", description="Acme's blog", language="en"),
        kinds=["post", "page"],
        limits=Limits(markdown_bytes=1_000_000, media_bytes=10_000_000),
        url_for=lambda entry: f"https://acme.com/blog/{entry['slug']}",
    ),
)

Each endpoint is also one function (handle_upsert, handle_list, handle_get, handle_patch, handle_delete, handle_terms, handle_media, handle_media_list, handle_media_update, handle_discovery) returning (status, headers, body), to mount in any framework.

Stores

A store is four async methods, all scoped by the API key's key:

async def get(self, key, id) -> StoredContent | None
async def list(self, key, filter: ListFilter) -> tuple[list[StoredContent], str | None]
async def save(self, key, entry: StoredContent) -> StoredContent
async def remove(self, key, id) -> bool

list returns one page, newest first by updated_at (ties by id); paginate does the ordering and the keyset cursor. Slug conflicts and external_id lookups are ordinary list calls with exact filters.

Media is optional, one method per feature: media (and fetch_media for {url} uploads) saves a file, list_media lists the library (paginate_media), update_media changes alt / title. A store without a method makes the receiver omit that feature.

MemoryStore is for development and tests. FileStore keeps <root>/<kind>/<slug>.md with YAML frontmatter (existing files are read as they are) and <root>/media/<id>-<name> with a .meta.json sidecar for each upload.

Metadata

Release files for inkwire-receiver-core 1.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for inkwire-receiver-core 1.0.0
File Size Uploaded Provenance Actions
inkwire_receiver_core-1.0.0.tar.gz 57.1 kB Without provenance Details for inkwire_receiver_core-1.0.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for inkwire-receiver-core 1.0.0
File Interpreter ABI Platform Actions
inkwire_receiver_core-1.0.0-py3-none-any.whl Python 3 none any Details for inkwire_receiver_core-1.0.0-py3-none-any.whl

Total release size: 95.0 kB

Release files / inkwire_receiver_core-1.0.0.tar.gz

Download URL inkwire_receiver_core-1.0.0.tar.gz
Size 57.1 kB
Tags Source
SHA-256 checksum
How to use checksums
0f9e2a8a4d709f24080772a1cdc86a2a955834f9d5fb81f49ab5e7be2076b48a
BLAKE2b-256 checksum
How to use checksums
d6a001a2258c4f34e3d893a06923d17026df6e019a8aba30c069fc794c020098
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.13.5 {"installer":{"name":"uv","version":"0.13.5","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release files / inkwire_receiver_core-1.0.0-py3-none-any.whl

Download URL inkwire_receiver_core-1.0.0-py3-none-any.whl
Size 37.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
72c8bf7aa8f36a22681766e79986d474784ad84909dde4d960e42e660cc5b6c8
BLAKE2b-256 checksum
How to use checksums
01320e80db3571256e7d2775d934aeab427f4b04865571560771635a515702d5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.13.5 {"installer":{"name":"uv","version":"0.13.5","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Security for inkwire-receiver-core 1.0.0

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.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page