CLI tool to manage copyright headers in source-code files
Project description
codestamp
Stamp and manage copyright headers across your source-code files.
Built by Medhavee Inc · Author Shardul Kulkarni
Installation
pip install codestamp
Or for local development:
git clone https://github.com/yourusername/codestamp
cd codestamp
pip install -r requirements-dev.txt
pip install -e .
Quick start
- Create a
license.txtin your project root whose first line is your copyright statement:
Copyright (c) 2026 Medhavee Inc. All rights reserved. Proprietary and confidential.
- Run from the project root:
# Add headers to files changed in the last git commit (CI-friendly default)
codestamp
# Add headers to ALL source files in the tree
codestamp --bulk
# Add headers to staged files only
codestamp --staged
# Skip specific files or directories using an exclusion file
codestamp --bulk --exclude .csignore
# Preview without writing anything
codestamp --bulk --dry-run
# Update every file's copyright to a new statement
codestamp update "Copyright (c) 2026 Medhavee Foundation. All rights reserved."
# See all supported file types
codestamp list-types
Commands
| Command | Description |
|---|---|
codestamp |
Process files added/modified in the last git commit (default) |
codestamp --bulk |
Process all source files in the project tree |
codestamp --staged |
Process only currently git-staged files |
codestamp --dry-run |
Preview all actions without writing any files |
codestamp update "<text>" |
Replace old copyright header with new text everywhere |
codestamp list-types |
Show all supported file extensions and comment styles |
Options
| Flag | Default | Description |
|---|---|---|
--license <path> |
license.txt |
Custom path to your license/copyright file |
--exclude <path> |
(none) | Path to an exclusion file (see below) |
--dry-run |
off | Preview mode — no files are written |
Excluding files and directories
Pass --exclude <file> to point codestamp at a plain-text exclusion list. Each line can be a file path, a directory, a glob pattern, or a comment:
# .csignore — paths codestamp should never touch
# Third-party files
vendor/google_utils.py
lib/react_helpers.js
# Entire directories
vendor/
third_party/
node_modules/
# Glob patterns
*.min.js
*.generated.py
Then run:
codestamp --bulk --exclude .csignore
Rules supported per line:
| Pattern | Matches |
|---|---|
vendor/lib.py |
Exact file path |
vendor/ or vendor |
Any file inside that directory |
*.min.js |
Glob matched against the full file path |
# comment |
Ignored |
| (blank line) | Ignored |
Output & status codes
Every file processed is reported with a status icon:
| Icon | Status | Meaning |
|---|---|---|
| ✅ | ADDED |
Copyright header successfully stamped |
| 🔄 | UPDATED |
Existing header replaced with new text |
| ⏭ | SKIPPED |
File already has your copyright — left untouched |
| ➖ | UNSUPPORTED |
File extension not recognised |
| ❌ | ERROR |
Could not read or write the file |
Supported file types
| Style | Extensions |
|---|---|
# comment |
.py .sh .bash .zsh .rb .pl .r .yaml .yml .toml .conf .tf .tfvars |
// comment |
.js .ts .jsx .tsx .java .go .swift .kt .kts .rs .cs .cpp .cc .c .h .hpp .dart .scala .groovy .php |
/* comment */ |
.css .scss .less |
<!-- comment --> |
.html .svelte .vue .xml .svg |
Run codestamp list-types to see the full up-to-date list.
How headers are inserted
- Shebang lines (
#!/usr/bin/env python3) are always respected — the header is inserted on line 2, never before the shebang. - Files that already contain your copyright text are silently skipped.
- The
updatecommand rewriteslicense.txtwith the new header text after updating all files.
Git integration
The default mode (no flags) processes files from the last commit, making it a perfect fit for CI pipelines:
# .github/workflows/copyright.yml
name: Copyright Headers
on: [push]
jobs:
stamp:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 2 # needed so HEAD~1 diff works
- name: Install codestamp
run: pip install codestamp
- name: Stamp new files
run: |
codestamp --exclude .csignore
git diff --quiet || (
git config user.email "bot@ci"
git config user.name "CI Bot"
git commit -am "chore: add copyright headers"
git push
)
Contributing
git clone https://github.com/yourusername/codestamp
cd codestamp
pip install -r requirements-dev.txt
pip install -e .
pytest
Pull requests are welcome! Please open an issue first for larger changes.
License
MIT © Shardul Kulkarni / Medhavee Inc
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 codestamp-0.2.0.tar.gz.
File metadata
- Download URL: codestamp-0.2.0.tar.gz
- Upload date:
- Size: 12.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
32b13cd78d3da13e138732ac708259f400582ba15c8fa4fdfb18365b279ea3ef
|
|
| MD5 |
9169979e5b8846375bf399adbeb82215
|
|
| BLAKE2b-256 |
e136a4f35c62970fcfeb35d164bbd496b787771d0eecdda168f997ac1326b035
|
File details
Details for the file codestamp-0.2.0-py3-none-any.whl.
File metadata
- Download URL: codestamp-0.2.0-py3-none-any.whl
- Upload date:
- Size: 10.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ff4422cc8237fe200f0ec00e84f5657bf6365638d39c1a3e7ddb61505dbd2e40
|
|
| MD5 |
09435f37af004263cfcf14f8b9bc85c4
|
|
| BLAKE2b-256 |
9c2c69a53c7a8439f69901447fd5c29d6943cccf540569165b0782973aca4830
|