Skip to content

Commit 8e3d418

Browse files
committed
Merge branch 'release-0.15.0'
2 parents 0b98d51 + 1885f1e commit 8e3d418

94 files changed

Lines changed: 7866 additions & 966 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/ci_python_compatibility.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ jobs:
66
runs-on: ubuntu-latest
77
strategy:
88
matrix:
9-
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
9+
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13", "3.14"]
1010

1111
steps:
1212
- name: Check out the source code

CHANGELOG.rst

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,36 @@ Change Log
55
All notable changes to this project will be documented in this file.
66
This project adheres to `Semantic Versioning <http://semver.org/>`_.
77

8+
0.15.0
9+
******
10+
11+
Added
12+
-----
13+
14+
- yMMSL v0.2
15+
- Support for nested models
16+
- Import statements
17+
- Supported settings
18+
- Entries for documentation
19+
- Timeline declarations on ports
20+
- Conduit filter declarations
21+
- Custom implementations
22+
- yMMSL file converter
23+
- Automatic conversion on load
24+
25+
- Support for Python 3.13 and 3.14
26+
27+
Changed
28+
-------
29+
30+
- Moved yMMSL v0.1 declarations into ymmsl.v0_1
31+
32+
Removed
33+
-------
34+
35+
- Support for Python 3.8
36+
37+
838
0.14.0
939
******
1040

README.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,6 @@ Legal
4848
*****
4949

5050
ymmsl_python is Copyright 2018-2023 Netherlands eScience Center and University
51-
of Amsterdam, Copyright 2022-2023 The ITER Organisation, and Copyright 2024
52-
Netherlands eScience Center. Licensed under the Apache 2.0 license.
51+
of Amsterdam, Copyright 2022-2023, 2026 The ITER Organisation, and Copyright
52+
2024-2026 Netherlands eScience Center. Licensed under the Apache 2.0 license.
5353

