from string import Template class EnvTemplate(Template): """Substitute variables regularly, but environment variables need "env." prefix, and only with the braced syntax. For example: ${env.HOME} works, but $env.HOME does nothing. """ braceidpattern = rf"(?:env\.)?{Template.idpattern}"