pypubmech
A Python package for fetching and processing PubMed articles with comprehensive metadata extraction and MeSH term support.
Features
- Search PubMed articles by keyword or MeSH terms
- Extract comprehensive article metadata including:
- Title, Abstract, Authors
- Volume, Issue, Journal
- Citations and Links
- MeSH terms
- Export results to CSV
- Compare different sets of PMIDs
Installation
pip install pypubmech
Quick Start
from pypubmech import PubMedClient
# Initialize client
client = PubMedClient(email="your.email@example.com")
# Search by keyword
pmids = client.search_by_keyword("cancer", 100)
# Fetch metadata
client.fetch_article_metadata()
# Export to CSV
client.export_to_csv("cancer_articles.csv")
MeSH Search Example
# Search using MeSH terms
mesh_query = "Neoplasms[MeSH] AND Genetics[MeSH]"
pmids = client.search_by_mesh(mesh_query)
client.fetch_article_metadata()
client.export_to_csv("cancer_genetics.csv")
Development
Setup
- Clone the repository:
git clone https://github.com/yourusername/pypubmech.git
cd pypubmech
- Create a virtual environment:
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
- Install development dependencies:
pip install -e ".[dev]"
Running Tests
pytest tests/
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
License
This project is licensed under the MIT License - see the LICENSE file for details.
Metadata
Release files for pypubmech 0.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| pypubmech-0.1.tar.gz | 4.2 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| pypubmech-0.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 9.0 kB
Release files / pypubmech-0.1.tar.gz
| Download URL | pypubmech-0.1.tar.gz |
|---|---|
| Size | 4.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
36e73463253d723baa863c6bec13186a5eabab3b137d37a251d36626735539d2
|
|
BLAKE2b-256 checksum How to use checksums |
0f774a0e7f4346dc76da68f6fc09d7b6432659a46e5643289b7d9c6a3fcc1cca
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.9.21
|
Release files / pypubmech-0.1-py3-none-any.whl
| Download URL | pypubmech-0.1-py3-none-any.whl |
|---|---|
| Size | 4.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
384af89f08aa8aeae9b0c5db4a931b7d7a67ae92dc8c68ec3cc8a1d4332e1a9c
|
|
BLAKE2b-256 checksum How to use checksums |
be28a7b04985a1c901b43044b2e89c0c46d84b5bf6109a8fbc0aff2bfe5e1a9d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.9.21
|