Mosaik API for Python
This is an implementation of the mosaik API for simulators written in Python. It hides all the messaging and networking related stuff and provides a simple base class that you can implement.
Installation
Just use pip to install it:
$ pip install mosaik-api
Documentation
Please refer to mosaik’s documentation of the API.
Example Simulator
This distribution contains an example simulator in the example_sim package.
It can be started via the pyexamplesim command; pyexamplesim --help shows you how to use it.
It can also be run in-process by importing and calling example_sim.mosaik.main().
Example MAS
This distribution contains an example “multi-agent system” that uses the asyncronous remote calls to mosaik (get_progress(), get_related_entities(), get_data(), set_data()).
It can be started via the pyexamplemas command; pyexamplemas --help shows you how to use it.
It can also be run in-process by importing and calling example_mas.mosaik.main().
Development setup
To setup a devleopment environment, create a virtualenv and install the packages from requirements.txt:
$ mkvirtualenv --python=/usr/bin/python3 mosaik-api-python
(mosaik-api-python)$ pip install -r requirements.txt
To run the tests for the Python version you are currently using, execute py.test. You should also add the test coverage check:
(mosaik-api-python)$ py.test --cov=example_mas --cov=example_sim --cov=mosaik_api
To run the tests for all supported Python versions, run tox:
(mosaik-api-python)$ tox
Mosaik’s documentation contains more details.
Changelog
2.4.2 - 2020-11-24
[FIX] Constrain simpy to version <4 due to simpy.io incompatibility
2.4 - 2019-02-05
[NEW] Simulator can now be started on a different node than mosaik, using the remote flag “-r” and the timeout flag “-t”. Mosaik can the integrate the simulator using the “connect” method of the simmanager.
2.3 – 2019-01-24
[BugFix] Bugfix Tests
2.2 – 2016-02-15
[NEW] API version 2.2: Added an optional “setup_done()” method.
[CHANGE] API version validation: The API version is no longer an integer but a “major.minor” string. The major part has to math with mosaiks major version. The minor part may be lower or equal to mosaik’s minor version.
[FIX] Various minor fixes and stability improvements.
2.1 – 2014-10-24
[NEW] Allow extra API methods to be called. See http://mosaik.readthedocs.org/en/2.0/mosaik-api/high-level.html#mosaik_api.Simulator
[CHANGE] The rel entry in the entity description returned by create() is now optional.
2.0 – 2014-09-22
Initial release of the mosaik 2 Sim API for Python.
Metadata
Release files for mosaik-api 2.4.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| mosaik-api-2.4.2.tar.gz | 18.8 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| mosaik_api-2.4.2-py2.py3-none-any.whl | Python 2, Python 3 | none | any | Details |
Total release size: 39.1 kB
Release files / mosaik-api-2.4.2.tar.gz
| Download URL | mosaik-api-2.4.2.tar.gz |
|---|---|
| Size | 18.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
04f9e262f5501099828bc010ebe8457286e9e528586f3a9a449a69bf6ebdfee7
|
|
BLAKE2b-256 checksum How to use checksums |
32c1b955e4ecf68e029ae18a5cc917dc57d339e27d025d0eda2d35078f3172cd
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/50.3.2 requests-toolbelt/0.9.1 tqdm/4.53.0 CPython/3.7.4
|
Release files / mosaik_api-2.4.2-py2.py3-none-any.whl
| Download URL | mosaik_api-2.4.2-py2.py3-none-any.whl |
|---|---|
| Size | 20.4 kB |
| Tags | Python 2 Python 3 |
|
SHA-256 checksum How to use checksums |
005502b52747ad807226cea8fc77fbf689905edc31aa6e32cf4eb5f089e43d65
|
|
BLAKE2b-256 checksum How to use checksums |
1f9c155f3d661b4abfa48f9e1b3f03fa5bbb6af2c3edf1f1fa8f4015f44a2c70
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/50.3.2 requests-toolbelt/0.9.1 tqdm/4.53.0 CPython/3.7.4
|