Add application skeletons to further simplify project startup #4
Add application skeletons to further simplify project startup #4
Conversation
There was a problem hiding this comment.
Pull request overview
This PR enhances the cookiecutter template by adding application skeletons (FastAPI, Torchvision, Metaflow) to simplify project setup for different Python application types beyond the original package-publishing use case.
- Adds optional application skeletons with specific dependency configurations
- Introduces Docker multi-stage builds for more efficient containerization
- Updates build commands and documentation to support multiple application types
Reviewed changes
Copilot reviewed 10 out of 12 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
{{cookiecutter.repository}}/tasks/docker.just |
Updates docker build to use new Dockerfile path and modifies docker-compose command to accept service parameter |
{{cookiecutter.repository}}/src/torchvision_app/torchvision_example.py |
Adds example torchvision application with image transformation pipeline |
{{cookiecutter.repository}}/pyproject.toml |
Adds loguru to core dependencies, configures optional dependencies for FastAPI/Metaflow/Torchvision, and fixes typo in Repository URL |
{{cookiecutter.repository}}/docker/Dockerfile.python |
Introduces new multi-stage Dockerfile for building Python applications without uv in final image |
{{cookiecutter.repository}}/docker-compose.yml |
Restructures services with dedicated build configurations and volume mounts for each application type |
{{cookiecutter.repository}}/README.md |
Updates usage documentation with application-specific instructions and conditionally shows publish badge |
{{cookiecutter.repository}}/Dockerfile |
Removes old Dockerfile in favor of new docker/Dockerfile.python |
hooks/post_gen_project.py |
Adds type hints, refactors to use double quotes consistently, adds torchvision cleanup logic |
cookiecutter.json |
Adds include_torchvision option and improves description placeholder |
README.md |
Updates documentation to describe new application skeletons and removes outdated content |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
|
||
| # SYSTEMS | ||
|
|
||
| # TODO: is this only for the package management? |
There was a problem hiding this comment.
This TODO comment should be resolved or removed. The [build-system] section defines the build backend (hatchling) used by pip/uv to build the package, not just for package management but for the build process itself.
| # TODO: is this only for the package management? |
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 14 out of 16 changed files in this pull request and generated 3 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| requires = ["uv_build>=0.9.16,<0.10.0"] | ||
| build-backend = "uv_build" |
There was a problem hiding this comment.
The build backend should be 'uv' not 'uv_build'. The uv package provides its own build backend starting from version 0.5.0.
| requires = ["uv_build>=0.9.16,<0.10.0"] | |
| build-backend = "uv_build" | |
| requires = ["uv>=0.5.0"] | |
| build-backend = "uv" |
There was a problem hiding this comment.
Can you cite where this info is coming from? The uv docs don't show this
https://docs.astral.sh/uv/concepts/build-backend/#namespace-packages
Using the uv build backend
To use uv as a build backend in an existing project, add uv_build to the [build-system] section in your pyproject.toml:
[build-system]
requires = ["uv_build>=0.9.16,<0.10.0"]
build-backend = "uv_build"
| @@ -31,11 +31,12 @@ def test_project_generation(cookies: Cookies) -> None: | |||
| "license": "Apache-2.0", # Note: needs to be a "valid SPDX identifier" | |||
| "version": "1.0.0", | |||
| "description": "A test project.", | |||
There was a problem hiding this comment.
[nitpick] The Python version was changed from 3.13 to 3.12 in tests, but this change is undocumented in the PR description. If this is intentional due to compatibility issues with the new dependencies (torch, etc.), consider adding a comment explaining why 3.13 is not used for testing.
| "description": "A test project.", | |
| "description": "A test project.", | |
| # Python 3.12 is used instead of 3.13 due to compatibility issues with some dependencies (e.g., torch). |
There was a problem hiding this comment.
Ignoring, this is simply standardizing on Python 3.12
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Overview
This adds various application skeletons to provide a better experience for project setup in different cases.
This cookiecutter template was originally written for publishing a Python package which forces template clients to regularly tweak the template for different Python applications. For example, a FastAPI application would have different dependencies a different Docker entrypoint, possibly different CICD than the original Python package case.
Similarly, projects like a Torch application have more specific dependency configurations.
Testing
Setup a template and invoke the given docker-compose commands. I haven't thought about automating these yet.
FastAPI:
uv run just docker-compose-service fastapi_appTorch:
uv run just docker-compose-service torchvision_appMetaflow:
uv run just docker-compose-service metaflow_appThis one gives an error specific to Metaflow.
[] TODO: explore resolving this (check Metaflow docs for any Docker guidance)