Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
"customizations": {
"vscode": {
"extensions": [
"astral-sh.ty",
"charliermarsh.ruff",
"dorzey.vscode-sqlfluff",
"exiasr.hadolint",
Expand Down
2 changes: 1 addition & 1 deletion .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ pytest-coverage.txt
assets
LICENSE
noxfile.py
pyrightconfig.json
README.md
ruff.toml
tests
ty.toml
2 changes: 1 addition & 1 deletion .github/labeler.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
documentation:
- changed-files:
- any-glob-to-any-file: "docs/**"
- any-glob-to-any-file: "**/*.md"

feature:
- head-branch: ["^feature/"]
Expand Down
9 changes: 0 additions & 9 deletions .github/workflows/devcontainer.yml
Original file line number Diff line number Diff line change
@@ -1,16 +1,7 @@
name: Devcontainer

on:
push:
branches: [main]
paths:
- ".devcontainer/docker-compose.yml"
- ".devcontainer/Dockerfile"
- ".github/workflows/devcontainer.yml"
- ".python-version"

pull_request:
branches: [main]
paths:
- ".devcontainer/docker-compose.yml"
- ".devcontainer/Dockerfile"
Expand Down
11 changes: 0 additions & 11 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
@@ -1,18 +1,7 @@
name: Docker

on:
push:
branches: [main]
paths:
- ".github/workflows/docker.yml"
- "**.py"
- ".dockerignore"
- ".python-version"
- "pyproject.toml"
- "uv.lock"

pull_request:
branches: [main]
paths:
- ".github/workflows/docker.yml"
- "**.py"
Expand Down
14 changes: 0 additions & 14 deletions .github/workflows/format.yml
Original file line number Diff line number Diff line change
@@ -1,21 +1,7 @@
name: Format

on:
push:
branches: [main]
paths:
- ".github/actions/setup-python-with-uv/action.yml"
- ".github/workflows/format.yml"
- "**.py"
- "**.sql"
- ".python-version"
- ".sqlfluff"
- "pyproject.toml"
- "ruff.toml"
- "uv.lock"

pull_request:
branches: [main]
paths:
- ".github/actions/setup-python-with-uv/action.yml"
- ".github/workflows/format.yml"
Expand Down
1 change: 0 additions & 1 deletion .github/workflows/gh-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ on:
- "uv.lock"

pull_request:
branches: [main]
paths:
- ".github/actions/setup-git-config/action.yml"
- ".github/actions/setup-python-with-uv/action.yml"
Expand Down
35 changes: 10 additions & 25 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -1,22 +1,7 @@
name: Lint

on:
push:
branches: [main]
paths:
- ".github/actions/setup-python-with-uv/action.yml"
- ".github/workflows/lint.yml"
- "**.py"
- "**.sql"
- ".python-version"
- ".sqlfluff"
- "pyproject.toml"
- "pyrightconfig.json"
- "ruff.toml"
- "uv.lock"

pull_request:
branches: [main]
paths:
- ".github/actions/setup-python-with-uv/action.yml"
- ".github/workflows/lint.yml"
Expand All @@ -25,12 +10,12 @@ on:
- ".python-version"
- ".sqlfluff"
- "pyproject.toml"
- "pyrightconfig.json"
- "ruff.toml"
- "ty.toml"
- "uv.lock"

jobs:
pyright:
ruff:
runs-on: ubuntu-latest

steps:
Expand All @@ -40,10 +25,10 @@ jobs:
- name: Setup Python with uv
uses: ./.github/actions/setup-python-with-uv

- name: Lint by Pyright
run: uv run nox -s lint -- --pyright
- name: Lint by Ruff
run: uv run nox -s lint -- --ruff

ruff:
sqlfluff:
runs-on: ubuntu-latest

steps:
Expand All @@ -53,10 +38,10 @@ jobs:
- name: Setup Python with uv
uses: ./.github/actions/setup-python-with-uv

- name: Lint by Ruff
run: uv run nox -s lint -- --ruff
- name: Lint by SQLFluff
run: uv run nox -s lint -- --sqlfluff

sqlfluff:
ty:
runs-on: ubuntu-latest

steps:
Expand All @@ -66,5 +51,5 @@ jobs:
- name: Setup Python with uv
uses: ./.github/actions/setup-python-with-uv

- name: Lint by SQLFluff
run: uv run nox -s lint -- --sqlfluff
- name: Lint by ty
run: uv run nox -s lint -- --ty
1 change: 0 additions & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ on:
- "uv.lock"

pull_request:
branches: [main]
paths:
- ".github/actions/setup-python-with-uv/action.yml"
- ".github/workflows/test.yml"
Expand Down
8 changes: 8 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,14 @@ repos:
name: Ruff format
description: "Run 'ruff format' for extremely fast Python formatting"

- repo: local
hooks:
- id: ty
name: ty check
entry: uv run ty check
language: python
types: [python]

- repo: https://github.com/hadolint/hadolint
rev: v2.12.0
hooks:
Expand Down
2 changes: 1 addition & 1 deletion .vscode/cspell.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
"dmypy",
"dockerfiles",
"donotpresent",
"dorzey",
"exiasr",
"fastapi",
"fontawesome",
Expand Down Expand Up @@ -79,7 +80,6 @@
"pypa",
"pypackages",
"pyproject",
"pyrightconfig",
"pytest",
"pythondontwritebytecode",
"pythonpath",
Expand Down
2 changes: 1 addition & 1 deletion .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"recommendations": [
"astral-sh.ty",
"charliermarsh.ruff",
"codezombiech.gitignore",
"dorzey.vscode-sqlfluff",
Expand All @@ -9,7 +10,6 @@
"mosapride.zenkaku",
"ms-azuretools.vscode-docker",
"ms-python.python",
"ms-python.vscode-pylance",
"ms-toolsai.jupyter",
"ms-vscode-remote.remote-containers",
"njpwerner.autodocstring",
Expand Down
1 change: 1 addition & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
},
"notebook.formatOnSave.enabled": true,
"python.defaultInterpreterPath": "/home/vscode/.venv/bin/python",
"python.languageServer": "None",
"python.testing.autoTestDiscoverOnSaveEnabled": false,
"python.testing.pytestEnabled": true,
"python.testing.pytestArgs": [
Expand Down
36 changes: 16 additions & 20 deletions CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,31 +51,28 @@ uv run nox -s fmt -- --sqlfluff
# Format both Python and SQL
uv run nox -s fmt -- --ruff --sqlfluff

# Lint with both Pyright and Ruff
uv run nox -s lint -- --pyright --ruff

# Lint with all tools (Pyright, Ruff, SQLFluff)
uv run nox -s lint -- --pyright --ruff --sqlfluff

# Lint with Pyright only
uv run nox -s lint -- --pyright
# Lint with all tools (Ruff, SQLFluff, ty)
uv run nox -s lint -- --ruff --sqlfluff --ty

# Lint with Ruff only
uv run nox -s lint -- --ruff

# Lint SQL files only
uv run nox -s lint -- --sqlfluff

# Lint with ty only
uv run nox -s lint -- --ty

# Run Ruff directly
uv run ruff check . --fix
uv run ruff format .

# Run Pyright directly
uv run pyright

# Run SQLFluff directly
uv run sqlfluff lint .
uv run sqlfluff fix .

# Run ty directly
uv run ty check
```

### Pre-commit Hooks
Expand Down Expand Up @@ -170,10 +167,9 @@ Tests in `tests/tools/` mirror the package structure:
- Target Python: 3.14
- Per-file ignores for test files

**Pyright (pyrightconfig.json)**:
- Type checking mode: standard
- Only includes `tools/` package (not tests)
- venv: `.venv`
**ty (ty.toml)**:
- Includes `tools/`, `tests/` packages, and `noxfile.py`
- Excludes cache directories (`__pycache__`, `.pytest_cache`, `.ruff_cache`, `.venv`)

**pytest (pytest.ini)**:
- Coverage: 75% minimum with branch coverage
Expand All @@ -199,8 +195,8 @@ Example of the argument parsing pattern:
@nox.session(python=False)
def lint(session: nox.Session) -> None:
args = CLIArgs.parse(session.posargs)
if args.pyright:
session.run("uv", "run", "pyright")
if args.ty:
session.run("uv", "run", "ty", "check")
if args.ruff:
session.run("uv", "run", "ruff", "check", ".", "--fix")
if args.sqlfluff:
Expand Down Expand Up @@ -247,7 +243,7 @@ When testing the utilities themselves:
The `docs/` directory is organized for MkDocs:
- **docs/index.md**: Main landing page
- **docs/getting-started/**: Setup guides (Docker, VSCode, Dev Container)
- **docs/guides/**: Tool usage guides (uv, Ruff, Pyright, pre-commit, tools package)
- **docs/guides/**: Tool usage guides (uv, Ruff, ty, pre-commit, tools package)
- **docs/configurations/**: Detailed configuration references
- **docs/usecases/**: Real-world examples (Jupyter, FastAPI, OpenCV)

Expand All @@ -260,7 +256,7 @@ GitHub Actions workflows in `.github/workflows/`:
- **devcontainer.yml**: Validate Dev Container configuration
- **format.yml**: Check Ruff formatting
- **labeler.yml**: Add label in GitHub
- **lint.yml**: Run Pyright + Ruff linting
- **lint.yml**: Run Ruff + ty linting
- **test.yml**: Run pytest with coverage
- **gh-deploy.yml**: Deploy documentation to GitHub Pages

Expand All @@ -285,7 +281,7 @@ Critical environment variables (set in `.env.local`):
- **Ruff replaces multiple tools**: No need for Black, isort, Flake8, etc.
- **nox is the task runner**: Prefer `uv run nox -s <session>` over direct tool calls
- **Test naming**: Use `test__*.py` pattern (double underscore)
- **Type checking targets tools/ only**: Pyright only checks the `tools/` package, not tests
- **Type checking**: ty checks both the `tools/` and `tests/` packages

## Template Usage Pattern

Expand Down
14 changes: 7 additions & 7 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ Thank you for your interest in contributing to python-uv! This document provides

### Prerequisites

- Python 3.10 or higher
- Python 3.11 or higher
- [uv](https://github.com/astral-sh/uv) package manager
- Git
- (Optional) Docker and VSCode with Dev Containers extension
Expand Down Expand Up @@ -71,7 +71,7 @@ uv run pre-commit install
uv run nox -s test

# Run linters
uv run nox -s lint -- --pyright --ruff
uv run nox -s lint -- --ruff --ty

# Format code
uv run nox -s fmt
Expand Down Expand Up @@ -132,7 +132,7 @@ git commit -m "changes"
uv run nox -s fmt

# 2. Run linters
uv run nox -s lint -- --pyright --ruff
uv run nox -s lint -- --ruff --ty

# 3. Run tests with coverage
uv run nox -s test
Expand Down Expand Up @@ -182,7 +182,7 @@ All checks must pass. PRs with failing checks will not be reviewed.
### General Guidelines

- **Line length**: Maximum 88 characters (Black-compatible)
- **Python version**: Target Python 3.10+ (or a specific stable version)
- **Python version**: Target Python 3.11+ (or a specific stable version)
- **Import order**: Automatically handled by Ruff
- **Naming conventions**:
- Classes: `PascalCase`
Expand Down Expand Up @@ -360,7 +360,7 @@ uv run ruff check . --fix
uv run ruff format .

# Check type errors
uv run pyright
uv run ty check

# If type errors persist, add type hints or use type: ignore with justification
```
Expand Down Expand Up @@ -458,9 +458,9 @@ uv sync

Before submitting your PR, verify:

- [ ] Code follows project standards (Ruff, Pyright, type hints, docstring)
- [ ] Code follows project standards (Ruff, ty, type hints, docstring)
- [ ] All tests pass: `uv run nox -s test` (coverage ≥ 75%)
- [ ] Linting passes: `uv run nox -s lint -- --pyright --ruff`
- [ ] Linting passes: `uv run nox -s lint -- --ruff --ty`
- [ ] Code is formatted: `uv run nox -s fmt`
- [ ] Pre-commit hooks pass: `uv run pre-commit run --all-files`
- [ ] Documentation updated (README, CLAUDE.md, or docs/)
Expand Down
Loading
Loading