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 included in ZotMD 0.5.0 and later. The installation command above provides it.

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.1

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.1
File Size Uploaded
zotmd-0.5.1.tar.gz 184.0 kB Details

Built distribution (wheel)

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

Total release size: 254.3 kB

Release files / zotmd-0.5.1.tar.gz

Download URL zotmd-0.5.1.tar.gz
Size 184.0 kB
Tags Source
SHA-256 checksum
How to use checksums
e965e79ecdb2f4e96ff654a03789676013d6b6e06e3051c5fa622423c4251d8d
BLAKE2b-256 checksum
How to use checksums
0ff46d3f16c5f275671292dd9b32f851857b35a509979c44e3c08f5a6bc7e498
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.1-py3-none-any.whl

Download URL zotmd-0.5.1-py3-none-any.whl
Size 70.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
e45314800ae74fcf97d9268b35e74da7e2ffcd47510f801844ec2dd6c900c65c
BLAKE2b-256 checksum
How to use checksums
f73fa0900498128a99cf7f59d3e5570be2e42800e2d669eb0920720c4504574c
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

This release

0.5.1 This release

2 release files

0.5.0

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