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 AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ A framework-free Python client for the Philanthropy Data Commons (PDC) API. The

- `just test [--python VERSION] [--lowest-direct] [--upgrade] [-- ARGS]` runs the unit tests, which mock all HTTP with `responses`. `just integration` takes the same options. Both run against the installed package in an isolated environment, with the versions in `uv.lock` unless `--lowest-direct` or `--upgrade` resolves them fresh. Arguments after `--` go to pytest.
- `just pdc up` starts PDC's CI stack in Docker; `just integration` runs the live suite against it.
- `just typecheck` runs mypy (with the pydantic plugin) over `src` and both test suites, mypy in strict mode over `src`, then pyrefly and ty over `src` and both test suites, and fails at the end if any of them failed. `just typecheck-mypy`, `just typecheck-pyrefly`, and `just typecheck-ty` run one checker each. All take `--python` to check against a Python version other than `.python-version`.
- Verify with `just check` (lint plus both suites). The unit tests can't catch a change in PDC's behavior; if the stack isn't available, run `just test` and `just lint` and say that integration verification is pending.

## Standards
Expand Down
1 change: 1 addition & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ We use [uv](https://docs.astral.sh/uv/) and [just](https://just.systems):
```bash
uv sync
just test # unit tests, no network
just typecheck # mypy, pyrefly, and ty
just pdc up # start PDC's CI stack in Docker
just integration # integration tests against that stack
just check # lint, unit tests, and integration tests
Expand Down
36 changes: 36 additions & 0 deletions justfile
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,42 @@ format:
uv run ruff format .
uv run ruff check . --fix

# Run all three type checkers, failing at the end if any failed
[group('dev')]
[arg("python", long)]
typecheck python=python:
#!/usr/bin/env bash
status=0
for checker in mypy pyrefly ty; do
{{just_executable()}} typecheck-$checker --python={{python}} || status=1
done
exit $status

# Type check the package and tests with mypy, then the package in strict mode
[group('dev')]
[arg("python", long)]
typecheck-mypy python=python:
#!/usr/bin/env bash
status=0
run="uv run --python={{python}} --isolated --no-dev --group tests --group typecheck --"
$run mypy --python-version={{python}} || status=1
$run mypy --python-version={{python}} --strict src || status=1
exit $status

# Type check the package and tests with pyrefly (passes through args)
[group('dev')]
[arg("python", long)]
typecheck-pyrefly python=python *args:
uv run --python={{python}} --isolated --no-dev --group tests --group typecheck -- \
pyrefly check --python-version={{python}} {{args}}

# Type check the package and tests with ty (passes through args)
[group('dev')]
[arg("python", long)]
typecheck-ty python=python *args:
uv run --python={{python}} --isolated --no-dev --group tests --group typecheck -- \
ty check --python-version={{python}} {{args}}

# Run the unit tests against the installed package
[group('test')]
[arg("python", long)]
Expand Down
23 changes: 23 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,18 @@ dev = [
"datamodel-code-generator[ruff]>=0.87",
"ruff>=0.17",
{ include-group = "tests" },
{ include-group = "typecheck" },
]
tests = [
"pdc-python-client[seeding,testing]",
"pytest-cov>=7",
"pytest>=9",
]
typecheck = [
"mypy>=2.4.1",
"pyrefly>=1.4.1",
"ty>=0.0.100",
]

[build-system]
requires = ["uv_build>=0.12"]
Expand Down Expand Up @@ -74,6 +80,23 @@ pdc_api_client = ["src/pdc_api_client/", "*/site-packages/pdc_api_client/"]
testpaths = ["tests"]
addopts = ["--cov=pdc_api_client", "--cov-report=term-missing", "--cov-branch"]

[tool.mypy]
files = ["src", "tests", "integration_tests"]
mypy_path = ["src", "tests"]
explicit_package_bases = true
check_untyped_defs = true
plugins = ["pydantic.mypy"]

[tool.pyrefly]
project-includes = ["src", "tests", "integration_tests"]
search-path = ["src", "tests"]

[tool.ty.src]
include = ["src", "tests", "integration_tests"]

[tool.ty.environment]
extra-paths = ["tests"]

[tool.ruff]
line-length = 120
extend-exclude = ["src/pdc_api_client/_generated.py"]
Expand Down
Loading
Loading