Skip to content
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

Expose the current phase in context #1883

Open
noirbizarre opened this issue Dec 8, 2024 · 0 comments
Open

Expose the current phase in context #1883

noirbizarre opened this issue Dec 8, 2024 · 0 comments

Comments

@noirbizarre
Copy link
Contributor

noirbizarre commented Dec 8, 2024

Actual Situation

Extensions have no way of knowing the current phase (aka. questions, render, tasks or migration).

As a consequence, they have to guess which context variable is available and safe for them to use.

Ex: copier-templates-extensions was guessing the rendering phase with the presence of _copier_conf context var but is broken since 9.4 due to its heuristic not working anymore

Desired Situation

Jinja extension can selectively run during the phase they intend to, and they have a safe way of knowing which phase is currently being executed

Proposed solution

In addition to an _operation context variable which has already been proposed and pending merge (#1733), a _phase context variable is also added.
Its value can be one of questions (or prompt), render, migrate or tasks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant