From aef8be0f2bee2a2091ffb06aca35ec7cb2706965 Mon Sep 17 00:00:00 2001 From: Lourens Veen Date: Wed, 25 Jan 2023 16:47:13 +0100 Subject: [PATCH 01/13] Print incorrect Identifier string when giving an error (#19) --- ymmsl/identity.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ymmsl/identity.py b/ymmsl/identity.py index 0f9b02f..b233a71 100644 --- a/ymmsl/identity.py +++ b/ymmsl/identity.py @@ -31,7 +31,8 @@ def __init__(self, seq: Any) -> None: raise ValueError('Identifiers must consist only of' ' lower- and uppercase letters, digits and' ' underscores, must start with a letter or' - ' an underscore, and must not be empty.') + ' an underscore, and must not be empty.' + ' "{}" is therefore invalid.'.format(self.data)) ReferencePart = Union[Identifier, int] From 27cb95f339d2d37b385b9c9fa206351c6302a5f6 Mon Sep 17 00:00:00 2001 From: Maarten Sebregts Date: Tue, 28 Mar 2023 15:12:25 +0200 Subject: [PATCH 02/13] Allow MPICoresResReq with script implementation --- tests/test_configuration.py | 5 +++-- ymmsl/configuration.py | 4 +++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/tests/test_configuration.py b/tests/test_configuration.py index 5c095ac..0f83c6d 100644 --- a/tests/test_configuration.py +++ b/tests/test_configuration.py @@ -232,8 +232,9 @@ def test_check_consistent(test_config6: Configuration) -> None: ExecutionModel.OPENMPI) test_config6.resources[Reference('singlethreaded')] = MPICoresResReq( Reference('singlethreaded'), 16, 8) - with pytest.raises(RuntimeError): - test_config6.check_consistent() + # singlethreaded is started with a script, for which we allow either + # MPICoresResReq or ThreadedResReq + test_config6.check_consistent() def test_load_nil_settings() -> None: diff --git a/ymmsl/configuration.py b/ymmsl/configuration.py index 516be0f..54f9fb2 100644 --- a/ymmsl/configuration.py +++ b/ymmsl/configuration.py @@ -322,7 +322,9 @@ def check_consistent(self) -> None: impl = self.implementations[comp.implementation] res = self.resources[comp.name] if impl.execution_model == ExecutionModel.DIRECT: - if not isinstance(res, ThreadedResReq): + if not isinstance(res, ThreadedResReq) and impl.script is None: + # Assume that people know what they're doing if they use + # script for specifying an implementation. raise RuntimeError(( 'Model component {}\'s implementation does not' ' specify MPI, but mpi_processes are specified in its' From 2696e7bfe877130c708fde32d2e5f55d05e5d81b Mon Sep 17 00:00:00 2001 From: Maarten Sebregts Date: Wed, 29 Mar 2023 12:00:23 +0200 Subject: [PATCH 03/13] Improve error when implementation is not a mapping --- ymmsl/execution.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ymmsl/execution.py b/ymmsl/execution.py index bdacf2f..1daf850 100644 --- a/ymmsl/execution.py +++ b/ymmsl/execution.py @@ -207,8 +207,8 @@ def __init__( @classmethod def _yatiml_recognize(cls, node: yatiml.UnknownNode) -> None: # There's no ambiguity, and we want to allow some leeway - # and savorize things, so disable recognition. - pass + # and savorize things, so only require that the node is a mapping. + node.require_mapping() @classmethod def _yatiml_savorize(cls, node: yatiml.Node) -> None: From 8ece935147d8c738ff5dcdea4b860e50dc1f6973 Mon Sep 17 00:00:00 2001 From: Lourens Veen Date: Sat, 16 Mar 2024 15:40:01 +0100 Subject: [PATCH 04/13] Fix comparison of Settings objects --- ymmsl/settings.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/ymmsl/settings.py b/ymmsl/settings.py index eb84b9c..dfb6cea 100644 --- a/ymmsl/settings.py +++ b/ymmsl/settings.py @@ -41,10 +41,13 @@ def __init__( self[key] = deepcopy(value) def __eq__(self, other: Any) -> bool: - """Returns whether keys and values are identical.""" + """Returns whether keys and values are identical. + + The comparison ignores the order of the settings. + """ if not isinstance(other, Settings): return NotImplemented - return self._store == other._store + return dict(self._store.items()) == dict(other._store.items()) def __str__(self) -> str: """Represent as a string.""" From 5c04b0e43999285e0d00e44b5d830a862fd84a4c Mon Sep 17 00:00:00 2001 From: Lourens Veen Date: Sun, 17 Mar 2024 21:32:28 +0100 Subject: [PATCH 05/13] Update to YAtiML 0.11.1 --- setup.py | 3 +-- tests/conftest.py | 2 +- tox.ini | 3 ++- ymmsl/checkpoint.py | 2 +- ymmsl/component.py | 4 ++-- ymmsl/configuration.py | 2 +- ymmsl/execution.py | 2 +- 7 files changed, 9 insertions(+), 9 deletions(-) diff --git a/setup.py b/setup.py index d85ee53..da2f5b0 100644 --- a/setup.py +++ b/setup.py @@ -37,7 +37,6 @@ python_requires='>=3.7, <4', test_suite='tests', install_requires=[ - 'ruamel.yaml<=0.17.21,!=0.17.5', - 'yatiml>=0.10.0,<0.11.0' + 'yatiml>=0.11.1,<0.12.0' ], ) diff --git a/tests/conftest.py b/tests/conftest.py index b80252d..8b89710 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -421,7 +421,7 @@ def test_yaml8() -> str: ' keeps_state_for_next_use: helpful\n' ' micro2_fortran:\n' ' executable: bin/micro2\n' - ' keeps_state_for_next_use: no\n' + ' keeps_state_for_next_use: \'no\'\n' 'resources:\n' ' macro:\n' ' threads: 1\n' diff --git a/tox.ini b/tox.ini index 5cf5724..02f1766 100644 --- a/tox.ini +++ b/tox.ini @@ -8,10 +8,11 @@ deps = flake8 pytest pytest-cov + types-PyYAML commands = mypy - pytest + pytest {posargs} flake8 ymmsl [gh-actions] diff --git a/ymmsl/checkpoint.py b/ymmsl/checkpoint.py index e0d08a5..70030e6 100644 --- a/ymmsl/checkpoint.py +++ b/ymmsl/checkpoint.py @@ -2,7 +2,7 @@ from typing import List, Optional, Union -from ruamel import yaml +import yaml import yatiml diff --git a/ymmsl/component.py b/ymmsl/component.py index 440a16e..d04d9fd 100644 --- a/ymmsl/component.py +++ b/ymmsl/component.py @@ -5,7 +5,7 @@ from typing import Dict # noqa: F401 from typing import Iterable, List, Optional, Union -import ruamel.yaml as yaml +import yaml import yatiml from ymmsl.identity import Identifier, Reference @@ -308,5 +308,5 @@ def _yatiml_sweeten(cls, node: yatiml.Node) -> None: node.set_attribute('multiplicity', items[0].get_value()) ports_node = node.get_attribute('ports').yaml_node - if len(ports_node.value) == 0: + if ports_node.tag == 'tag:yaml.org,2002:null': node.remove_attribute('ports') diff --git a/ymmsl/configuration.py b/ymmsl/configuration.py index 516be0f..2de695e 100644 --- a/ymmsl/configuration.py +++ b/ymmsl/configuration.py @@ -7,7 +7,7 @@ Dict, List, MutableMapping, Optional, Sequence, Union, cast) import yatiml -from ruamel import yaml +import yaml from ymmsl.checkpoint import Checkpoints from ymmsl.document import Document diff --git a/ymmsl/execution.py b/ymmsl/execution.py index bdacf2f..657835f 100644 --- a/ymmsl/execution.py +++ b/ymmsl/execution.py @@ -3,7 +3,7 @@ from pathlib import Path from typing import cast, Dict, List, Optional, Union -from ruamel import yaml +import yaml import yatiml from ymmsl.identity import Reference From a164909910695e162edfba6fefbbe5e18c47670c Mon Sep 17 00:00:00 2001 From: Lourens Veen Date: Sun, 28 Jul 2024 21:09:16 +0200 Subject: [PATCH 06/13] Add a .readthedocs.yaml, which is now required --- .readthedocs.yaml | 13 +++++++++++++ rtd-requirements.txt => docs/requirements.txt | 0 2 files changed, 13 insertions(+) create mode 100644 .readthedocs.yaml rename rtd-requirements.txt => docs/requirements.txt (100%) diff --git a/.readthedocs.yaml b/.readthedocs.yaml new file mode 100644 index 0000000..97cf712 --- /dev/null +++ b/.readthedocs.yaml @@ -0,0 +1,13 @@ +version: 2 + +build: + os: ubuntu-22.04 + tools: + python: "3.12" + +python: + install: + - requirements: docs/requirements.txt + +sphinx: + configuration: docs/conf.py diff --git a/rtd-requirements.txt b/docs/requirements.txt similarity index 100% rename from rtd-requirements.txt rename to docs/requirements.txt From 15d2c3ff6bd3a593a56b0169ccdd12d7b2e0a6aa Mon Sep 17 00:00:00 2001 From: Lourens Veen Date: Sun, 28 Jul 2024 21:29:17 +0200 Subject: [PATCH 07/13] Have RTD install its own theme (?) --- docs/requirements.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/requirements.txt b/docs/requirements.txt index c18b3e0..d687582 100644 --- a/docs/requirements.txt +++ b/docs/requirements.txt @@ -1 +1,2 @@ +sphinx-rtd-theme yatiml From 29e05a520abc5a6c1d898e3a2124fe0d887d5ed0 Mon Sep 17 00:00:00 2001 From: Lourens Veen Date: Sun, 28 Jul 2024 21:36:17 +0200 Subject: [PATCH 08/13] Update copyright statement --- README.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.rst b/README.rst index ae53d11..6a17d39 100644 --- a/README.rst +++ b/README.rst @@ -48,6 +48,6 @@ Legal ***** ymmsl_python is Copyright 2018-2023 Netherlands eScience Center and University -of Amsterdam, and Copyright 2022-2023 ITER Organisation. Licensed under the -Apache 2.0 license. +of Amsterdam, Copyright 2022-2023 The ITER Organisation, and Copyright 2024 +Netherlands eScience Center. Licensed under the Apache 2.0 license. From b39db0ca7a452e9805cee872293a30ad93802fca Mon Sep 17 00:00:00 2001 From: Lourens Veen Date: Sun, 28 Jul 2024 21:40:25 +0200 Subject: [PATCH 09/13] Add Python 3.12 and remove 3.7 --- .github/workflows/ci_python_compatibility.yaml | 2 +- setup.py | 2 ++ tox.ini | 4 ++-- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci_python_compatibility.yaml b/.github/workflows/ci_python_compatibility.yaml index 6c36846..6abfaa9 100644 --- a/.github/workflows/ci_python_compatibility.yaml +++ b/.github/workflows/ci_python_compatibility.yaml @@ -6,7 +6,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - python-version: ["3.7", "3.8", "3.9", "3.10", "3.11"] + python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"] steps: - name: Check out the source code diff --git a/setup.py b/setup.py index da2f5b0..8246e4d 100644 --- a/setup.py +++ b/setup.py @@ -33,6 +33,8 @@ 'Programming Language :: Python :: 3.8', 'Programming Language :: Python :: 3.9', 'Programming Language :: Python :: 3.10', + 'Programming Language :: Python :: 3.11', + 'Programming Language :: Python :: 3.12', ], python_requires='>=3.7, <4', test_suite='tests', diff --git a/tox.ini b/tox.ini index 02f1766..9669a0d 100644 --- a/tox.ini +++ b/tox.ini @@ -1,5 +1,5 @@ [tox] -envlist = py37, py38, py39, py310, py311 +envlist = py38, py39, py310, py311, py312 skip_missing_interpreters = true [testenv] @@ -17,11 +17,11 @@ commands = [gh-actions] python = - 3.7: py37 3.8: py38 3.9: py39 3.10: py310 3.11: py311 + 3.12: py312 [pycodestyle] max-doc-length = 80 From 1192d4955747a9ffa47e01c58e55c263be0e76f7 Mon Sep 17 00:00:00 2001 From: Lourens Veen Date: Sun, 28 Jul 2024 21:49:27 +0200 Subject: [PATCH 10/13] Update GitHub actions versions --- .github/workflows/ci.yaml | 2 +- .github/workflows/ci_python_compatibility.yaml | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 27445e0..93f5ec9 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -6,7 +6,7 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - name: Run the test suite run: | diff --git a/.github/workflows/ci_python_compatibility.yaml b/.github/workflows/ci_python_compatibility.yaml index 6abfaa9..ba7acb7 100644 --- a/.github/workflows/ci_python_compatibility.yaml +++ b/.github/workflows/ci_python_compatibility.yaml @@ -10,15 +10,15 @@ jobs: steps: - name: Check out the source code - uses: actions/checkout@v2 + uses: actions/checkout@v4 - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v3 + uses: actions/setup-python@v5 with: python-version: ${{ matrix.python-version }} - name: Cache Tox - uses: actions/cache@v1 + uses: actions/cache@v4 with: path: ${{ github.workspace }}/.tox key: python-compatibility-${{ matrix.python-version }}-tox From faf67cf1cfd60ad4ba1d7c1139a635fc352c8665 Mon Sep 17 00:00:00 2001 From: Lourens Veen Date: Sun, 28 Jul 2024 21:58:07 +0200 Subject: [PATCH 11/13] Add version 0.13.1 to the change log --- CHANGELOG.rst | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 150ec13..a8dbaab 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -5,6 +5,26 @@ Change Log All notable changes to this project will be documented in this file. This project adheres to `Semantic Versioning `_. +0.13.1 +****** + +Added +----- + +- Support for Python 3.12 +- Show incorrect Identifier in the error message + +Changed +------- + +- Replace ruamel.yaml with PyYAML dependency via YAtiML update + +Removed +------- + +- Support for Python 3.7 + + 0.13.0 ****** From 6d46a1c5ab741bea202da041852363cde308d516 Mon Sep 17 00:00:00 2001 From: Lourens Veen Date: Sun, 28 Jul 2024 22:07:30 +0200 Subject: [PATCH 12/13] Set release version to 0.13.1 --- docs/conf.py | 2 +- setup.py | 2 +- ymmsl/__init__.py | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/conf.py b/docs/conf.py index 657dc84..cc8f263 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -63,7 +63,7 @@ # The short X.Y version. version = u'0.13.1' # The full version, including alpha/beta/rc tags. -release = u'0.13.1-dev' +release = u'0.13.1' # The language for content autogenerated by Sphinx. Refer to documentation # for a list of supported languages. diff --git a/setup.py b/setup.py index 8246e4d..6ed4818 100644 --- a/setup.py +++ b/setup.py @@ -8,7 +8,7 @@ setup( name='ymmsl', - version='0.13.1-dev', + version='0.13.1', description="Python bindings for the YAML version of the Multiscale Modeling and Simulation Language", long_description=readme + '\n\n', author="Lourens Veen", diff --git a/ymmsl/__init__.py b/ymmsl/__init__.py index 415fbc0..3ca1af8 100644 --- a/ymmsl/__init__.py +++ b/ymmsl/__init__.py @@ -17,7 +17,7 @@ from ymmsl.model import Conduit, Model, ModelReference -__version__ = '0.13.1-dev' +__version__ = '0.13.1' __author__ = 'Lourens Veen' __email__ = 'l.veen@esciencecenter.nl' From a572c56378b28b3f5232c3423edbc8e32a8b6a17 Mon Sep 17 00:00:00 2001 From: Lourens Veen Date: Sun, 28 Jul 2024 22:08:46 +0200 Subject: [PATCH 13/13] Update badges to point to master --- README.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.rst b/README.rst index 6a17d39..dd897d3 100644 --- a/README.rst +++ b/README.rst @@ -1,5 +1,5 @@ -.. image:: https://readthedocs.org/projects/ymmsl-python/badge/?version=develop - :target: https://ymmsl-python.readthedocs.io/en/latest/?badge=develop +.. image:: https://readthedocs.org/projects/ymmsl-python/badge/?version=master + :target: https://ymmsl-python.readthedocs.io/en/latest/?badge=master :alt: Documentation Build Status .. image:: https://github.com/multiscale/ymmsl-python/workflows/continuous_integration/badge.svg