PaaSTA - container orchestration platform for deploying services on Kubernetes at Yelp.
- Plan first - work with the user to write a plan/spec before implementing features
- Write unit tests; also write acceptance tests (
general_itests/, behave framework) when feasible - Run tests during iteration;
make testbefore commits
make dev # create virtualenv via tox
make install-hooks # pre-commit hooksTox manages virtualenvs in .tox/py310-linux/. Use tox or make targets to ensure the env is built.
- Follow the application-style pinning model from requirements-tools: https://github.com/YelpArchive/requirements-tools
- Treat
requirements*.txtas the source of truth for dependencies (requirements-tools recommends not relying onsetup.pyfor listing deps). requirements-minimal.txt: top-level production deps. Do not pin unless strictly necessary; if you must, use a loose lower-bound and note why.requirements-dev-minimal.txt: top-level dev deps. Do not pin unless strictly necessary; if you must, use a loose lower-bound and note why.- Do not list transitive-only deps in the
*-minimalfiles; those live in the fully pinned files. requirements.txt: fully pinned production deps (including transitive), used for installs.requirements-dev.txt: fully pinned dev deps (including transitive), installed alongsiderequirements.txtin dev/test.- Run
check-requirements(viamake test) to verify pins and alignment. - Use
upgrade-requirementsfor bulk refreshes; for a small set or individual package bumps, add deps to*-minimaland update the pinned files incrementally.
# Iterate with pytest directly
.tox/py310-linux/bin/pytest tests/path/to/test_foo.py -x
# Full suite before committing
make test # pre-commit, mypy, pytest, coverage
# Integration tests
make itest # acceptance tests (behave)
make k8s_itests # kubernetes integration (requires Kind)- Bisectable history: every commit passes tests and is independently releasable
- Atomic commits: one logical change per commit
- Large changes: break into a series of atomic commits, each functional and building toward the goal
Style is enforced by pre-commit (black, flake8, import ordering) and mypy.
# Iterate on specific files
.tox/py310-linux/bin/pre-commit run --files path/to/file.py
.tox/py310-linux/bin/mypy path/to/file.py
# Check all staged files
.tox/py310-linux/bin/pre-commit run
# Full check
make test- Strongly typed by default. Use granular types; avoid
Any. - Use advanced constructs where helpful:
Literal,TypedDict,TypeVar,Protocol, etc. - If interacting with code that exposes
Any, constrain the type in your call flow. - See
paasta_tools/utils.pyforTypedDictpatterns (e.g.,TopologySpreadConstraintDict).
When adding/modifying fields in service configs (yelpsoa-configs), you must:
- Update the JSON schema in
paasta_tools/cli/schemas/ - Update the docs in
docs/source/yelpsoa_configs.rst
Schema guidelines:
- Constrain tightly: prefer
enum,pattern(regex), specific formats over barestring/integer - Example commit:
97c04cbee- addstopology_spread_constraintswith enum constraint + TypedDict + tests
Schemas:
eks_schema.json- kubernetes.yamlkubernetes_schema.json- legacy; do not modifytron_schema.json- tron jobssmartstack_schema.json- service discoveryadhoc_schema.json- adhoc instances
- No inline imports - all imports at top of module
- No module-level side effects (other than imports)
- Avoid adding to
paasta_tools/utils.py- it's already large; prefer more specific modules mock.patchmust useautospec=True(enforced by pre-commit)
paasta_tools/mesos/- deprecated and unused; do not modify or extend
paasta_tools/- main sourcepaasta_tools/cli/- CLI subcommandspaasta_tools/kubernetes/- K8s integrationpaasta_tools/api/- REST APItests/- pytest unit testsgeneral_itests/- behave acceptance tests
docs/source/- Sphinx docs- https://paasta.readthedocs.io