📚 My PubMed Package
A Python CLI & library to search PubMed, filter pharmaceutical/biotech papers, and export results to CSV.
🚀 Features
✅ Search PubMed with a query (full syntax supported).
✅ Fetch research papers and extract metadata.
✅ Identify pharmaceutical/biotech-affiliated authors using heuristics.
✅ Save results to CSV or print them in the terminal.
✅ Command-line interface (CLI) for easy execution.
✅ Python module for programmatic use.
✅ Lightweight & easy to install (only depends on requests).
🛠 Installation
Install from PyPI
You can install the package directly from PyPI using:
pip install my-pubmed-package
This installs both the Python library and the CLI tool (get-papers-list).
🎮 CLI Usage
After installation, you can run the CLI tool:
get-papers-list "machine learning in drug discovery" -d -f results.csv
Command Options
| Option | Description |
|---|---|
query |
(Required) The PubMed search query. Full syntax supported. |
-d, --debug |
Enable verbose debug logs. |
-f <filename>, --file <filename> |
Save output to CSV. If omitted, prints results to the console. |
-h, --help |
Display help message. |
Example:
get-papers-list "cancer immunotherapy" -d -f papers.csv
✅ Fetches 50 papers
✅ Filters those with pharma/biotech affiliations
✅ Saves the output in papers.csv
📄 Example Output
CSV File (results.csv) Example:
PubmedID,Title,Publication Date,Non-academic Author(s),Company Affiliation(s),Corresponding Author Email
39941149,"Discovery of TRPV4-Targeting Small Molecules",2025-Feb-06,"Yu Wang","State Key Laboratory of Pathogen and Biosecurity","coen.vanhasselt@lacdr.leidenuniv.nl"
39935140,"Disorganization of Small-World Functional Networks",2025-Feb,"","Department of Radiology, Tongde Hospital of Zhejiang Province",""
39930345,"C-H Aminoalkylation of 5-Membered Heterocycles",2025-Feb-11,"Cyndi Qixin He; Marion H Emmert","Process Research and Development, Merck & Co., Inc.","parthapatrim.roy@gcu.ac.in"
Terminal Output Example (if no -f is provided):
--- Pharma/Biotech Papers ---
PubmedID: 39941149
Title: Discovery of TRPV4-Targeting Small Molecules
Publication Date: 2025-Feb-06
Non-academic Author(s): Yu Wang
Company Affiliation(s): State Key Laboratory of Pathogen and Biosecurity
Corresponding Author Email: coen.vanhasselt@lacdr.leidenuniv.nl
--------------------------------------------------
🖥 Programmatic Usage
You can also use my-pubmed-package as a Python module:
from my_pubmed_package.pubmed_module import search_pubmed_ids, fetch_pubmed_details_bulk
# Search PubMed for PMIDs
pmids = search_pubmed_ids("heart attack therapy", retmax=10, verbose=True)
# Fetch metadata
articles = fetch_pubmed_details_bulk(pmids, verbose=True)
# Print first result
print(articles[0])
🔄 Updating the Package
To update to the latest version:
pip install --upgrade my-pubmed-package
🛠 Troubleshooting
1️⃣ get-papers-list: command not found
If the CLI is not recognized, try running it with:
poetry run get-papers-list "cancer immunotherapy" -d -f results.csv
OR:
python -m my_pubmed_package.cli "cancer immunotherapy" -d -f results.csv
2️⃣ No PMIDs found
Try using broader search queries or visit PubMed to refine.
📜 License
This project is licensed under the MIT License.
🎉 Thank You!
If you find this package useful, star it on GitHub and share it with others! 🚀
Metadata
Release files for my-pubmed-package 0.1.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| my_pubmed_package-0.1.2.tar.gz | 6.1 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| my_pubmed_package-0.1.2-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 13.7 kB
Release files / my_pubmed_package-0.1.2.tar.gz
| Download URL | my_pubmed_package-0.1.2.tar.gz |
|---|---|
| Size | 6.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
47f459c6359a4c1f24826a802e26e27e245bdc830ef65cfc4bf6fbf8b270beb6
|
|
BLAKE2b-256 checksum How to use checksums |
f9a83223176a7595b8d06ecab3600e69f27f48c462274a7cbf3ae247f4f6f62a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/2.0.1 CPython/3.11.8 Darwin/23.5.0
|
Release files / my_pubmed_package-0.1.2-py3-none-any.whl
| Download URL | my_pubmed_package-0.1.2-py3-none-any.whl |
|---|---|
| Size | 7.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
eccfbe469e5794519cd33271cea887b9caa617607bdf258614a44277650773e6
|
|
BLAKE2b-256 checksum How to use checksums |
1b80981cbbe7f1da337a542dd689b61e46f65331837b2dc5848829d8577a9560
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/2.0.1 CPython/3.11.8 Darwin/23.5.0
|
Security for my-pubmed-package 0.1.2
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.