Skip to main content

ZotMD

ZotMD synchronizes a personal Zotero library and its PDF annotations to Obsidian-native Markdown. It also exposes an immutable Python API for discovering tagged papers and already-local PDFs through Zotero Desktop. The synchronization command continues to use the Zotero Web API; paper discovery uses the local API and does not load synchronization configuration or state.

Requirements

  • macOS and Python 3.13 or newer. Other platforms are best effort.
  • A personal Zotero library. Group libraries are not supported.
  • Better BibTeX citation keys.
  • A dedicated Zotero API key with personal-library read access and no write access.
  • Internet access during synchronization. Zotero Desktop does not need to be running.

The paper-source API instead requires Zotero 10 to be running with local API access enabled. Its reads need no credential or internet connection, and it never downloads unavailable WebDAV files.

Install

Install ZotMD with uv:

uv tool install zotmd
zotmd config
zotmd sync --full --dry-run
zotmd sync --full

Run zotmd sync for subsequent incremental synchronizations. ZotMD detects metadata changes, child-only annotation and attachment changes, citation-key renames, and removals.

Paper Discovery

The paper-source API is part of the unreleased 0.5 source and is not included in the latest PyPI package yet. The installation command above will provide it only after 0.5 is published.

Discover one complete snapshot by exact manual tag:

from zotmd import iter_papers

for paper in iter_papers(tag="paper-source"):
    if attachment := paper.primary_pdf:
        fingerprint = attachment.fingerprint()
        print(paper.key, fingerprint.sha256)

The ZotMD process reads PDF bytes only when fingerprint() is called. Zotero Desktop may perform its own metadata hash while answering the local API. Discovery accepts stored PDFs that Zotero has already made local, rejects symlinked or changed paths, and returns diagnostics for missing metadata, unavailable files, unsupported attachment modes, and ambiguous multi-PDF items. See the local paper-source API for the complete contract.

Credentials

Interactive setup can store the API key in the owner-only configuration file. To keep it out of the file, set it in the environment before setup and future commands:

export ZOTMD_API_KEY="your-read-only-key"
zotmd config

ZOTMD_API_KEY takes precedence over a stored key and is never copied into the configuration file by setup.

Generated Notes

ZotMD owns canonical YAML frontmatter and all generated body content except text between these boundaries:

## Notes
<!-- zotmd:notes:start -->
Your notes remain here.
<!-- zotmd:notes:end -->

## Annotations

Only content inside the boundaries is preserved on later syncs. Each annotation links to its own Zotero attachment. Attachments and PDFs are linked, not copied.

Safety

zotmd sync --dry-run performs Web API and local reads but does not create directories, migrate state, write notes, move files, delete files, or advance checkpoints. Any malformed API record, target collision, rendering error, filesystem error, or state error produces exit status 1 and leaves the library checkpoint pending.

ZotMD 0.4 requires fresh state and does not accept the old zotero.library_type setting. If upgrading from 0.3, rename the old output directory as a backup or select a distinct empty output directory, archive the old sync.sqlite, and rerun zotmd config to rewrite config.toml for a personal library before starting a fresh full sync. Do not delete the old notes first, and keep the backups until the rebuilt library has been checked.

Documentation

See the ZotMD documentation for synchronization setup, the local paper-source API, configuration, template context, generated metadata, commands, and troubleshooting.

License

ZotMD is available under the MIT License.

Metadata

Release files for zotmd 0.5.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 zotmd 0.5.0
File Size Uploaded
zotmd-0.5.0.tar.gz 184.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for zotmd 0.5.0
File Interpreter ABI Platform
zotmd-0.5.0-py3-none-any.whl Python 3 none any Details

Total release size: 254.3 kB

Release files / zotmd-0.5.0.tar.gz

Download URL zotmd-0.5.0.tar.gz
Size 184.1 kB
Tags Source
SHA-256 checksum
How to use checksums
3309ef8265031a62db889dec5dbf65ea9eac0797e399c3ecbc9c5936d898efea
BLAKE2b-256 checksum
How to use checksums
e8bcdbf82c464cc97538aa1cbd447371d71d50879c1049f9e4dd1daeb5bfe5c7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.12.9 {"installer":{"name":"uv","version":"0.12.9","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / zotmd-0.5.0-py3-none-any.whl

Download URL zotmd-0.5.0-py3-none-any.whl
Size 70.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
04d4d33a1a988b0a9f8476b987c933f40918a93b305b015c3a235873c965056c
BLAKE2b-256 checksum
How to use checksums
2b77d9e802430a2bb5107110c8b7ebe45e52c22197ba29dad240077fae02a5ab
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.12.9 {"installer":{"name":"uv","version":"0.12.9","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release history Release notifications | RSS feed

0.5.1

2 release files

This release

0.5.0 This release

2 release files

0.4.0

2 release files

0.3.0

2 release files

0.2.0

2 release files

0.1.0

2 release files

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