This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
IMPORTANT: When making significant changes to the project structure, testing infrastructure, development workflow, or adding new tools/utilities, update this CLAUDE.md file to reflect those changes so future instances of Claude Code have accurate information.
This is a collection of quick utility tools from the CON (Center for Open Neuroscience) team. The repository contains standalone command-line utilities written primarily in Python, with minimal package infrastructure.
Located in bin/show-paths. This is the primary tool in the repository - a Python script that visualizes paths to lines in structured files using indentation-based navigation. It's useful for:
- Navigating complex XML/JSON files (e.g., datacite schemas)
- Finding elements in DICOM dumps (medical imaging data)
- Tracing structure in Python code and other indented formats
Key features:
- Two output formats:
inline(default) andfull-lines - Regex-based search (
-eflag) - Line number filtering (
-nflag) - Optional color output with termcolor (requires termcolor package)
- Reads from stdin or file
Located in bin/run-and-xclip. A bash helper that runs a command and copies its output to X clipboard formatted as a GitHub issue <details> block.
The project uses pytest with tox for testing across multiple Python versions (3.8-3.13):
# Run tests on all Python versions
tox
# Run tests on specific Python version
tox -e py313
# Run tests with verbose output
tox -e py313 -- -v
# Run a specific test
tox -e py313 -- tests/test_show_paths.py::test_show_paths_color_on
# Run tests on multiple versions
tox -e py38,py310,py312
# Run tests directly with pytest (without tox)
pytest -vTest Coverage (22 tests):
- Basic functionality: regex search, line numbers, stdin input
- Format testing: inline vs full-lines format differences
- Color output: verification of ANSI codes with
--color=on,--color=off,--color=auto - Structure parsing: Python nested functions, XML hierarchy, JSON nesting
- Edge cases: missing files, empty files, out-of-range line numbers, case sensitivity
- Help output formatting
Test Conventions:
- All tests should be marked with
@pytest.mark.ai_generatedwhen generated by AI assistants - Test fixtures are located in
tests/data/(sample Python, XML, JSON files) - The
ai_generatedmarker is registered inpyproject.tomlfor filtering/identification - Color tests use
FORCE_COLOR=1environment variable to test ANSI codes in non-TTY environments
The project uses pre-commit hooks with the following checks:
black- Code formatting (max line length 100)isort- Import sortingflake8- Linting (max line length 100)codespell- Spell checking- Standard pre-commit hooks (trailing whitespace, EOF fixer, etc.)
Run pre-commit manually:
pre-commit run --all-filesInstall pre-commit hooks:
pre-commit installRun linting via tox:
tox -e lintGitHub Actions runs codespell on pushes and PRs to main branch.
bin/- Executable utilities (the actual tools)tests/- Test directorytests/data/- Test fixtures (sample Python, XML, JSON files)tests/test_show_paths.py- Tests for show-paths utility
- Configuration files:
pyproject.toml- black, isort, and pytest configurationsetup.cfg- flake8 configuration (max line length 100)tox.ini- tox configuration for testing and linting.pre-commit-config.yaml- pre-commit hooks configuration
- Black formatting with excludes for certain patterns
- isort with black profile
- Line length: 100 characters (enforced by flake8 and black)
- Force sort within sections for imports