Skip to main content

Reference Renamer

Python 3.8+ License: MIT Status: Active

CLI tool for standardizing academic article filenames using metadata extraction and verification.

Features

  • Automatic Renaming: Renames academic articles to a standardized format (Author_Year_FiveWordTitle.ext)
  • Multiple Format Support: Handles PDF, TXT, and other document formats
  • Metadata Enrichment: Uses arXiv, Semantic Scholar, and LLM processing to verify and enrich document metadata
  • Citation Management: Maintains a BibTeX database of processed articles
  • Accessibility Focused: Clear output formats and screen reader support
  • Detailed Logging: Tracks all file operations

Installation

System Dependencies

Required for PDF processing with OCR:

# Ubuntu/Debian
sudo apt-get install tesseract-ocr poppler-utils

# macOS
brew install tesseract poppler

# Windows
# Install Tesseract from: https://github.com/UB-Mannheim/tesseract/wiki
# Install Poppler from: https://github.com/oschwartz10612/poppler-windows/releases

Note: OCR is only used as a fallback when PDFs contain no extractable text. If you only process text-based PDFs, these dependencies are optional.

Python Installation

  1. Clone the repository:
git clone https://github.com/lukeslp/reference-renamer.git
cd reference-renamer
  1. Create and activate a virtual environment:
python -m venv venv
source venv/bin/activate  # or `venv\Scripts\activate` on Windows
  1. Install dependencies:
pip install -r requirements.txt

Ollama (Optional)

Ollama provides local LLM processing for enhanced metadata extraction. It is optional - the tool works without it using arXiv and Semantic Scholar APIs.

If you want to use Ollama:

# Install Ollama from https://ollama.ai
ollama run drummer-knowledge

Without Ollama, the tool will:

  • Skip LLM-based extraction
  • Fall back to arXiv and Semantic Scholar for metadata
  • Still function correctly for most academic papers

Usage

Basic Usage

# Process a single directory
reference-renamer /path/to/papers

# Process recursively with dry run
reference-renamer --recursive --dry-run /path/to/papers

# Generate citations only
reference-renamer --citations-only /path/to/papers

Configuration

Create a config.yaml file in your working directory:

processing:
  supported_extensions:
    - .pdf
    - .txt
  recursive: true
  max_title_words: 5

apis:
  semantic_scholar:
    enabled: true
    timeout: 30
  arxiv:
    enabled: true
    max_results: 3

logging:
  level: INFO
  format: "%(asctime)s - %(name)s - %(levelname)s - %(message)s"

Output

The tool generates:

  1. Renamed files in the specified format
  2. A CSV log of all operations (rename_log.csv)
  3. A BibTeX database of citations (citations.bib)

Accessibility Features

  • Screen reader-friendly output formats
  • High contrast CLI interface
  • Clear error messages and status updates
  • Configurable output formats

Development

Setting up the Development Environment

  1. Install development dependencies:
pip install -r requirements-dev.txt
  1. Install pre-commit hooks:
pre-commit install

Running Tests

# Run all tests
pytest

# Run with coverage
pytest --cov=reference_renamer

# Run specific test file
pytest tests/test_file_processor.py

Code Style

This project uses:

  • Black for code formatting
  • isort for import sorting
  • flake8 for linting
  • mypy for type checking

Run the full suite:

# Format code
black .
isort .

# Check types
mypy .

# Lint
flake8

Contributing

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes
  4. Run tests and linting
  5. Submit a pull request

Please ensure your PR:

  • Includes tests for new features
  • Updates documentation as needed
  • Follows the project's code style
  • Includes a clear description of changes

License

This project is licensed under the MIT License. The full license text is included in the source distribution as the LICENSE file.

Acknowledgments

Support

For support, please:

  1. Check the documentation in this README
  2. Search existing issues
  3. Create a new issue if needed

What's New

This refactor archives old helpers, adds example snippets, and includes new funding links.

Credits & Support

Metadata

Release files for reference-renamer 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for reference-renamer 0.1.1
File Size Uploaded Provenance
reference_renamer-0.1.1.tar.gz 35.7 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for reference-renamer 0.1.1
File Interpreter ABI Platform
reference_renamer-0.1.1-py3-none-any.whl Python 3 none any Details

Total release size: 63.6 kB

Release files / reference_renamer-0.1.1.tar.gz

Download URL reference_renamer-0.1.1.tar.gz
Size 35.7 kB
Tags Source
SHA-256 checksum
How to use checksums
d73b849c1c40f19646bcef314daae4c9a3a02b9d9a1d7a288fd230083ce13f86
BLAKE2b-256 checksum
How to use checksums
056aab38d8b9eba82ad4b1a405e6aac34c95d01970b5c72e6199bf7ec2467945
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.10.12

Release files / reference_renamer-0.1.1-py3-none-any.whl

Download URL reference_renamer-0.1.1-py3-none-any.whl
Size 27.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
6881c1a804819718e468dc1c8a634178dd04d1a2e96fc2d7f4356eaa64a10705
BLAKE2b-256 checksum
How to use checksums
5f645c8d840a6cb5e3ca6bfc20895fa0e87d5e1e2fafe6ae6a91fa8118106744
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.10.12

Security for reference-renamer 0.1.1

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.

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page