Comments (3)
I would like to chip in but with a different consideration suggestion but on a similar note.
I do believe that the default behaviour should be to just replay the previous answers unless otherwise specified in general. So basically instead of needing to be explicit with:
$ copier update --defaults
Making it implicit and possibly swap the behaviour for something like:
$ copier update --new-answers
What do people think? Or is there a specific technical reasoning as of why the current behaviour is the way it is?
from copier.
@debo that's a different subject. I marked your comment as off-topic to keep the conversation focused. Feel free to open a new issue or discussion about that.
Back into the subject, it's not a trivial request. Adding support for this would require completely refactoring the logic of how and why we manage the state of the project, which is tailored to our use case.
The use case for copier as a tool is to let you provide new answers and make those answers change the resulting project. This thing you want fits more into a validation tool, such as a pre-commit hook, CI or linter, that forbids unwanted changes. After all, what if you do that change manually, without copier involved? You'd also delete the cluster resources...
However you can be creative. For example, you could deploy your manifests with kustomize, and set the name and namespace in a patch file. Then, add that file to _skip_if_exists
and copier won't update it anymore.
If I don't want users to update values of a question, I'd just add a big warning in the question help.
Another option would be to use a validation based on a computed previous value. I haven't tested this but it could help:
old:
type: str
when: false
default: '{{ resource_name|d("") }}'
resource_name:
type: str
help: What is the name for the resources which will be applied in k8s? (Can't be changed afterwards)
answer_once: true
default: container-registry
validator: "{{not old or resource_name == old}}"
from copier.
Closing because I think there's nothing we could or should do here, but please feel free to continue with the discussion. Thanks for reaching out!
from copier.
Related Issues (20)
- Github Actions pipeline fails to generate sha256 sum for caching macOS builds HOT 1
- latest v9 release missing from pypi HOT 1
- pyyaml-include is GPL3, doesn't that poison your MIT project? HOT 2
- Uses deprecated `onerror` parameter of `shutil.rmtree` in Python >= 3.12
- Custom `block_start_string` (and others) in `_envops` fail if empty `_templates_suffix` used. HOT 12
- make the context-hook extension a "safe" extension HOT 4
- Ability to define safe/unsafe modes and force to ignore _tasks
- Tasks are executed in temporary folder HOT 3
- Error messages not clear enough HOT 3
- Copier copy does not create `.copier-answers.yml` file nor adds any reference to the original template (`TypeError: Template not found`) HOT 4
- Make `mypy copier --strict` pass HOT 3
- Make PR checks for Python 3.12 required HOT 2
- Workflow for updating from a local clone of a template HOT 7
- Add template preview HOT 4
- Rewrite tracebacks to include template lines HOT 1
- Before rendering a file, add `_template_file` and `_this_file` to the context HOT 8
- Fix documentation link in Github Repo HOT 1
- Using --data with a multiselect based choice HOT 5
- --default should just ask for missing answers, regardless of whether there's a default answer in the template HOT 8
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from copier.