-
Notifications
You must be signed in to change notification settings - Fork 1
Add application skeletons to further simplify project startup #4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
b37821a
add torchvision app template
irod973 d6bf137
parametrize dependencies
irod973 2ea6ca3
docker fixes (in progress)
irod973 dce03f8
Polished application skeletons and docker commands
irod973 8f2adf8
add torchvision prompt to test
irod973 64da92b
add torchvision prompt to test
irod973 b5d0468
check fixes
irod973 71eb93f
Update hooks/post_gen_project.py
irod973 9560a3e
update build backend; add profilers
irod973 e3ec941
add postgen script docstring
irod973 7d8f638
Update {{cookiecutter.repository}}/tasks/docker.just
irod973 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,30 +1,27 @@ | ||
| import shutil | ||
| """Remove any unwanted optional components after project generation.""" | ||
| import os | ||
| import shutil | ||
|
|
||
| def is_false(val): | ||
| return str(val).strip().lower() in ("false", "n", "no", "0") | ||
|
|
||
| def is_false(val: str) -> bool: | ||
| return val.strip().lower() in ("false", "n", "no", "0") | ||
|
|
||
| # Remove FastAPI component if not included | ||
| if is_false('{{cookiecutter.include_fastapi}}'): | ||
| shutil.rmtree('src/fastapi_app', ignore_errors=True) | ||
| if is_false("{{cookiecutter.include_fastapi}}"): | ||
| shutil.rmtree("src/fastapi_app", ignore_errors=True) | ||
|
|
||
| # Remove Metaflow component if not included | ||
| if is_false('{{cookiecutter.include_metaflow}}'): | ||
| shutil.rmtree('src/metaflow_app', ignore_errors=True) | ||
| if is_false("{{cookiecutter.include_metaflow}}"): | ||
| shutil.rmtree("src/metaflow_app", ignore_errors=True) | ||
|
|
||
| # Remove Python package component if not included | ||
| if is_false('{{cookiecutter.include_package}}'): | ||
| if is_false("{{cookiecutter.include_package}}"): | ||
| shutil.rmtree("src/{{cookiecutter.package}}", ignore_errors=True) | ||
| # Remove publish workflow if present | ||
| workflow_path = os.path.join('.github', 'workflows', 'publish.yml') | ||
| workflow_path = os.path.join(".github", "workflows", "publish.yml") | ||
| if os.path.exists(workflow_path): | ||
| os.remove(workflow_path) | ||
| # Remove publish badge from README if present | ||
| readme_path = os.path.join('.', 'README.md') | ||
| if os.path.exists(readme_path): | ||
| with open(readme_path, 'r') as f: | ||
| lines = f.readlines() | ||
| with open(readme_path, 'w') as f: | ||
| for line in lines: | ||
| if 'publish.yml' not in line: | ||
| f.write(line) | ||
|
|
||
| # Remove torchvision app if not included in template options | ||
| if is_false("{{cookiecutter.include_torchvision}}"): | ||
| shutil.rmtree("src/torchvision_app", ignore_errors=True) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,26 +1,62 @@ | ||
| # https://docs.docker.com/compose/compose-file/ | ||
|
|
||
| services: | ||
| {% if cookiecutter.include_fastapi %} | ||
| python: | ||
| build: | ||
| context: . | ||
| dockerfile: docker/Dockerfile.python | ||
| volumes: | ||
| - ./pyproject.toml:/app/pyproject.toml | ||
| - ./uv.lock:/app/uv.lock | ||
| {% if cookiecutter.include_fastapi %} | ||
| fastapi_app: | ||
| build: . | ||
| command: ["uvicorn", "example_app.main:app", "--host", "0.0.0.0", "--reload"] | ||
| build: | ||
| context: . | ||
| dockerfile: docker/Dockerfile.python | ||
| args: | ||
| UV_SYNC_OPTIONS: "--group fastapi" | ||
| command: ["fastapi", "dev", "fastapi_app/main.py", "--host", "0.0.0.0"] | ||
| ports: | ||
| - "8000:8000" | ||
| volumes: | ||
| - ./src:/app/src | ||
| {% endif %} | ||
| {% if cookiecutter.include_metaflow %} | ||
| - ./src/fastapi_app:/app/fastapi_app | ||
| - ./pyproject.toml:/app/pyproject.toml | ||
| - ./uv.lock:/app/uv.lock | ||
| {% endif %} | ||
| {% if cookiecutter.include_metaflow %} | ||
| metaflow_app: | ||
| build: . | ||
| build: | ||
| context: . | ||
| dockerfile: docker/Dockerfile.python | ||
| args: | ||
| UV_SYNC_OPTIONS: "--group metaflow" | ||
| command: ["python", "metaflow_app/spin_prototype.py"] | ||
| volumes: | ||
| - ./src:/app/src | ||
| {% endif %} | ||
| {% if cookiecutter.include_package %} | ||
| - ./src/metaflow_app:/app/metaflow_app | ||
| - ./pyproject.toml:/app/pyproject.toml | ||
| - ./uv.lock:/app/uv.lock | ||
| {% endif %} | ||
| {% if cookiecutter.include_package %} | ||
| python_package: | ||
| build: . | ||
| build: | ||
| context: . | ||
| dockerfile: docker/Dockerfile.python | ||
| command: ["python", "-m", "{{cookiecutter.package}}"] | ||
| volumes: | ||
| - ./src:/app/src | ||
| {% endif %} | ||
| - ./src/{{cookiecutter.package}}:/app/{{cookiecutter.package}} | ||
| - ./pyproject.toml:/app/pyproject.toml | ||
| - ./uv.lock:/app/uv.lock | ||
| {% endif %} | ||
| {% if cookiecutter.include_torchvision %} | ||
| torchvision_app: | ||
| build: | ||
| context: . | ||
| dockerfile: docker/Dockerfile.python | ||
| args: | ||
| UV_SYNC_OPTIONS: "--extra cpu" | ||
| command: ["python", "torchvision_app/torchvision_example.py"] | ||
| volumes: | ||
| - ./src/torchvision_app:/app/torchvision_app | ||
| - ./pyproject.toml:/app/pyproject.toml | ||
| - ./uv.lock:/app/uv.lock | ||
| {% endif %} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ignoring, this is simply standardizing on Python 3.12