# Clone the repo
git clone git@github.com:johnzfitch/pacer-cli.git
cd pacer-cli
# Create virtual environment
python -m venv .venv
source .venv/bin/activate
# Install with dev dependencies
pip install -e '.[dev,full]'
# Run tests
pytest
# Lint
ruff check src/src/pacer_cli/
__init__.py
cli.py # Click CLI commands
config.py # PacerConfig, credentials
auth.py # PACER authentication, TOTP
downloader.py # DocketDownloader, DocumentDownloader
pcl.py # PACER Case Locator REST client
parser.py # Fast selectolax HTML parser
reader.py # BeautifulSoup parser, batch CSV
docket_types.py # ParsedDocket dataclasses
courts.py # Court ID mappings
models.py # Pydantic API models
errors.py # Error catalog (v0.2)
selection.py # Interactive selection (v0.2)
data/
court-lookup.json # Federal court data
CLI commands go in cli.py. Use Click's group/command pattern:
@cli.group()
def mygroup():
"""Group description."""
pass
@mygroup.command("subcommand")
@click.argument("arg")
@click.option("--flag", is_flag=True)
@click.pass_context
def my_command(ctx, arg: str, flag: bool):
"""Command description.
\b
Examples:
pacer mygroup subcommand foo
pacer mygroup subcommand bar --flag
"""
config: PacerConfig = ctx.obj["config"]
# ImplementationUse Rich for output:
console.print()for stdouterr_console.print()for stderrPanel()for boxed contentTable()for tabular dataProgress()for spinners
# Run all tests
pytest
# Run with coverage
pytest --cov=pacer-cli
# Run specific test
pytest tests/test_parser.py -v
# Run tests matching pattern
pytest -k "test_parse"- Python 3.10+ with type hints
- Line length: 100 chars
- Format: ruff
- Docstrings: Google style
# Check style
ruff check src/
# Fix auto-fixable issues
ruff check src/ --fixThe parser uses selectolax (C extension) for speed. If selectolax unavailable, falls back to regex. BeautifulSoup is optional ([full] extra).
Benchmark on 300KB docket HTML:
- selectolax: ~5ms
- BeautifulSoup: ~500ms
- CSO login at
https://pacer.uscourts.gov/pscof/cso/login - Returns
PacerSessioncookie - MFA via TOTP (RFC 6238)
- Base:
https://pcl.uscourts.gov/pcl-public-api/rest - Search:
POST /cases/find,POST /parties/find - Pagination: 54 results per page
- Cost: $0.10 per page
- URLs like
https://ecf.{court}.uscourts.gov/doc1/{id} - Requires authenticated session
- Returns PDF or receipt page
- Update version in
pyproject.tomlandsrc/pacer_cli/__init__.py - Update CHANGELOG.md
- Commit:
git commit -m "chore: release v0.x.x" - Push:
git push origin master - Create a GitHub release — the publish workflow fires automatically on release
bug- Something brokenenhancement- New featureux- User experience improvementdocs- Documentationblocked- Waiting on external dependency