Automate arXiv paper tracking with LLM-powered metadata extraction and Google Sheets sync.
Project description
arXivFlow 🚀
arXivFlow is a powerful Python-based automation tool designed to streamline the research paper discovery and tracking process. It autonomously fetches metadata from arXiv, performs local AI-driven analysis using Ollama (e.g., Llama 3.2), and synchronizes the results with Google Sheets and local databases.
✨ Features
- Asynchronous API: Fully rewritten with
asynciofor high-performance paper retrieval and PDF processing. - Automated Retrieval: Fetch the latest papers from specific arXiv categories (e.g.,
cs.AI,cs.LG,hep-ph) within any date range. - Local AI Analysis: Uses Ollama models (e.g., Llama 3.2) to extract keywords and contact information (emails/affiliations) directly from PDF text. No cloud API costs or data privacy concerns.
- Intelligent PDF Handling: Automatically downloads PDFs and extracts text for deep analysis. Supports custom storage paths and atomic PDF writes.
- Robust arXiv Requests: Built-in compliance with arXiv's API guidelines (3-second request intervals), paged metadata retrieval, 429 cooldown handling, retry backoff, and duplicate-result cleanup.
- Multi-Format Export: Save your research data to CSV, JSON, Excel, or SQLite for flexible offline analysis.
- Google Sheets Sync: Seamlessly push compiled research data to a shared Google Sheet for team collaboration.
- Type-Safe & Modular: Clean, documented Python code with full type hinting and a class-based architecture.
🛠️ Prerequisites
- Python 3.13+: Ensure you have a modern Python environment.
- Ollama: Install Ollama and download the required model (e.g., Llama 3.2):
ollama pull llama3.2
- Google Cloud Credentials:
- Enable the Google Sheets and Google Drive APIs.
- Create a Service Account and download the JSON key as
credentials.json. - Ensure the service account has 'Editor' permissions on the sheet.
🚀 Installation
From PyPI (Recommended)
pip install arxivflow
From Source (For Development)
-
Clone the repository:
git clone https://github.com/zjzhao/arXivFlow.git cd arXivFlow
-
Set up virtual environment:
python -m venv . source bin/activate # On Windows: Scripts\activate
-
Install dependencies:
pip install -e .
📖 Usage
Quick Start (Async)
import asyncio
import datetime
from arxivflow import arXivFlow
async def main():
# 1. Initialize the flow
flow = arXivFlow(
categories=["cs.AI", "cs.CV"],
ollama_model="llama3.2",
max_results=20,
start_date=datetime.datetime.now() - datetime.timedelta(days=7),
request_timeout=60.0
)
# 2. Fetch data & Extract info (Keywords/Contacts)
df = await flow.get_arxiv_data(download_pdfs=True)
# 3. Save to your preferred formats
flow.save_to_csv("my_research.csv")
flow.save_to_sqlite("research.db")
# 4. Sync with Google Sheets
flow.save_to_google_sheet(
sheet_id="YOUR_SHEET_ID",
credentials_file="credentials.json"
)
# 5. Close the client
await flow.close()
if __name__ == "__main__":
asyncio.run(main())
🧱 Request Stability
arXiv can occasionally return slow responses, rate limits, or temporary service errors. arXivFlow now makes the request path more stable by:
- Fetching arXiv metadata in smaller pages instead of relying on one large request.
- Fetching metadata for all requested categories before starting PDF downloads, which avoids PDF download bursts interfering with the next category query.
- Serializing arXiv requests and preserving the recommended 3-second interval.
- Retrying transient failures (
429,500,502,503,504, timeouts, and network errors) with exponential backoff and jitter. - Applying a longer cooldown after
429rate-limit responses before making the next arXiv request. - Respecting
Retry-Afterheaders when arXiv provides them. - Using a default 60-second request timeout, configurable with
request_timeout. - Writing PDFs to temporary
.partfiles first, then atomically replacing the final file only after validating PDF-like content. - Deduplicating merged output by
arXiv ID.
For especially large date ranges, prefer smaller max_results values or narrower date windows. arXivFlow will page requests internally, but smaller slices are still easier for arXiv and more reliable in practice.
🏗️ Architecture
The project follows a modular structure for easy extension:
src/arxivflow/arxivflow.py: The main orchestrator class (arXivFlow).src/arxivflow/ollama_functions.py: Local LLM interface using the Ollama API.src/arxivflow/arxiv_functions.py: Asynchronous arXiv API interaction layer, including paging, rate limiting, retries, and PDF downloads.src/arxivflow/categories.py: arXiv category definitions.
📜 License
This project is licensed under the MIT License - see the LICENSE file for details.
🤝 Contributing
Contributions are what make the open-source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.
- Fork the Project
- Create your Feature Branch (
git checkout -b feature/AmazingFeature) - Commit your Changes (
git commit -m 'Add some AmazingFeature') - Push to the Branch (
git push origin feature/AmazingFeature) - Open a Pull Request
Project details
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 arxivflow-0.2.2.tar.gz.
File metadata
- Download URL: arxivflow-0.2.2.tar.gz
- Upload date:
- Size: 21.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a9d725220b49731a129b2664004b796411a6af5ae36cab404439c5636ce5d06e
|
|
| MD5 |
1b43a197e0dc53476935d2344ff279b2
|
|
| BLAKE2b-256 |
cc6f62785b6ebee6b0d6a24c8965fcb97b694a1915ccfcd57b5472e2db87ae0e
|
Provenance
The following attestation bundles were made for arxivflow-0.2.2.tar.gz:
Publisher:
python-publish.yml on zjzhao1002/arXivFlow
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
arxivflow-0.2.2.tar.gz -
Subject digest:
a9d725220b49731a129b2664004b796411a6af5ae36cab404439c5636ce5d06e - Sigstore transparency entry: 1633412618
- Sigstore integration time:
-
Permalink:
zjzhao1002/arXivFlow@954b4b26cd2d1ab1012c900c891c1fa5f302c733 -
Branch / Tag:
refs/tags/v0.2.2 - Owner: https://github.com/zjzhao1002
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yml@954b4b26cd2d1ab1012c900c891c1fa5f302c733 -
Trigger Event:
release
-
Statement type:
File details
Details for the file arxivflow-0.2.2-py3-none-any.whl.
File metadata
- Download URL: arxivflow-0.2.2-py3-none-any.whl
- Upload date:
- Size: 16.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
07f2af9b68d8e96ac7a4c61da55f125c74956ab332ade67c6e3fc3f9f16ef5b8
|
|
| MD5 |
b80ad5301338d455a0004e176bf739d2
|
|
| BLAKE2b-256 |
dec47c5dd4f25ec14f4c778f7ef7afdf4977468462f8674dd48eb7aec3a7a636
|
Provenance
The following attestation bundles were made for arxivflow-0.2.2-py3-none-any.whl:
Publisher:
python-publish.yml on zjzhao1002/arXivFlow
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
arxivflow-0.2.2-py3-none-any.whl -
Subject digest:
07f2af9b68d8e96ac7a4c61da55f125c74956ab332ade67c6e3fc3f9f16ef5b8 - Sigstore transparency entry: 1633412629
- Sigstore integration time:
-
Permalink:
zjzhao1002/arXivFlow@954b4b26cd2d1ab1012c900c891c1fa5f302c733 -
Branch / Tag:
refs/tags/v0.2.2 - Owner: https://github.com/zjzhao1002
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yml@954b4b26cd2d1ab1012c900c891c1fa5f302c733 -
Trigger Event:
release
-
Statement type: