Version: 0.0.3.0
Date: 05-02-2026
A simple utility to help inject, update, and manage YAML-formatted metadata headers and open-source licenses within Python projects.
Note: This is a hobby project built to be as lightweight as possible. It has zero external dependencies and runs entirely on the Python standard library.
The codebase of the too is inside the auto_code_signature folder.
- No Dependencies: Runs out-of-the-box with any standard Python installation.
- Standard Compliance: Injects signatures as module-level docstrings or
#comments, respecting PEP 8. - SPDX Support: Optionally include SPDX-License-Identifiers for license scanning tools.
- Shebang Preservation: Automatically detects
#!lines and inserts headers immediately after them. - Intelligent Detection: Scans files to prevent double-signing by checking for YAML markers (
---). - Flexible Updates: Supports overwriting or merging existing signatures through CLI flags or GUI toggles.
- Batch Processing: Recursively walks through directories while excluding common folders like
.git,venv, and__pycache__.
- Clone the repository:
git clone https://github.com/medlav/codebase-signer.git
cd auto_code_signature- Run it:
Since there are no dependencies to install, you can run the tool immediately using Python. No
pip installor virtual environments required.
The script detects how it is being called. Running without arguments launches a simple GUI, while adding arguments triggers the CLI.
Simply run the script to open the window:
python main.py
GUI Options:
- Directory Browser: Select your project folder.
- Metadata Fields: Define Project Name, Author, and Creation Date.
- Sign Options:
- Force Overwrite: Replaces existing signatures entirely.
- Merge Existing: Updates metadata while preserving the file structure.
- Add SPDX: Includes the standard
SPDX-License-Identifierline. - Use # Comments: Uses comment blocks instead of triple-quoted docstrings.
For quick tasks or automation:
python main.py --path ./my_project --project "My Project" --author "medlav" --license MIT --spdx
| Argument | Description | Default |
|---|---|---|
--path |
Directory containing files to sign | . |
--project |
Name of the project | My Project |
--author |
Author name | medlav |
--license |
License key (MIT, Apache-2.0, etc.) | PRIVATE |
--force-overwrite |
Replace existing signatures | False |
--merge-existing |
Update existing metadata | False |
--spdx |
Include SPDX identifier | False |
--as-comment |
Use # instead of """ |
False |
The tool generates a header structured like this:
# SPDX-License-Identifier: MIT
# Copyright (C) 2026 medlav
"""
---
project: My Project
file: main.py
author: medlav
created: 2026-02-05
license: MIT
---
[Full License Text Appears Here]
"""
import os
# ... rest of codeIf you want to use this as a standalone Windows app, you can convert it using auto-py-to-exe.
- Install the converter:
pip install auto-py-to-exe - Launch it:
auto-py-to-exe - Configuration:
- Script Location: Select
main.py. - Onefile: Select "One File" for a single portable
.exe. - Window Based: Select "Window Based" to hide the console.
- Additional Files: Make sure to add
utils.py,licenses.py, andspdx_licenses.csv.
- Click Convert.
- Inspired by python-license.
- License data sourced from SPDX.