-
-
Notifications
You must be signed in to change notification settings - Fork 246
Closed
Labels
Description
Describe the problem
#1948 introduced the copier.types.Phase enum exposed in a _copier_phase to fix an issue in copier-template-extensions. It allowed to scope template extensions processing to phases with exit conditions like:
if context.get("_copier_phase") is not Phase.RENDER:
return#2069 deprecated direct access to copier.types making all templates using it raise a deprecation warning.
Template
N/A
To Reproduce
- Create a template using
copier-template-extensions - Add an exit condition on the phase like
from copier_template_extensions import ContextHook
class ContextUpdater(ContextHook):
def hook(self, context: dict[str, Any]) -> dict[str, Any] | None:
if context.get("_copier_phase") is not Phase.RENDER:
return- Apply or update the template
Logs
DeprecationWarning: Importing `Phase` from `copier.types` is deprecated. This module member is intended for internal use only and will become inaccessible in the future. If you have any questions or concerns, please raise an issue at <https://github.com/copier-org/copier/issues>.Expected behavior
copier.types.Phase is considered part of the public API and does not raise a DeprecationWarning.
(Maybe it needs to be moved somewhere else, in a module dedicated to public types)
Screenshots/screencasts/logs
No response
Operating system
Linux
Operating system distribution and version
Archlinux
Copier version
9.11.3
Python version
3.13
Installation method
uvx+pypi
Additional context
No response
Reactions are currently unavailable