Skip to content

Commit

Permalink
Cylc will no longer support Empy from 8.4.0. This commit removes
Browse files Browse the repository at this point in the history
empy functionality and tests from Cylc Rose.
  • Loading branch information
wxtim committed Nov 20, 2024
1 parent 1b7e97d commit 6ee5751
Show file tree
Hide file tree
Showing 14 changed files with 36 additions and 255 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ jobs:
uses: cylc/release-actions/install-cylc-components@v1
with:
cylc_flow: true
cylc_flow_opts: 'empy'
cylc_flow_opts: ''
metomi_rose: true
metomi_rose_opts: ''

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ environment for Rose integration.

This plugin provides support for the `rose-suite.conf` file, namely:

* Jinja2/EmPy template variables.
* Jinja2 template variables.
* Scheduler environment variables.
* File installation.
* Optional configurations.
Expand Down
8 changes: 4 additions & 4 deletions cylc/rose/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,15 +59,15 @@
``opts=A B C``, A space limited list of optional configs.
``[env]``, "Variables which the cylc-rose plugin will export to the
environment."
``[template variables]``, "Variables which can be used by Jinja2 or Empy
``[template variables]``, "Variables which can be used by Jinja2 or
in the workflow definition."
``[file:destination]``, A file from one or more sources to be installed.
.. note::
For compatibility with Cylc 7, sections ``[suite.rc:empy]`` and
``[suite.rc:jinja2]`` will be processed, but are deprecated and provided
for ease of porting Cylc 7 workflows.
For compatibility with Cylc 7, section ``[suite.rc:jinja2]`` will be
processed, but is deprecated and provided for ease of porting Cylc 7
workflows.
The ``global.cylc`` file
Expand Down
25 changes: 4 additions & 21 deletions cylc/rose/utilities.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@


