Enterprise-grade file header tool that injects repo-relative path headers into Python files
Project description
autoheader
autoheader is an enterprise-grade CLI tool for Python projects that automatically adds or refreshes file headers containing each file’s repo-relative path.
This helps developers quickly identify file origins, improves navigation in large codebases, and standardizes file structure across teams.
Example of what autoheader produces:
# src/utils/parser.py
from __future__ import annotations
Perfect for monorepos, multi-module architectures, enterprise Python codebases, and any project where file traceability matters.
---
✅ Features
Automatic repository root detection
Uses multiple project markers (pyproject.toml, README, .gitignore, etc.) to confirm safe execution.
Idempotent header insertion
Runs repeatedly with no duplicates. If the header already matches the file’s path, it simply skips.
Override mode (--override)
Rewrites outdated or incorrect headers when files are moved or refactored.
Dry-run by default
No accidental writes. Shows exactly what will change.
Backup support (--backup)
Creates .bak files for full rollback safety.
Depth guard (--depth)
Prevents accidental traversal of deep or unwanted paths in large repos.
Exclusion system (--exclude)
Automatically avoids dangerous directories like .git, .github, virtualenvs, build folders, etc.
Verbose reporting (--verbose)
See exactly which files were added, skipped, or overridden.
Installable via PyPI with zero configuration
Just pip install autoheader.
---
📦 Installation
Install from PyPI:
pip install autoheader
Or install from source:
pip install git+https://github.com/dhruv13x/autoheader
---
🚀 Quick Start
Run inside a Python project:
autoheader
This performs a safe dry-run and shows what would be changed.
Apply changes for real:
autoheader --no-dry-run
Override all headers (useful after moving files):
autoheader --override --no-dry-run
Create backups for safety:
autoheader --backup --no-dry-run
---
📘 Advanced Usage
✅ Specify max directory depth
autoheader --depth 3 --no-dry-run
Avoids walking deep directory trees.
---
✅ Exclude additional paths
autoheader --exclude tests --exclude build
Built-in exclusions include:
.git/
.github/
virtualenvs
build artifacts
---
✅ Force yes in CI environments
autoheader --yes --no-dry-run
Skips root detection prompts.
---
📂 Example Output
Dry-run:
DRY ADD: src/utils/parser.py
DRY ADD: src/models/user.py
DRY ADD: api/routes/index.py
Summary: added=3, overridden=0, skipped_ok=14, skipped_excluded=5.
NOTE: this was a dry run. Use --no-dry-run to apply changes.
Real run:
ADD: src/utils/parser.py
OVERRIDE: src/core/config.py
SKIP (ok): src/api/__init__.py
Summary: added=1, overridden=1, skipped_ok=22, skipped_excluded=5.
---
🛡 Safety & Guarantees
autoheader is built with enterprise safety in mind:
Never touches files without your permission
Never rewrites headers unless explicitly told
Never runs destructive operations
Clearly separates real execution from dry-run
Designed for CI/CD environments
OIDC-secure PyPI publishing
---
🔧 Development
Install in editable mode:
git clone https://github.com/dhruv13x/autoheader
cd autoheader
pip install -e .[dev]
Run tests:
pytest
Run linter & formatter:
ruff check .
black .
---
🤝 Contributing
Pull requests are welcome.
If proposing large changes, open an issue first to discuss design and approach.
---
🐛 Reporting Issues
Please open issues here:
https://github.com/dhruv13x/autoheader/issues
Include:
What command you ran
Error output
Your Python version
OS / environment information
---
📜 License
MIT © dhruv13x
---
⭐ Support the Project
If this tool helped you, consider giving the repo a star:
https://github.com/dhruv13x/autoheader
Stars help visibility and future development!
---
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 autoheader-0.2.0.tar.gz.
File metadata
- Download URL: autoheader-0.2.0.tar.gz
- Upload date:
- Size: 12.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2d9a2c505e002768bd86ebfda52aff7fe4f8ebf727539a214d1db4d22deded2c
|
|
| MD5 |
0c08f4144af774bdebcbd7ebcedcf78a
|
|
| BLAKE2b-256 |
031baf5b76f3ab9a0bcef4d1cca0f9c31ee8cc1a0a3896fb69c98c7fcdf1ff7b
|
Provenance
The following attestation bundles were made for autoheader-0.2.0.tar.gz:
Publisher:
publish.yml on dhruv13x/autoheader
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
autoheader-0.2.0.tar.gz -
Subject digest:
2d9a2c505e002768bd86ebfda52aff7fe4f8ebf727539a214d1db4d22deded2c - Sigstore transparency entry: 685792565
- Sigstore integration time:
-
Permalink:
dhruv13x/autoheader@7ea2074539f579d80281d327514183090be10cf8 -
Branch / Tag:
refs/tags/v0.2.0 - Owner: https://github.com/dhruv13x
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@7ea2074539f579d80281d327514183090be10cf8 -
Trigger Event:
push
-
Statement type:
File details
Details for the file autoheader-0.2.0-py3-none-any.whl.
File metadata
- Download URL: autoheader-0.2.0-py3-none-any.whl
- Upload date:
- Size: 13.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5d2cf86703fb7fae21295614f1e890e348bc019cb6929d126ef18777afbc6a22
|
|
| MD5 |
f9115ea1be0bbad9daeebfc446adb438
|
|
| BLAKE2b-256 |
83df44f6097de95aa3705b218c657677f3c78e39797daa16f9a595318dc5754a
|
Provenance
The following attestation bundles were made for autoheader-0.2.0-py3-none-any.whl:
Publisher:
publish.yml on dhruv13x/autoheader
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
autoheader-0.2.0-py3-none-any.whl -
Subject digest:
5d2cf86703fb7fae21295614f1e890e348bc019cb6929d126ef18777afbc6a22 - Sigstore transparency entry: 685792567
- Sigstore integration time:
-
Permalink:
dhruv13x/autoheader@7ea2074539f579d80281d327514183090be10cf8 -
Branch / Tag:
refs/tags/v0.2.0 - Owner: https://github.com/dhruv13x
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@7ea2074539f579d80281d327514183090be10cf8 -
Trigger Event:
push
-
Statement type: