Lint URLs (mostly for teaxyz/chai, but hopefully other uses too)
- Ignores protocol (http, https, etc.)
- Normalizes GitHub URLs to owner/repo
- Removes query strings and fragments
- Lowercases domains and removes www
from permalint import normalize_url
url = "https://github.com/user/repo?utm_source=foo#readme"
print(normalize_url(url)) # Output: github.com/user/repo- Install dependencies:
uv sync - Run tests:
uv run pytest - Lint:
uv run ruff check . && uv run ruff format . - Type check:
uv run ty check src/
guess-canonical-urlto guess the correct URL based on a passed list of URLs
Requires the COVERALLS_REPO_TOKEN to be set in a .env file
export $(grep -v '^#' .env | xargs)
uv run coverallsuv run ruff check . --fix --unsafe-fixes
uv run format .