From fa687e88994fb7de7f029bdad825848457da3f82 Mon Sep 17 00:00:00 2001 From: Oliver Sanders Date: Wed, 13 Nov 2024 13:18:17 +0000 Subject: [PATCH] remove empy support * Closes #6458 * EmPy support is currently broken. * As there are no users of this integration and concerns over the future of the package, we have decided to drop support rather than fixing it. --- changes.d/6476.break.md | 1 + conda-environment.yml | 1 - cylc/flow/parsec/empysupport.py | 89 ------------------- cylc/flow/parsec/exceptions.py | 4 - cylc/flow/parsec/fileparse.py | 32 +------ cylc/flow/scripts/lint.py | 2 - cylc/flow/scripts/view.py | 16 +--- pytest.ini | 1 - setup.cfg | 3 - tests/functional/empy/00-simple.t | 34 ------- tests/functional/empy/00-simple/flow.cylc | 17 ---- tests/unit/parsec/test_empysupport.py | 87 ------------------ tests/unit/parsec/test_fileparse.py | 46 ++++++---- .../parsec/test_fileparse_templating_clash.py | 4 +- tests/unit/scripts/test_lint.py | 8 +- tests/unit/test_config.py | 43 +-------- 16 files changed, 40 insertions(+), 348 deletions(-) create mode 100644 changes.d/6476.break.md delete mode 100644 cylc/flow/parsec/empysupport.py delete mode 100644 tests/functional/empy/00-simple.t delete mode 100644 tests/functional/empy/00-simple/flow.cylc delete mode 100644 tests/unit/parsec/test_empysupport.py 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, '