diff --git a/changes.d/6476.break.md b/changes.d/6476.break.md new file mode 100644 index 00000000000..e86af9d978f --- /dev/null +++ b/changes.d/6476.break.md @@ -0,0 +1 @@ +Remove support for the EmPy template engine. diff --git a/conda-environment.yml b/conda-environment.yml index 4a598468d67..6d31dce5489 100644 --- a/conda-environment.yml +++ b/conda-environment.yml @@ -21,7 +21,6 @@ dependencies: - tomli >=2 # [py<3.11] # optional dependencies - #- empy >=3.3,<3.4 #- pandas >=1.0,<2 #- pympler #- matplotlib-base diff --git a/cylc/flow/parsec/empysupport.py b/cylc/flow/parsec/empysupport.py deleted file mode 100644 index e3dc5e28df4..00000000000 --- a/cylc/flow/parsec/empysupport.py +++ /dev/null @@ -1,89 +0,0 @@ -# THIS FILE IS PART OF THE CYLC WORKFLOW ENGINE. -# Copyright (C) NIWA & British Crown (Met Office) & Contributors. -# -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program. If not, see . -"""cylc support for the EmPy template processor - -Importing code should catch ImportError in case EmPy is not installed. -""" - -from io import StringIO -import em -import os -import typing as t - -from cylc.flow.parsec.exceptions import EmPyError -from cylc.flow.parsec.fileparse import get_cylc_env_vars - - -def empyprocess( - _fpath: str, - flines: t.List[str], - dir_: str, - template_vars: t.Optional[t.Dict[str, t.Any]] = None, -) -> t.List[str]: - """Pass configure file through EmPy processor. - - Args: - _fpath: - The path to the root template file (i.e. the flow.cylc file) - flines: - List of template lines to process. - dir_: - The path to the configuration directory. - template_vars: - Dictionary of template variables. - - """ - - cwd = os.getcwd() - - os.chdir(dir_) - ftempl = StringIO('\n'.join(flines)) - xtempl = StringIO() - interpreter = em.Interpreter(output=em.UncloseableFile(xtempl)) - - # Add `CYLC_` environment variables to the global namespace. - interpreter.updateGlobals( - get_cylc_env_vars() - ) - - try: - interpreter.file(ftempl, '