Automates creation of file headers for source code.
Project description
Watchdoc
Watchdoc is a simple tool to help automate the creation of headers for source code files written in Python.
Installation
Watchdoc can be installed from PyPi using pip.
pip install watchdoc-cli
Setup
Create a watchdoc.json file inside your project root. Watchdoc reads this file to determine
your configurations for each extension. Each extension is its own object and
Inside each extension, there are three main parts that can optionally be configured.
"comment": This tells Watchdoc which comment string to use for your language."copyright": This is a list of strings that Watchdoc will place at the top of the file."fields": This is an object that contains your defined header information.
Watchdoc also provides a few format specifiers for inserting date information:
%Y: The current year%m: The current month%d: The current day%D: The current date formatted asYYYY-mm-dd
An example watchdoc.json for a project using Python and JavaScript may look like this.
{
".py": {
"comment": "#",
"copyright": [
"Copyright (c) %Y [Name Here]. All rights reserved."
],
"fields": {
"Author": "John Doe",
"Created": "%D",
"Description": ""
}
},
".js": {
"comment": "//",
"copyright": [
"Copyright (c) %Y [Name Here]. All rights reserved."
]
}
}
The following watchdoc.json will produce these headers
(with the current date in place of these example values):
When a python file is created:
# Copyright (c) 2025 [Name Here]. All rights reserved.
#
# Author: John Doe
# Created: 2025-1-1
# Description:
When a javascript file is created:
// Copyright (c) 2025 [Name Here]. All rights reserved.
Again, "comment", "copyright", and "fields" are optional so feel free to only
add the ones that you need for your project.
Running
After you've configured your watchdoc.json file, just run
watchdoc
in a terminal at the root of your project. It will detect when a file is created, and if it's part of your config, then the header will be created.
Future plans
Here are some potential features that I might add:
- Templates that allow for prompting each contributor for their unique information.
- More format specifiers if they seem needed.
If you're interested in implementing one of these features, or something else, feel free to make a PR.
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 watchdoc_cli-1.0.3.tar.gz.
File metadata
- Download URL: watchdoc_cli-1.0.3.tar.gz
- Upload date:
- Size: 5.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3441d4afa0c6bb0471e7afff8032a9db1d4134285cee56b62e06396d592297f1
|
|
| MD5 |
69df8c5bacfca404e0de7acd4eb8d7f7
|
|
| BLAKE2b-256 |
e699c43bcaeeee0c41920666a84f66558813288b2ab8f41e1031e2380316d60a
|
File details
Details for the file watchdoc_cli-1.0.3-py3-none-any.whl.
File metadata
- Download URL: watchdoc_cli-1.0.3-py3-none-any.whl
- Upload date:
- Size: 6.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0056fce4c02022f28d4b091d1d6fc893892e32a0865fa41d36d7f5f95a9ca9b9
|
|
| MD5 |
7ce0b6a460a9663a389cb6fa082ef115
|
|
| BLAKE2b-256 |
14395a0570f273f088bc1f76dfd75d9a3a3b62bbf927017142d2decbecf3ab95
|