Installation¶
path-comment-hook can be installed in several ways depending on your preferred Python package manager and use case.
Requirements¶
- Python 3.8 or higher
- Works on Linux, macOS, and Windows
Installation Methods¶
pip (Recommended)¶
The simplest way to install path-comment-hook:
This installs the tool globally and makes the path-comment-hook
command available in your terminal.
pipx (Isolated Installation)¶
For an isolated installation that won't interfere with other Python packages:
# Install pipx if you don't have it
pip install pipx
# Install path-comment-hook with pipx
pipx install path-comment-hook
Why pipx?
pipx installs Python applications in isolated environments, preventing dependency conflicts while keeping the command globally available.
Poetry (Development Projects)¶
For projects using Poetry, add as a development dependency:
# Add to dev dependencies
poetry add --group dev path-comment-hook
# Or if using older Poetry versions
poetry add --dev path-comment-hook
Then run with:
From Source (Development)¶
To install the latest development version:
# Clone the repository
git clone https://github.com/Shorzinator/path-comment-hook.git
cd path-comment-hook
# Install with pip
pip install -e .
# Or with Poetry
poetry install
Verify Installation¶
After installation, verify it's working:
You should see output like:
Pre-commit Installation¶
Most users will want to use path-comment-hook as a pre-commit hook. This doesn't require installing the package directly:
# .pre-commit-config.yaml
repos:
- repo: https://github.com/Shorzinator/path-comment-hook
rev: v0.3.0 # Use the latest version
hooks:
- id: path-comment
Then install the hook:
Pre-commit vs Direct Installation
When using pre-commit, the tool is automatically installed in an isolated environment. You don't need to install it separately unless you want to use it directly from the command line.
Platform-Specific Notes¶
macOS¶
If you're using Homebrew's Python:
Windows¶
On Windows, you might need to use:
# Command Prompt
python -m pip install path-comment-hook
# PowerShell
py -m pip install path-comment-hook
Linux¶
Most Linux distributions work with the standard pip installation. For Ubuntu/Debian:
# Install pip if not available
sudo apt update
sudo apt install python3-pip
# Install path-comment-hook
pip3 install path-comment-hook
Docker¶
You can also use path-comment-hook in a Docker container:
FROM python:3.11-slim
RUN pip install path-comment-hook
# Your application code here
COPY . /app
WORKDIR /app
# Run path-comment-hook
RUN path-comment-hook --all
Troubleshooting¶
Command Not Found¶
If you get "command not found" after installation:
- Check PATH: Make sure Python's scripts directory is in your PATH
- Use full path: Try
python -m path_comment
instead - Virtual environment: Activate your virtual environment if you installed there
Permission Errors¶
On Unix systems, if you get permission errors:
# Install for current user only
pip install --user path-comment-hook
# Or use sudo (not recommended)
sudo pip install path-comment-hook
Version Conflicts¶
If you have dependency conflicts:
# Use pipx for isolated installation
pipx install path-comment-hook
# Or create a virtual environment
python -m venv venv
source venv/bin/activate # Windows: venv\Scripts\activate
pip install path-comment-hook
What's Next?¶
Now that you have path-comment-hook installed:
- Quick Start - Run your first path comment operation
- Pre-commit Setup - Integrate with your workflow
- Configuration - Customize for your project