ROSE_SUITE_OPT_CONF_KEYS = 'ROSE_SUITE_OPT_CONF_KEYS'
SECTIONS = {'jinja2:suite.rc', 'empy:suite.rc', 'template variables'}
SECTIONS = {'jinja2:suite.rc', 'template variables'}
SET_BY_CYLC = 'set by Cylc'
ROSE_ORIG_HOST_INSTALLED_OVERRIDE_STRING = (
' ROSE_ORIG_HOST set by cylc install.'
Expand Down Expand Up @@ -234,8 +234,6 @@ def id_templating_section(
templating = None
if section and 'jinja2' in section:
templating = 'jinja2:suite.rc'
elif section and 'empy' in section:
templating = 'empy:suite.rc'

if not templating:
templating = 'template variables'
Expand Down Expand Up @@ -340,7 +338,7 @@ def merge_rose_cylc_suite_install_conf(old, new):
>>> merge_rose_cylc_suite_install_conf(old, new)['opts']
{'value': 'a b c d e', 'state': '', 'comments': []}
"""
# remove jinja2/empy:suite.rc from old if template variables in new
# remove jinja2:suite.rc from old if template variables in new
for before, after in itertools.permutations(SECTIONS, 2):
if new.value.get(after, '') and old.value.get(before, ''):
# Choosing not to warn if user downgrades here because
Expand Down Expand Up @@ -766,32 +764,19 @@ def deprecation_warnings(config_tree):
Logs a warning for deprecated items:
- "root-dir"
- "jinja2:suite.rc"
- "empy:suite.rc"
- root-dir
If ALL_MODES is True this deprecation will ignore whether there is a
flow.cylc or suite.rc in the workflow directory.
"""

deprecations = {
'empy:suite.rc': {
MESSAGE: (
"'rose-suite.conf[empy:suite.rc]' is deprecated."
" Use [template variables] instead."),
ALL_MODES: False,
},
'jinja2:suite.rc': {
MESSAGE: (
"'rose-suite.conf[jinja2:suite.rc]' is deprecated."
" Use [template variables] instead."),
ALL_MODES: False,
},
'empy:flow.cylc': {
MESSAGE: (
"'rose-suite.conf[empy:flow.cylc]' is not used by Cylc."
" Use [template variables] instead."),
ALL_MODES: False,
},
'jinja2:flow.cylc': {
MESSAGE: (
"'rose-suite.conf[jinja2:flow.cylc]' is not used by Cylc."
Expand Down Expand Up @@ -951,9 +936,7 @@ def record_cylc_install_options(

# Get Values for standard ROSE variable ROSE_ORIG_HOST.
rose_orig_host = get_host()
for section in [
'env', 'jinja2:suite.rc', 'empy:suite.rc', 'template variables'
]:
for section in list(SECTIONS) + ['env']:
if section in cli_config:
cli_config[section].set(['ROSE_ORIG_HOST'], rose_orig_host)
cli_config[section]['ROSE_ORIG_HOST'].comments = [
Expand Down Expand Up @@ -1045,7 +1028,7 @@ def retrieve_installed_cli_opts(srcdir, opts):

# Get --suite-defines/-S
# Work out whether user has used "template variables", "jinja2:suite.rc"
# or "empy:suite.rc" (There is an assumption that they aren't mixing
# (There is an assumption that they aren't mixing
# them that is not guarded against):
for section in SECTIONS:
if cli_config.value.get(section, False):
Expand Down
36 changes: 0 additions & 36 deletions tests/functional/01_empy/flow.cylc

This file was deleted.

30 changes: 0 additions & 30 deletions tests/functional/01_empy/processed.conf.control

This file was deleted.

8 changes: 0 additions & 8 deletions tests/functional/01_empy/rose-suite.conf

This file was deleted.

10 changes: 0 additions & 10 deletions tests/functional/08_template_engine_conflict/flow.cylc

This file was deleted.

2 changes: 0 additions & 2 deletions tests/functional/08_template_engine_conflict/rose-suite.conf

This file was deleted.

12 changes: 0 additions & 12 deletions tests/functional/test_pre_configure.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,14 +37,6 @@
'07_cli_override',
'failed 1.1\n(add --verbose for more context)',
id='template variable not set'
),
param(
'08_template_engine_conflict',
(
'A plugin set the templating engine to empy which does'
' not match #!jinja2 set in flow.cylc.'
),
id='template engine conflict'
)
]
)
Expand All @@ -60,7 +52,6 @@ async def test_validate_fail(srcdir, expect, cylc_validate_cli):
'srcdir, envvars, args',
[
('00_jinja2_basic', None, None),
('01_empy', None, None),
('02_env', None, None),
(
'04_opts_set_from_env',
Expand Down Expand Up @@ -92,7 +83,6 @@ async def test_validate(monkeypatch, srcdir, envvars, args, cylc_validate_cli):
'srcdir, envvars',
[
('00_jinja2_basic', None),
('01_empy', None),
(
'04_opts_set_from_env',
{'ROSE_SUITE_OPT_CONF_KEYS': 'Gaelige'},
Expand Down Expand Up @@ -138,9 +128,7 @@ def test_warn_if_root_dir_set(root_dir_config, tmp_path, caplog):
)
@pytest.mark.parametrize(
'rose_config', [
'empy:suite.rc',
'jinja2:suite.rc',
'empy:flow.cylc',
'jinja2:flow.cylc',
'JinjA2:flOw.cylC',
]
Expand Down
28 changes: 1 addition & 27 deletions tests/unit/test_config_node.py
Original file line number Diff line number Diff line change
Expand Up @@ -200,14 +200,6 @@ def test_dump_rose_log(monkeypatch, tmp_path):
None,
id="OK - jinja2:suite.rc",
),
pytest.param(
(
(['empy:suite.rc', 'foo'], 'Hello World'),
),
'empy:suite.rc',
None,
id="OK - empy:suite.rc",
),
pytest.param(
(
('opt', 'a b'),
Expand All @@ -216,24 +208,6 @@ def test_dump_rose_log(monkeypatch, tmp_path):
None,
id="OK - no template variables section set",
),
pytest.param(
(
(['empy:suite.rc', 'foo'], 'Hello World'),
(['jinja2:suite.rc', 'foo'], 'Hello World'),
),
None,
MultipleTemplatingEnginesError,
id="FAILS - empy and jinja2 sections set",
),
pytest.param(
(
(['empy:suite.rc', 'foo'], 'Hello World'),
(['template variables', 'foo'], 'Hello World'),
),
None,
MultipleTemplatingEnginesError,
id="FAILS - empy and template variables sections set",
),
pytest.param(
(
(['file:stuffin', 'turkey'], 'gobble'),
Expand Down Expand Up @@ -351,7 +325,7 @@ def test_deprecation_warnings(

@pytest.mark.parametrize(
'tv_string',
(('template variables'), ('jinja2:suite.rc'), ('empy:suite.rc')),
(('template variables'), ('jinja2:suite.rc')),
)
def test_retrieve_installed_cli_opts(tmp_path, tv_string):
"""It merges src, dest and cli.
Expand Down
Loading

0 comments on commit 6ee5751

Please sign in to comment.