-
Notifications
You must be signed in to change notification settings - Fork 0
feat: renewed template #6
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
2 commits
Select commit
Hold shift + click to select a range
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| 3.13 |
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 |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| author_email: author@email.test | ||
| author_name: test-author | ||
| description: Service description. | ||
| docker: true | ||
| project_name: test-service |
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,37 +1,107 @@ | ||
| PROJECT_NAME := "copier-python-project" | ||
| TEST_ANSWERS_FILE := ".copier/.copier-answers." + PROJECT_NAME + ".yml" | ||
| TEST_CATALOG := "test_catalog" | ||
| COPIER_ANSWERS_CATALOG := ".copier" | ||
| TEST_ANSWERS_FILE := COPIER_ANSWERS_CATALOG + "/.copier-answers." + PROJECT_NAME + ".yml" | ||
| PATHS_TO_LINT := "tests" | ||
|
|
||
| copy output="test_catalog": | ||
| uv run copier copy . {{ output }} \ | ||
| --vcs-ref=HEAD | ||
| [doc("Command run when 'just' is called without any arguments")] | ||
| default: help | ||
|
|
||
| recopy output="test_catalog": | ||
| uv run copier recopy {{ output }} \ | ||
| --vcs-ref=HEAD \ | ||
| --answers-file {{ TEST_ANSWERS_FILE }} \ | ||
| --skip-answered \ | ||
| --overwrite | ||
| [doc("Prints this help message.")] | ||
| help: | ||
| just --list | ||
|
|
||
| update output="test_catalog": | ||
| uv run copier recopy {{ output }} \ | ||
| [group("generation")] | ||
| [doc("Generates repo from template to output directory")] | ||
| copy output=TEST_CATALOG data_file="example-answers.yml": | ||
| uv run copier copy . {{ output }} \ | ||
| --vcs-ref=HEAD \ | ||
| --answers-file {{ TEST_ANSWERS_FILE }} \ | ||
| --overwrite | ||
| --data-file {{ data_file }} \ | ||
| --overwrite \ | ||
| --UNSAFE \ | ||
| --force | ||
|
|
||
| [group("generation")] | ||
| [doc("Deletes the output directory, excluding the answers file (it is remained for re-copying).")] | ||
| clear output=TEST_CATALOG: | ||
| find "{{ output }}" -mindepth 1 \ | ||
| -not -path "{{ output }}/{{ COPIER_ANSWERS_CATALOG }}" \ | ||
| -not -path "{{ output }}/{{ TEST_ANSWERS_FILE }}" \ | ||
| -delete | ||
|
|
||
| [group("generation")] | ||
| [doc("Re-copies the template to the output directory, using the answers file. If clear is true, it deletes the output directory first.")] | ||
| recopy output=TEST_CATALOG clear="true" skip-answered="true": | ||
| @if {{ clear }}; then \ | ||
| just clear {{ output }}; \ | ||
| fi | ||
| uv run copier recopy {{ output }} \ | ||
| --vcs-ref=HEAD \ | ||
| --answers-file {{ TEST_ANSWERS_FILE }} \ | ||
| --overwrite \ | ||
| {{ if skip-answered == "true" { "--skip-answered" } else { "" } }} | ||
|
|
||
| [group("generation")] | ||
| [doc("Same as `recopy`, but with `skip-answered=false` to allow modifying answers.")] | ||
| update output=TEST_CATALOG clear="true": | ||
| just recopy output={{ output }} clear={{ clear }} skip-answered=false recopy | ||
|
|
||
| [group("generation")] | ||
| [doc("Runs linters and tests in the output directory.")] | ||
| run_lints_and_tests_in_output output=TEST_CATALOG: | ||
| cp {{ output }}/.env.example {{ output }}/.env | ||
| cd {{ output }} && uv lock | ||
| just --justfile {{ output }}/justfile dc all_ff | ||
|
|
||
| all_ff output="test_catalog": | ||
| just recopy {{ output }} | ||
| just --justfile {{ output }}/justfile all_ff | ||
| [group("development")] | ||
| [doc("Run all checks and tests (lints, mypy, tests...)")] | ||
| all: lint_full test | ||
|
|
||
| [group("development")] | ||
| [doc("Run all checks and tests, but fail on first that returns error (lints, mypy, tests...)")] | ||
| all_ff: lint_full_ff test | ||
|
|
||
| [group("development")] | ||
| [doc("Runs template tests.")] | ||
| test: | ||
| uv run pytest tests | ||
|
|
||
| ci_lint_full: | ||
| uv run copier copy . tmp/test_catalog \ | ||
| --vcs-ref=HEAD \ | ||
| --data project_name="test-project" \ | ||
| --data description="..." \ | ||
| --data author_name="Test Author" \ | ||
| --data author_email="test@test.com" \ | ||
| --data docker=false | ||
| [group("lint")] | ||
| [doc("Run all lint checks and mypy")] | ||
| lint_full: lint mypy | ||
| alias full_lint := lint_full | ||
|
|
||
| [group("lint")] | ||
| [doc("Run all lint checks and mypy, but fail on first that returns error")] | ||
| lint_full_ff: lint_ff mypy | ||
| alias full_lint_ff := lint_full_ff | ||
|
|
||
| [group("lint")] | ||
| [doc("Run all lightweight lint checks (no mypy)")] | ||
| @lint: | ||
| -just ruff | ||
|
|
||
| [group("lint")] | ||
| [doc("Run ruff lint check (code formatting)")] | ||
| ruff: | ||
| uv run ruff check {{PATHS_TO_LINT}} | ||
| uv run ruff format {{PATHS_TO_LINT}} --check | ||
|
|
||
| [group("lint")] | ||
| [doc("Run mypy check (type checking)")] | ||
| mypy: | ||
| uv run mypy {{PATHS_TO_LINT}} --show-error-codes --show-traceback --implicit-reexport | ||
|
|
||
| [group("lint")] | ||
| [doc("Run all lightweight lint checks, but fail on first that returns error")] | ||
| lint_ff: ruff | ||
|
|
||
| [group("lint")] | ||
| [doc("Automatically fix lint problems (only reported by ruff)")] | ||
| lint_fix: | ||
| uv run ruff check {{PATHS_TO_LINT}} --fix | ||
| uv run ruff format {{PATHS_TO_LINT}} | ||
|
|
||
| just --justfile tmp/test_catalog/justfile lint_full_ff | ||
| _ci_generation_check output=TEST_CATALOG: | ||
| just copy {{ output }} | ||
| just run_lints_and_tests_in_output {{ output }} | ||
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 |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| # --- Env config | ||
| FLAVOR=localdev | ||
|
|
||
| # --- App config | ||
| SERVICE_NAME={{ project_name_kebab_case }} | ||
| PYTHONDONTWRITEBYTECODE=1 | ||
| DEBUG=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
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.
Uh oh!
There was an error while loading. Please reload this page.