It works on my machine! But it doesn’t work on other people’s machines And it definitely does not work on cloud deployment Team members are fighting about which lib version is the correct one Also python version (there’s so many!)
have to do it every time you change the code 😱 tests/single.py from fastapi.testclient import TestClient from python_api_template.main import app client = TestClient(app) def test_single(): response = client.post("/", json={"id": "foo", "message": "hello world"}) assert response.status_code == 200 pytest tests/single.py ============================================= test session starts ============================================== platform darwin -- Python 3.11.8, pytest-8.0.0, pluggy-1.4.0 rootdir: /Users/kahnwong/Git/kahnwong/platform/python-api-template plugins: cov-4.1.0, xdist-3.5.0, anyio-4.2.0 collected 1 item
explicit on data objects Use logger for more visibility into your code Utilize pre-commit to check and validate your code Add tests so you can iterate quickly Declare your project entrypoints in Makefile Use Dockerfile to test a deployment