A typed Python module and CLI to fetch PubMed papers affiliated with pharma/biotech companies.
Project description
📚 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! 🚀
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file my_pubmed_package-0.1.2.tar.gz.
File metadata
- Download URL: my_pubmed_package-0.1.2.tar.gz
- Upload date:
- Size: 6.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/2.0.1 CPython/3.11.8 Darwin/23.5.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
47f459c6359a4c1f24826a802e26e27e245bdc830ef65cfc4bf6fbf8b270beb6
|
|
| MD5 |
1e97a257f75125f55b6c99a5ec850d5e
|
|
| BLAKE2b-256 |
f9a83223176a7595b8d06ecab3600e69f27f48c462274a7cbf3ae247f4f6f62a
|
File details
Details for the file my_pubmed_package-0.1.2-py3-none-any.whl.
File metadata
- Download URL: my_pubmed_package-0.1.2-py3-none-any.whl
- Upload date:
- Size: 7.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/2.0.1 CPython/3.11.8 Darwin/23.5.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
eccfbe469e5794519cd33271cea887b9caa617607bdf258614a44277650773e6
|
|
| MD5 |
a64167a743d4fa3a28b922bccccc0d55
|
|
| BLAKE2b-256 |
1b80981cbbe7f1da337a542dd689b61e46f65331837b2dc5848829d8577a9560
|