Python 3.10–3.12. Work in imednet/, tests/, docs/, examples/, scripts/, .github/.
Run these commands locally before pushing:
poetry run ruff check --fix .
poetry run black --check .
poetry run isort --check --profile black .
poetry run mypy imednet
poetry run pytest -qCoverage ≥ 90%. Max line length 100.
./scripts/setup.shpoetry version <bump>make docs- Commit + tag
vX.Y.Z - Push branch + tag to publish.
- Change Policy: New endpoints → typed methods. Shared logic → utilities. Breaking changes → major bump.
- Models (
imednet/models): Pydantic models. Stable deserialization. No business logic. - HTTP (
imednet/http): Handle retries (idempotent + jitter), timeouts, rate limits (Retry-After). Map errors toimednet/errors. Redact secrets in logs. - Auth (
imednet/auth): Never log secrets. Mask tokens. Thread/async-safe. - Errors (
imednet/errors): Hierarchy:ImednetError>AuthError,RateLimitError,ApiError. - Pagination (
imednet/pagination): Lazy iteration. Bounded memory. Expose page size/cursor. - Utils (
imednet/utils): Pure helpers. No cycles. High coverage.
- Design: Stable interface. Typer/argparse. Pure I/O at edges. Business logic in SDK.
- UX: Complete
--help. Log to stderr (INFO default). Support--verbose/--quiet. - Exit Codes: 0 success, non-zero for error.
- Scope: Higher-level orchestration (batching, retries, transforms).
- Design: Fail loud with custom errors. Inject client. Avoid hard-coded paths.
- Layout:
tests/unit/for fast tests (mock HTTP). Optional live tests. - Policy: All changes require tests.
- Tools: Sphinx (
make docs). Zero warnings. - Content: Document public API/CLI. Sync README quickstart. One runnable snippet per feature.
- Scripts (
scripts/): Dev tooling. Idempotent.set -euo pipefail. - Examples (
examples/): Runnable, minimal. Config via env vars. No hidden state.
- Workflows: Mirror local checks. Release on tag
vX.Y.Z. - PRs: Title
[<area>] <summary>. Require green checks. - Issues: Bugs need repro/versions. Features need use-case.