CLI tool to add tags to markdown frontmatter
Project description
tagitmd
CLI tool to add tags to markdown frontmatter.
What it does
tagitmd scans markdown files in a directory and adds tags to their YAML frontmatter. It intelligently handles existing frontmatter, creating it if needed, and can optionally skip files that already have tags. You can also specify the path and disable recursion.
Installation
pip install -e .
Usage
tagitmd TAG [TAG...] [OPTIONS]
Examples
# Add tags to all markdown files in current directory
tagitmd python tutorial
# Add tags to files in a specific directory
tagitmd python --path /path/to/notes
# Preview changes without modifying files
tagitmd python tutorial --dry-run
# Only add tags to files that don't have any tags yet
tagitmd python --only-untagged
# Process only the target directory (not subdirectories)
tagitmd python --no-recursive
Flags
--path, -p
- Type: Directory path
- Default: Current directory (
.) - Description: Directory to process for markdown files
--dry-run
- Type: Flag
- Default: False
- Description: Preview changes without modifying any files. Shows what would be changed.
--only-untagged
- Type: Flag
- Default: False
- Description: Only modify files that don't have any existing tags in their frontmatter
--recursive / --no-recursive
- Type: Boolean flag
- Default: True (recursive)
- Description: Whether to search subdirectories recursively
Development Guide
Setup
Run the setup script to create a virtual environment and install dependencies:
bash setup-dev.sh
Or use Make:
make setup-dev
Manual Setup
If you prefer to set up manually:
# Create virtual environment
python3 -m venv venv
# Activate virtual environment
source venv/bin/activate
# Install package in development mode
pip install -e .
# Install development dependencies
pip install -r requirements.txt
Available Make Commands
make help # Show available commands
make setup-dev # Run setup-dev.sh script
make install-dev # Install package with dev dependencies
make test # Run tests with coverage
make build # Build distribution packages
make lint # Run code quality checks
make clean # Clean build artifacts and venv
Running Tests
make test
Or directly with pytest:
pytest tests/ -v --cov=tagitmd --cov-report=term-missing
Building Distribution
make build
This will create distribution packages in the dist/ directory.
Publishing to PyPI
Prerequisites
-
Register accounts:
- Test PyPI: https://test.pypi.org/account/register/
- Production PyPI: https://pypi.org/account/register/
-
Create API tokens:
- Test PyPI: https://test.pypi.org/manage/account/#api-tokens
- Production PyPI: https://pypi.org/manage/account/#api-tokens
- Set scope to "Entire account" for first upload
-
Configure credentials: Copy
.pypirc.exampleto~/.pypircand add your API tokens:cp .pypirc.example ~/.pypirc chmod 600 ~/.pypirc
Edit
~/.pypircand replace the placeholder tokens with your actual tokens.
Publishing Steps
Test on Test PyPI (Recommended First)
make publish-test
Then test installation:
pip install --index-url https://test.pypi.org/simple/ --no-deps tagitmd
Publish to Production PyPI
make publish
This will:
- Clean previous builds
- Build source and wheel distributions
- Check distribution files for errors
- Prompt for confirmation before uploading
- Upload to PyPI
Manual Publishing (Alternative)
If you prefer manual control:
# Build
python3 -m build
# Check distributions
python3 -m twine check dist/*
# Upload to Test PyPI
python3 -m twine upload --repository testpypi dist/*
# Upload to PyPI
python3 -m twine upload dist/*
Version Management
Update version in both files before publishing:
pyproject.toml(line 7)tagitmd/__init__.py(line 3)
Requirements
- Python 3.8 or higher
- click >= 8.0
- python-frontmatter >= 1.0.0
License
MIT
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 tagitmd-0.1.0.tar.gz.
File metadata
- Download URL: tagitmd-0.1.0.tar.gz
- Upload date:
- Size: 7.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
64bf9bf8e3245c58e6bebde219004ce9f6915abac0395bd60d73cec89ec5b5cd
|
|
| MD5 |
f22c21a9608b53dd6ac651c06d2957ab
|
|
| BLAKE2b-256 |
6815aa0d3f21345746c6d1585a3565633e213f037e5084466f7847190f3fe693
|
File details
Details for the file tagitmd-0.1.0-py3-none-any.whl.
File metadata
- Download URL: tagitmd-0.1.0-py3-none-any.whl
- Upload date:
- Size: 6.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4cf293786f87d1ef4395a6778541d44434f69d36691ab2596cd132d1ec257e45
|
|
| MD5 |
30124f41e504534faba3103c8b1e8fe3
|
|
| BLAKE2b-256 |
e8aca8c2fb94281db222fdf2aa99328ea227d5913bb9163f41c454ca2143f890
|