Skip to content

Commit

Permalink
Merge branch 'release-0.13.1'
Browse files Browse the repository at this point in the history
  • Loading branch information
LourensVeen committed Jul 28, 2024
2 parents 4e87f7a + a572c56 commit cc67d1e
Show file tree
Hide file tree
Showing 19 changed files with 74 additions and 31 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4

- name: Run the test suite
run: |
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/ci_python_compatibility.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,19 @@ 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
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
Expand Down
13 changes: 13 additions & 0 deletions .readthedocs.yaml
Original file line number Diff line number Diff line change
@@ -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
20 changes: 20 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,26 @@ Change Log
All notable changes to this project will be documented in this file.
This project adheres to `Semantic Versioning <http://semver.org/>`_.

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
******

Expand Down
4 changes: 2 additions & 2 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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.

4 changes: 2 additions & 2 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,9 @@
# built documents.
#
# The short X.Y version.
version = u'0.13.0'
version = u'0.13.1'
# The full version, including alpha/beta/rc tags.
release = u'0.13.0'
release = u'0.13.1'

# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
Expand Down
2 changes: 2 additions & 0 deletions docs/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
sphinx-rtd-theme
yatiml
1 change: 0 additions & 1 deletion rtd-requirements.txt

This file was deleted.

7 changes: 4 additions & 3 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

setup(
name='ymmsl',
version='0.13.0',
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",
Expand All @@ -33,11 +33,12 @@
'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',
install_requires=[
'ruamel.yaml<=0.17.21,!=0.17.5',
'yatiml>=0.10.0,<0.11.0'
'yatiml>=0.11.1,<0.12.0'
],
)
2 changes: 1 addition & 1 deletion tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
5 changes: 3 additions & 2 deletions tests/test_configuration.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
7 changes: 4 additions & 3 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[tox]
envlist = py37, py38, py39, py310, py311
envlist = py38, py39, py310, py311, py312
skip_missing_interpreters = true

[testenv]
Expand All @@ -8,19 +8,20 @@ deps =
flake8
pytest
pytest-cov
types-PyYAML

commands =
mypy
pytest
pytest {posargs}
flake8 ymmsl

[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
Expand Down
2 changes: 1 addition & 1 deletion ymmsl/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
from ymmsl.model import Conduit, Model, ModelReference


__version__ = '0.13.0'
__version__ = '0.13.1'
__author__ = 'Lourens Veen'
__email__ = '[email protected]'

Expand Down
2 changes: 1 addition & 1 deletion ymmsl/checkpoint.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

from typing import List, Optional, Union

from ruamel import yaml
import yaml
import yatiml


Expand Down
4 changes: 2 additions & 2 deletions ymmsl/component.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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')
6 changes: 4 additions & 2 deletions ymmsl/configuration.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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'
Expand Down
6 changes: 3 additions & 3 deletions ymmsl/execution.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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:
Expand Down
3 changes: 2 additions & 1 deletion ymmsl/identity.py
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down
7 changes: 5 additions & 2 deletions ymmsl/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -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."""
Expand Down

0 comments on commit cc67d1e

Please sign in to comment.