searchpubmed
A Python helper‑library for programmatic PubMed work:
- Search – build and run complex boolean queries (E‑Search)
- Link – map PMIDs ↔ PMCIDs (E‑Link)
- Fetch – pull rich article metadata (E‑Fetch / E‑Summary)
- Full‑text – download JATS XML + HTML from PMC
- Analyse – get tidy results as pandas DataFrames
Query‑builder
The package now ships with a lightweight query‑builder and five pre‑tuned strategies for common real‑world‑data searches.
from searchpubmed import build_query, STRATEGY3_OPTS
print(build_query(STRATEGY3_OPTS)[:120] + "…")
# => (("observational" 5 "ehr"[tiab] OR …) AND english[lang] AND ("2010"[dp] : "3000"[dp]))
Create your own QueryOptions:
from searchpubmed import QueryOptions, build_query
opts = QueryOptions(
data_sources=["ehr", "claims"], # synonym keys
design_terms=["observational", "secondary"],
proximity_within=None,
)
print(build_query(opts))
Core features
- Perform complex boolean searches (AND/OR/NOT, phrase, proximity N)
- Batch retrieval of PMIDs and conversion to PMCIDs
- Fetch detailed metadata (title, abstract, authors, journal, date)
- Configurable rate‑limiting to stay within NCBI usage caps
- Results returned as pandas DataFrames for instant analysis
Installation
pip install searchpubmed
License
Apache 2.0 – see the LICENSE file for details.
Metadata
Release files for searchpubmed 0.5.4
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| searchpubmed-0.5.4.tar.gz | 34.5 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| searchpubmed-0.5.4-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 61.9 kB
Release files / searchpubmed-0.5.4.tar.gz
| Download URL | searchpubmed-0.5.4.tar.gz |
|---|---|
| Size | 34.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
9b4c483f1c595b6b3ec679e5b9d2506842b8056a8c82d06b446f887830dac046
|
|
BLAKE2b-256 checksum How to use checksums |
0931972b1e119a7088860fd4b64dac0e45336fb01455a98f0d3aaa59dc2be1e6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.12.9
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on May 22, 2025.
Transparency logRelease files / searchpubmed-0.5.4-py3-none-any.whl
| Download URL | searchpubmed-0.5.4-py3-none-any.whl |
|---|---|
| Size | 27.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
3a3241a355ae1a33150ec728443b1311ec0048e65c0c83846aba3061c754c6fd
|
|
BLAKE2b-256 checksum How to use checksums |
a45030e14af91a4884b4b9e9f63a625839ae74d3abd440a1fb39dffa2b110db4
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.12.9
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on May 22, 2025.
Transparency log