Repository navigation
feat: renders record their answers, so copier update can reach them - #21
Merged
Merged
Conversation
There was no answers file template under template/, so Copier wrote none:
a render recorded neither its answers nor the template commit it came from,
copier update refused to run, and every template fix had to be copied into
each library by hand.
template/{{_copier_conf.answers_file}}.jinja makes every render carry
_src_path, _commit and the answers. The post-generation message now runs on
a copy only, since copier update runs tasks too. CI gets an update job: a
render of master, updated to the commit under test, has to come out exactly
as a fresh render of it, so a change that does not travel through
copier update fails its own pull request.
The README says how to update a library and how to backfill the file in one
rendered before it existed.
Closes #14
AlexeyShalaev
force-pushed
the
fix/14-copier-answers
branch
from
October 16, 2026 14:55
f747c93 to
c508988
Compare
This was referenced Oct 17, 2026
Merged
Merged
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
The problem
There was no answers-file template under
template/, so Copier wrote no.copier-answers.yml. A render recorded neither its answers nor the template commit it came from,copier updaterefused to run, and every template fix (#8, #9, and the open ones now) had to be copied into each library by hand.The decision
template/{{_copier_conf.answers_file}}.jinja, as proposed. Copier reads the answers file and nothing else, so there was no alternative to weigh.when: "{{ _copier_operation == 'copy' }}").copier updateruns tasks too, and it printed "Template generated. Next steps…" into libraries that were set up long ago.master, commits the render, runscopier updateto the commit under test, and diffs the result against a fresh render of that commit. They have to be identical. A template change that fails or diverges when it travels throughcopier updatetherefore fails its own PR instead of the next library's update. Untilmasteritself renders an answers file, the job says so and exits 0. That applies only to this PR's own run.Evidence
Before (a render of
origin/master8ebf45d, committed):After (a render of this branch):
The new CI step, run locally with
masterset to this branch and a later commit on top that raises the pytest floor. It exits 0, and the updated render changed exactly:No task output on the update. The task does run on
copy. I also checked, with Copier 9.19.1, that a file the library deleted stays deleted through an update, even after the template changes it. That matters for #15, which renders the checklist again.The generated gate on the render:
ruff/mypyclean, 1 test passed,uv buildOK.actionlintis clean on the template CI.For the existing libraries
None of them has the file, so each one needs it written by hand before its first
copier update, as the README now describes: the answers it was rendered with,_src_path: gh:bedrock-python/python-library-template, and as_committhe template commit it is closest to. The template has no tags, so Copier versions it as0.0.0.postN.devN+sha. Tagging template releases would make those jumps readable, but that is a separate decision.Closes #14