-
Notifications
You must be signed in to change notification settings - Fork 0
fix: 🐛 fix copier update #144
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
base: main
Are you sure you want to change the base?
Conversation
|
||
- name: Pull request with updates from template | ||
run: | | ||
just update-from-template |
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.
Changed this to use the just recipe
@@ -115,7 +115,8 @@ build-contributors: | |||
|
|||
# Check for and apply updates from the template | |||
update-from-template: | |||
uvx copier update --trust --defaults | |||
# Do not update existing source files | |||
uvx copier update --trust --defaults $(find src/{{ github_repo_snake_case }} -type f -printf "--exclude %p ") |
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.
The problem was that running copier update ...
deleted some files in the src/{{ github_repo_snake_case }}
folder. Maybe because the folder name is templated?
In any case, there is a _skip_if_exists
property in copier.yml
, where you can set which files not to touch if they exist. Setting this worked for some test files I put in the folder, but interestingly not for __init__.py
and py.typed
. Even skipping all files in the folder didn't catch these two 🤔 .
The _exclude
property is similar, but it stays in force regardless of the file existing, so a deleted file will not be recreated.
This version with the --exclude
flag is a workaround: it excludes all files in the folder that exist, recreating the behaviour of _skip_if_exists
in copier.yml
. We could narrow it to only the two problematic files if this is too broad.
Any other ideas welcome!!
@@ -1,2 +1,2 @@ | |||
# Changes here will be overwritten by Copier; NEVER EDIT MANUALLY | |||
{{ dict(_copier_answers, copyright_year=copyright_year) | to_nice_yaml -}} | |||
{{ dict(_copier_answers, github_repo=github_repo, copyright_year=copyright_year) | to_nice_yaml -}} |
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.
Otherwise copier will use a temp folder name it uses under the hood
Description
This PR fixes and improves copier update.
Closes #143
This PR needs a medium-depth review.
Checklist
just run-all
-- will fail until some other PRs are merged in