Skip to main content

pmcdb

PubMed query tool. Downloads the complete NCBI PubMed corpus (~40M articles), parses every DTD field, produces compact queryable Parquet tables (~34 GB). Every user serves data back to the scientific community via irohds P2P.

Install

uv add pmcdb

Rust parser binary bundled in platform-specific wheel. No toolchain needed.

Usage

from pmcdb import PubMed

with PubMed() as db:
    df = db.df("SELECT * FROM citation WHERE pub_year = '2024' LIMIT 10")
    print(db.tables())  # 30 tables

# Reproducible checkpoint (query-time filter only)
with PubMed(through="2024") as db:
    df = db.df("SELECT count(*) FROM citation")

First call triggers build (~2 min on 64-core, ~15 min average). Subsequent calls: instant (local cache) or delta-efficient P2P fetch.

CLI

python -m pmcdb                     # build + compact + serve (default)
python -m pmcdb query "SELECT ..."  # run SQL
python -m pmcdb --no-compact        # build only, skip compaction

Architecture

pmcdb-core (Rust)   download + parse XML.gz -> per-worker Parquet
                   quick-xml, arrow/parquet, crossbeam-channel, ureq, coren
pmcdb (Python)      DuckDB query layer, compaction, irohds P2P distribution
                   @irohds.memo on create_table, coren for resource limits

30 tables: 27 from XML corpus + 3 auxiliary (journal catalog, deleted PMIDs, computed author clusters from NCBI).

  • Parse: ~70-80k records/sec (zero-copy RowWriter into Arrow builders)
  • Full dataset: ~34 GB Parquet (vs 239 GB SQLite)
  • Resume after interrupt via _state file
  • Deterministic: same FTP state -> byte-identical sorted Parquet
  • Adaptive flush threshold via coren (Pi 4GB to HPC 512GB)
  • Mandatory compaction before P2P: one sorted file per table

Development

make dev       # maturin develop into venv
make test      # cargo test + pytest
make sync      # full pipeline: build + compact + serve

Publishing

Credentials in standard locations:

  • ~/.pypirc (twine)
  • ~/.cargo/credentials.toml (cargo)
make pub               # bump patch, test, build host wheel, upload, tag
make pub V=0.2.0       # explicit version
make pub-all           # all platforms (needs podman for Linux wheels)
make release V=0.2.0   # tag-only (CI builds + publishes)

CI

Codeberg Forgejo Actions. CI runs Rust + Python tests on push/PR. Release workflow builds Linux x86_64 + aarch64 wheels on tag push, publishes to PyPI + crates.io + Codeberg release.

Release files for pmcdb 0.0.3

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

Source distribution (sdist)

Source distribution for pmcdb 0.0.3
File Size Uploaded
pmcdb-0.0.3.tar.gz 108.6 kB Details

Built distributions (wheels)

Table of built distributions (wheels) for pmcdb 0.0.3
File Interpreter ABI Platform
pmcdb-0.0.3-py3-none-win_amd64.whl Python 3 none Windows x86-64 Details
pmcdb-0.0.3-py3-none-manylinux_2_34_x86_64.whl Python 3 none Linux glibc 2.34+ x86-64 Details
pmcdb-0.0.3-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl Python 3 none Linux glibc 2.17+ ARM64 Details

Total release size: 14.5 MB

Release files / pmcdb-0.0.3.tar.gz

Download URL pmcdb-0.0.3.tar.gz
Size 108.6 kB
Tags Source
SHA-256 checksum
How to use checksums
b950243592c419db092579a62d176d76f739a2aa5a269bfb59729413dd7ac18b
BLAKE2b-256 checksum
How to use checksums
a3231accba84817b16af90eb4532d3b4224b449a22631a1229a1e367f001d388
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.11

Release files / pmcdb-0.0.3-py3-none-win_amd64.whl

Download URL pmcdb-0.0.3-py3-none-win_amd64.whl
Size 4.8 MB
Tags Python 3 Windows x86-64
SHA-256 checksum
How to use checksums
2a34f7f60dc2ccfe5e3319e5d45d5fac926a094784b68c4146997c7346f6c7ea
BLAKE2b-256 checksum
How to use checksums
607849d5b14aa4f02582ca11356effca9e24b1c662e9b843ebe1fdfdd263e9cc
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.11

Release files / pmcdb-0.0.3-py3-none-manylinux_2_34_x86_64.whl

Download URL pmcdb-0.0.3-py3-none-manylinux_2_34_x86_64.whl
Size 5.0 MB
Tags Linux glibc 2.34+ x86-64 Python 3
SHA-256 checksum
How to use checksums
930e8e053199e7796e49a773585f992957a3b67d5b1552458598b50e1a44e945
BLAKE2b-256 checksum
How to use checksums
1209d5321fd5893a592cf58eb6b024e4dab7c39e220a98e8f670f8625af1a0ff
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.11

Release files / pmcdb-0.0.3-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl

Download URL pmcdb-0.0.3-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Size 4.5 MB
Tags Linux glibc 2.17+ ARM64 Python 3
SHA-256 checksum
How to use checksums
662980f74264d65db562bbe8f1d80c20151be19dbe7bd07ee675af1723d9cc7d
BLAKE2b-256 checksum
How to use checksums
8127aca2b9c9b843a22e6605e48d66e16db29c43a91f96124847c670e9b28817
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.11

Release history Release notifications | RSS feed

This release

0.0.3 This release

4 release files

0.0.2

4 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