formatting
This commit is contained in:
@@ -1,6 +1,10 @@
|
||||
# Docker and Cloud-Native Patterns
|
||||
|
||||
Source: https://docs.docker.com/build/building/best-practices/ | https://docs.astral.sh/uv/guides/integration/docker/ | https://fastapi.tiangolo.com/deployment/docker/ | https://uvicorn.dev/deployment/
|
||||
!!! info "Primary sources"
|
||||
- [Docker build best practices](https://docs.docker.com/build/building/best-practices/)
|
||||
- [uv Docker integration](https://docs.astral.sh/uv/guides/integration/docker/)
|
||||
- [FastAPI Docker deployment](https://fastapi.tiangolo.com/deployment/docker/)
|
||||
- [uvicorn deployment](https://uvicorn.dev/deployment/)
|
||||
|
||||
---
|
||||
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
# FastAPI Best Practices
|
||||
|
||||
Source: https://fastapi.tiangolo.com/deployment/ | https://fastapi.tiangolo.com/advanced/events/
|
||||
!!! info "Primary sources"
|
||||
- [FastAPI deployment](https://fastapi.tiangolo.com/deployment/)
|
||||
- [FastAPI lifespan events](https://fastapi.tiangolo.com/advanced/events/)
|
||||
|
||||
---
|
||||
|
||||
@@ -44,7 +46,8 @@ def create_app(settings: Settings | None = None) -> FastAPI:
|
||||
app = create_app()
|
||||
```
|
||||
|
||||
**Never use `@app.on_event("startup")` / `@app.on_event("shutdown")`** — these are deprecated. The `asynccontextmanager` lifespan is the canonical approach since FastAPI 0.95.
|
||||
!!! warning "Prefer lifespan handlers"
|
||||
Never use `@app.on_event("startup")` / `@app.on_event("shutdown")`. These are deprecated. The `asynccontextmanager` lifespan is the canonical approach since FastAPI 0.95.
|
||||
|
||||
---
|
||||
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
# uv Project Layout and Dependency Management
|
||||
|
||||
Source: https://docs.astral.sh/uv/guides/projects/ | https://docs.astral.sh/uv/concepts/projects/layout/ | https://docs.astral.sh/uv/guides/integration/docker/
|
||||
!!! info "Primary sources"
|
||||
- [uv project guide](https://docs.astral.sh/uv/guides/projects/)
|
||||
- [uv project layout](https://docs.astral.sh/uv/concepts/projects/layout/)
|
||||
- [uv Docker integration](https://docs.astral.sh/uv/guides/integration/docker/)
|
||||
|
||||
---
|
||||
|
||||
@@ -13,7 +16,8 @@ Source: https://docs.astral.sh/uv/guides/projects/ | https://docs.astral.sh/uv/c
|
||||
| `.python-version` | Default Python version for the project | Yes |
|
||||
| `.venv/` | Local virtual environment | No (`.gitignore`) |
|
||||
|
||||
**`uv.lock` must be committed.** It is the source of truth for reproducible installs in CI and Docker. Never edit it by hand.
|
||||
!!! warning "Commit the lockfile"
|
||||
`uv.lock` must be committed. It is the source of truth for reproducible installs in CI and Docker. Never edit it by hand.
|
||||
|
||||
---
|
||||
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
# uvicorn Settings Reference
|
||||
|
||||
Source: https://uvicorn.dev/settings/ | https://uvicorn.dev/deployment/
|
||||
!!! info "Primary sources"
|
||||
- [uvicorn settings](https://uvicorn.dev/settings/)
|
||||
- [uvicorn deployment](https://uvicorn.dev/deployment/)
|
||||
|
||||
---
|
||||
|
||||
@@ -21,7 +23,8 @@ uvicorn main:app
|
||||
uvicorn.run("main:app", host="0.0.0.0", port=8000)
|
||||
```
|
||||
|
||||
**Note:** `UVICORN_*` env vars cannot be used from within an `--env-file`. The `--env-file` flag is for the ASGI *application's* config, not uvicorn's own config.
|
||||
!!! note "Environment file scope"
|
||||
`UVICORN_*` env vars cannot be used from within an `--env-file`. The `--env-file` flag is for the ASGI *application's* config, not uvicorn's own config.
|
||||
|
||||
---
|
||||
|
||||
|
||||
Reference in New Issue
Block a user