docs/api.rst

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,21 @@
1-
API documentation
2-
-----------------
1+
API reference
2+
-------------
3+
4+
Package ymmsl
5+
`````````````
6+
37
.. automodule:: ymmsl
48
:members:
9+
10+
Package ymmsl.v0_2
11+
``````````````````
12+
13+
.. automodule:: ymmsl.v0_2
14+
:members:
15+
16+
Package ymmsl.v0_1
17+
``````````````````
18+
19+
.. automodule:: ymmsl.v0_1
20+
:members:
21+

docs/basic_usage.rst

Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
Basic usage
2+
===========
3+
4+
A yMMSL file is a YAML file that looks approximately like this:
5+
6+
.. literalinclude:: example_model.ymmsl
7+
:caption: ``docs/example_model.ymmsl``
8+
:language: yaml
9+
10+
yMMSL files can contain descriptions of multiscale and multiphysics coupled models (as
11+
above), settings to configure the models, programs to use to run them, and other
12+
information needed to run a simulation like compute resources to use and when to
13+
checkpoint.
14+
15+
The yMMSL YAML format is supported by the ymmsl-python library, whose documentation you
16+
are currently reading. This library lets you read and write yMMSL files, and manipulate
17+
their contents using an object-based Python API.
18+
19+
Installation
20+
------------
21+
22+
ymmsl-python is on PyPI, so you can install it using Pip:
23+
24+
.. code-block:: bash
25+
26+
pip install ymmsl
27+
28+
or you can add it to your dependencies as usual, e.g. in your ``setup.py`` or your
29+
``pyproject.toml``, depending on how you've set up your project.
30+
31+
Reading yMMSL files
32+
-------------------
33+
34+
Here is an example of loading a yMMSL file:
35+
36+
.. code-block:: python
37+
38+
from pathlib import Path
39+
import ymmsl
40+
41+
config = ymmsl.load(Path('docs/example_model.ymmsl'))
42+
43+
This makes ``config`` an object of type :class:`.ymmsl.v0_2.Configuration`, which is the
44+
top-level class describing a yMMSL document. More on these objects in the next section.
45+
The :func:`ymmsl.load` function can also load from an open file or from a string
46+
containing YAML data.
47+
48+
If the file is not recognized as a yMMSL file, the library will raise a
49+
:class:`yatiml.RecognitionError` with a message describing in detail what is wrong, so
50+
that you can easily fix the file.
51+
52+
Note that the :func:`ymmsl.load` function uses the safe loading functionality of the
53+
underlying YAML library, so that you can safely load files from untrusted sources.
54+
55+
Writing yMMSL files
56+
-------------------
57+
58+
To write a yMMSL file with the contents of a :class:`.ymmsl.v0_2.Configuration`, we use
59+
``ymmsl.save``:
60+
61+
.. code-block:: python
62+
63+
from pathlib import Path
64+
from ymmsl.v0_2 import Component, Configuration, Model, Ports, Settings
65+
import ymmsl
66+
67+
model = Model(
68+
'example_model', components=[Component('macro', Ports(), 'The macro model')])
69+
settings = Settings({'example_parameter': 42})
70+
config = Configuration(model, settings)
71+
72+
ymmsl.save(config, Path('out.ymmsl'))
73+
74+
Here, we create a model named ``example_model``, containing a single component named
75+
``macro``, and no conduits. For the settings, we create a Settings object, which is a
76+
container for a dictionary of settings.
77+
78+
Finally, we combine the model and the settings into a :class:`.ymmsl.v0_2.Configuration`
79+
object, which we then save to a file. If you want to have the YAML as a string, use
80+
:func:`ymmsl.dump` instead.
81+
82+
As the format develops over time, files are required to carry a version, in this case
83+
v0.2, which is currently the latest version of yMMSL.
84+
85+
When you read in a yMMSL file as described above, you get a collection of Python
86+
objects describing its contents. The next section explains how those work.

docs/conf.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,17 +53,17 @@
5353

5454
# General information about the project.
5555
project = u'yMMSL Python bindings'
56-
copyright = u'2018-2023, Netherlands eScience Center and University of Amsterdam, 2022-2023 ITER Organisation'
56+
copyright = u'2018-2023, Netherlands eScience Center and University of Amsterdam, 2022-2023, 2026 The ITER Organisation, 2024-2026 Netherlands eScience Center'
5757
author = u'Lourens Veen'
5858

5959
# The version info for the project you're documenting, acts as replacement for
6060
# |version| and |release|, also used in various other places throughout the
6161
# built documents.
6262
#
6363
# The short X.Y version.
64-
version = u'0.14.0'
64+
version = u'0.15.0'
6565
# The full version, including alpha/beta/rc tags.
66-
release = u'0.14.0'
66+
release = u'0.15.0'
6767

6868
# The language for content autogenerated by Sphinx. Refer to documentation
6969
# for a list of supported languages.

docs/creating_from_python.rst

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
Creating yMMSL from Python
2+
--------------------------
3+
4+
yMMSL files are YAML files, and yMMSL is usually written in YAML. In fact, even if you
5+
want to create a yMMSL configuration in Python, it's often convenient to just embed a
6+
string containing a YAML description and converting it to objects using
7+
:func:`ymmsl.load`.
8+
9+
However, all the classes mentioned here are normal Python classes. They have
10+
constructors which you can use to create instances, and their attributes can be changed
11+
as needed.
12+
13+
This example shows creating a yMMSL configuration in Python and saving it to a file.
14+
15+
.. literalinclude:: from_python.py
16+
:caption: Creating a Configuration and saving it (``docs/from_python.py``)
17+
:language: python
18+
19+
This will output:
20+
21+
.. literalinclude:: from_python.ymmsl
22+
:caption: Output of ``from_python.py`` (``docs/from_python.ymmsl``)
23+
:language: yaml
24+
25+
26+
Another use case is loading a yMMSL file and modifying it:
27+
28+
.. literalinclude:: load_modify_save.py
29+
:caption: Loading, modifying, and saving a yMMSL file (``docs/load_modify_save.py``)
30+
:language: python
31+
32+
For more details about these classes and what you can do with them, we refer to the API
33+
documentation.

docs/data_model_overview.rst

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
Data model overview
2+
===================
3+
4+
As shown on the previous page, the ``ymmsl-python`` library converts yMMSL from
5+
YAML to Python objects and back. Here, we dive into this a bit deeper and see
6+
how those Python objects can be used.
7+
8+
This section gives an overview of the data model, but its goal is not to provide an
9+
introduction to the concepts or an explanation of how they're used. Instead, it provides
10+
an overview of what is where. If you're new to yMMSL and MUSCLE3, then you should read
11+
the `MUSCLE3 documentation`_ first. There, you'll find a from-scratch tutorial that will
12+
help you get started.
13+
14+
yMMSL files can be used to describe four kinds of things:
15+
16+
1. Models
17+
18+
A model description describes the components a coupled model consists of and how
19+
they are connected together so that they can exchange information while running. This
20+
is an abstract description, it may specify programs to run but not how to start or
21+
configure them.
22+
23+
2. Scenarios
24+
25+
Settings configure a model to match a specific scenario. This entails setting
26+
parameters and other model options, and even replacing or filling in implementations
27+
for some of the components if the model was designed with a flexible structure.
28+
29+
3. Programs
30+
31+
To actually run a simulation on some kind of computer, programs need to be available
32+
that do the calculations. We need to describe how to start them on the computer we
33+
want to run on, which depends on how they were installed there. This too can be
34+
described in yMMSL.
35+
36+
4. Runs
37+
38+
Finally, additional technical information on how to run the simulation can be
39+
specified. This includes resources to use for each component (threads or MPI
40+
processes), and configuration of checkpointing and resuming.
41+
42+
43+
These are explained in more detail in the following sections.
44+
45+
.. _MUSCLE3 documentation: https://muscle3.readthedocs.io

0 commit comments

Comments
 (0)