Environment:Testtimescaling Testtimescaling github io Python 3 Runtime
| Knowledge Sources | |
|---|---|
| Domains | Infrastructure, Data_Retrieval |
| Last Updated | 2026-02-14 00:00 GMT |
Overview
Python 3.x runtime environment with the requests library, required for executing the arXiv citation fetching script.
Description
The update_arxiv_citations.py script requires a Python 3 interpreter with access to the requests HTTP library and the standard library modules json. The script uses f-strings (Python 3.6+), type hints in function signatures (Python 3.5+), and the requests.get() API with timeout parameter.
On the GitHub Actions runner (ubuntu-latest), Python 3 and requests are pre-installed. When running locally for development or testing, the requests package must be installed manually.
Usage
This environment is required whenever the Automated Citation Tracking workflow runs the citation update script. It is invoked by the workflow step:
- name: Update citation counts
run: |
python .github/scripts/update_arxiv_citations.py
System Requirements
| Category | Requirement | Notes |
|---|---|---|
| Language | Python >= 3.6 | f-strings and type hints used in the script |
| Network | Outbound HTTPS to api.semanticscholar.org |
Required for citation count retrieval |
| Filesystem | Write access to repository root | Writes arxiv_citations.json to the working directory
|
Dependencies
Python Packages
requests(any version; used forrequests.get()withtimeoutparameter)json(standard library; used forjson.dump())
Credentials
No credentials are required by the Python script itself. The Semantic Scholar API is accessed without authentication (public endpoint). However, the surrounding workflow context requires:
secrets.GITHUB_TOKEN: Used by the git commit/push step after the script runs (not by the script itself).
Quick Install
# For local development/testing:
pip install requests
# On GitHub Actions ubuntu-latest, requests is pre-installed.
# No setup step is needed in the workflow.
Code Evidence
Import statements from .github/scripts/update_arxiv_citations.py:L1-2:
import requests
import json
Python 3.6+ f-string usage from .github/scripts/update_arxiv_citations.py:L9:
url = f"https://api.semanticscholar.org/graph/v1/paper/ARXIV:{arxiv_id}?fields=citationCount"
Type hint usage from .github/scripts/update_arxiv_citations.py:L4:
def fetch_arxiv_citation_count(arxiv_id: str) -> int:
Workflow invocation from .github/workflows/update_citations.yml:L28-29:
- name: Update citation counts
run: |
python .github/scripts/update_arxiv_citations.py
Common Errors
| Error Message | Cause | Solution |
|---|---|---|
ModuleNotFoundError: No module named 'requests' |
requests not installed in the Python environment |
Run pip install requests
|
SyntaxError: invalid syntax (at f-string) |
Running with Python 2.x or Python < 3.6 | Use Python 3.6 or higher |
[Warning] Failed to fetch citation for ArXiv:... |
Network error or API unavailability | Script handles this gracefully, returns 0. Check network access to api.semanticscholar.org
|
Compatibility Notes
- Python 2 incompatibility: The script uses f-strings and type hints, which are not available in Python 2.x. Ensure the
pythoncommand resolves to Python 3. - No virtual environment required: The script has a single external dependency (
requests) and does not conflict with other packages. - Offline mode: The script will not crash without network access; it catches all exceptions and returns 0 for any failed API call.