vivarium-interactive 1.0.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- vivarium_interactive-1.0.0/.readthedocs.yaml +37 -0
- vivarium_interactive-1.0.0/CHANGELOG.rst +4 -0
- vivarium_interactive-1.0.0/Jenkinsfile +39 -0
- vivarium_interactive-1.0.0/LICENSE +27 -0
- vivarium_interactive-1.0.0/Makefile +129 -0
- vivarium_interactive-1.0.0/PKG-INFO +85 -0
- vivarium_interactive-1.0.0/README.rst +37 -0
- vivarium_interactive-1.0.0/docs/nitpick-exceptions +62 -0
- vivarium_interactive-1.0.0/docs/source/_static/style.css +3 -0
- vivarium_interactive-1.0.0/docs/source/api_reference.rst +3 -0
- vivarium_interactive-1.0.0/docs/source/conf.py +119 -0
- vivarium_interactive-1.0.0/docs/source/index.rst +18 -0
- vivarium_interactive-1.0.0/docs/source/tutorials/exploration.rst +1107 -0
- vivarium_interactive-1.0.0/docs/source/tutorials/interactive.rst +567 -0
- vivarium_interactive-1.0.0/pyproject.toml +115 -0
- vivarium_interactive-1.0.0/python_versions.json +1 -0
- vivarium_interactive-1.0.0/setup.cfg +4 -0
- vivarium_interactive-1.0.0/src/vivarium/interactive/__init__.py +22 -0
- vivarium_interactive-1.0.0/src/vivarium/interactive/exceptions.py +13 -0
- vivarium_interactive-1.0.0/src/vivarium/interactive/py.typed +0 -0
- vivarium_interactive-1.0.0/src/vivarium/interactive/simulation.py +1248 -0
- vivarium_interactive-1.0.0/src/vivarium/interactive/utilities.py +78 -0
- vivarium_interactive-1.0.0/src/vivarium_interactive.egg-info/PKG-INFO +85 -0
- vivarium_interactive-1.0.0/src/vivarium_interactive.egg-info/SOURCES.txt +32 -0
- vivarium_interactive-1.0.0/src/vivarium_interactive.egg-info/dependency_links.txt +1 -0
- vivarium_interactive-1.0.0/src/vivarium_interactive.egg-info/requires.txt +29 -0
- vivarium_interactive-1.0.0/src/vivarium_interactive.egg-info/scm_file_list.json +29 -0
- vivarium_interactive-1.0.0/src/vivarium_interactive.egg-info/scm_version.json +8 -0
- vivarium_interactive-1.0.0/src/vivarium_interactive.egg-info/top_level.txt +1 -0
- vivarium_interactive-1.0.0/tests/__init__.py +0 -0
- vivarium_interactive-1.0.0/tests/conftest.py +78 -0
- vivarium_interactive-1.0.0/tests/helpers.py +472 -0
- vivarium_interactive-1.0.0/tests/test_simulation.py +2137 -0
- vivarium_interactive-1.0.0/tests/test_utilities.py +16 -0
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
# Paths are repo-root-relative even when this file lives in a subdirectory,
|
|
2
|
+
# so the package path must be qualified with libs/interactive/.
|
|
3
|
+
#
|
|
4
|
+
# This file is read by RTD only when the vivarium-interactive RTD
|
|
5
|
+
# project's Admin > Advanced Settings > "Path for .readthedocs.yaml" points
|
|
6
|
+
# here. The root-level /.readthedocs.yaml is a placeholder used by the
|
|
7
|
+
# import wizard and ignored for any project that has overridden the path.
|
|
8
|
+
version: 2
|
|
9
|
+
|
|
10
|
+
sphinx:
|
|
11
|
+
configuration: libs/interactive/docs/source/conf.py
|
|
12
|
+
fail_on_warning: true
|
|
13
|
+
|
|
14
|
+
build:
|
|
15
|
+
os: ubuntu-22.04
|
|
16
|
+
tools:
|
|
17
|
+
python: "3.13"
|
|
18
|
+
jobs:
|
|
19
|
+
post_checkout:
|
|
20
|
+
- git fetch --unshallow origin 2>/dev/null || git fetch origin main
|
|
21
|
+
# Cancel PR (external) builds that don't touch this lib (Exit 183 is RTD's
|
|
22
|
+
# signal to cancel the build immediately).
|
|
23
|
+
- |
|
|
24
|
+
if [ "$READTHEDOCS_VERSION_TYPE" = "external" ] && git diff --quiet "origin/main...HEAD" -- libs/interactive/; then
|
|
25
|
+
echo "Skipping docs build: this PR changes nothing under libs/interactive/."
|
|
26
|
+
exit 183
|
|
27
|
+
fi
|
|
28
|
+
|
|
29
|
+
python:
|
|
30
|
+
install:
|
|
31
|
+
- method: pip
|
|
32
|
+
path: libs/interactive
|
|
33
|
+
extra_requirements:
|
|
34
|
+
- docs
|
|
35
|
+
|
|
36
|
+
formats:
|
|
37
|
+
- pdf
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/* This Jenkinsfile simply loads the `reusable_pipeline` pipeline from the
|
|
2
|
+
vivarium-build-utils package, which lives at ``libs/build-utils/`` inside the
|
|
3
|
+
``ihmeuw/vivarium-suite`` monorepo (https://github.com/ihmeuw/vivarium-suite).
|
|
4
|
+
|
|
5
|
+
vivarium-build-utils is loaded as a Jenkins shared library
|
|
6
|
+
(https://www.jenkins.io/doc/book/pipeline/shared-libraries/).
|
|
7
|
+
Jenkins shared library convention dictates that importable modules must be stored
|
|
8
|
+
in the 'vars' folder.
|
|
9
|
+
|
|
10
|
+
Jenkins shared libraries can be configured in the Jenkins UI:
|
|
11
|
+
* Manage Jenkins
|
|
12
|
+
* Configure System
|
|
13
|
+
* Global Pipeline Libraries section
|
|
14
|
+
* Library subsection
|
|
15
|
+
* Name: The Name for the lib
|
|
16
|
+
* Version: The branch you want to use. Throws an error
|
|
17
|
+
for nonexistent branches.
|
|
18
|
+
* Project Repository: Url to the shared lib
|
|
19
|
+
* Credentials: SSH key to access the repo
|
|
20
|
+
|
|
21
|
+
Note that updating the shared repo will take effect on the next pipeline invocation.
|
|
22
|
+
*/
|
|
23
|
+
|
|
24
|
+
// Load the get_vbu_version function from build-utils/bootstrap/
|
|
25
|
+
// (the directory to load from is defined in the Jenkins shared library configuration)
|
|
26
|
+
@Library("get_vbu_version@main") _
|
|
27
|
+
|
|
28
|
+
// Load the full vivarium_build_utils library at the expected version
|
|
29
|
+
library("vivarium_build_utils@${get_vbu_version()}")
|
|
30
|
+
|
|
31
|
+
reusable_pipeline(
|
|
32
|
+
scheduled_branches: [
|
|
33
|
+
// Add additional branches for cron jobs below.
|
|
34
|
+
// Note: Newly added branches will require a manual trigger of the first build
|
|
35
|
+
// for subsequent scheduled builds to run.
|
|
36
|
+
"main"
|
|
37
|
+
],
|
|
38
|
+
env_reqs: "ci_jenkins",
|
|
39
|
+
)
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
BSD 3-Clause License
|
|
2
|
+
|
|
3
|
+
Copyright 2018 Institute for Health Metrics and Evaluation
|
|
4
|
+
|
|
5
|
+
Redistribution and use in source and binary forms, with or without modification,
|
|
6
|
+
are permitted provided that the following conditions are met:
|
|
7
|
+
|
|
8
|
+
1. Redistributions of source code must retain the above copyright notice, this list
|
|
9
|
+
of conditions and the following disclaimer.
|
|
10
|
+
|
|
11
|
+
2. Redistributions in binary form must reproduce the above copyright notice, this
|
|
12
|
+
list of conditions and the following disclaimer in the documentation and/or other
|
|
13
|
+
materials provided with the distribution.
|
|
14
|
+
|
|
15
|
+
3. Neither the name of the copyright holder nor the names of its contributors may
|
|
16
|
+
be used to endorse or promote products derived from this software without specific
|
|
17
|
+
prior written permission.
|
|
18
|
+
|
|
19
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS “AS IS” AND ANY
|
|
20
|
+
EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
|
21
|
+
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
|
|
22
|
+
SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
|
23
|
+
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
|
|
24
|
+
OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
|
25
|
+
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
26
|
+
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
|
27
|
+
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
# Check if we're running in Jenkins
|
|
2
|
+
ifdef JENKINS_URL
|
|
3
|
+
# Files are already in workspace from shared library
|
|
4
|
+
MAKE_INCLUDES := .
|
|
5
|
+
else
|
|
6
|
+
# For local dev, use the installed vivarium.build_utils package if it exists
|
|
7
|
+
# First, check if we can import vivarium.build_utils and assign 'yes' or 'no'.
|
|
8
|
+
# We do this by importing the package in python and redirecting stderr to the null device.
|
|
9
|
+
# If the import is successful (&&), it will print 'yes', otherwise (||) it will print 'no'.
|
|
10
|
+
VIVARIUM_BUILD_UTILS_AVAILABLE := $(shell python -c "import vivarium.build_utils" 2>/dev/null && echo "yes" || echo "no")
|
|
11
|
+
# If vivarium.build_utils is available, get the makefiles path or else set it to empty
|
|
12
|
+
ifeq ($(VIVARIUM_BUILD_UTILS_AVAILABLE),yes)
|
|
13
|
+
MAKE_INCLUDES := $(shell python -c "from vivarium.build_utils.resources import get_makefiles_path; print(get_makefiles_path())")
|
|
14
|
+
else
|
|
15
|
+
MAKE_INCLUDES :=
|
|
16
|
+
endif
|
|
17
|
+
endif
|
|
18
|
+
|
|
19
|
+
# Set the package name as the last part of this file's parent directory path
|
|
20
|
+
PACKAGE_NAME = $(notdir $(CURDIR))
|
|
21
|
+
|
|
22
|
+
ifneq ($(MAKE_INCLUDES),) # not empty
|
|
23
|
+
# Include makefiles from vivarium.build_utils
|
|
24
|
+
include $(MAKE_INCLUDES)/base.mk
|
|
25
|
+
include $(MAKE_INCLUDES)/test.mk
|
|
26
|
+
else # empty
|
|
27
|
+
# Use this help message (since the vivarium.build_utils version is not available)
|
|
28
|
+
help:
|
|
29
|
+
@echo
|
|
30
|
+
@echo "For Make's standard help, run 'make --help'."
|
|
31
|
+
@echo
|
|
32
|
+
@echo "Most of our Makefile targets are provided by the vivarium.build_utils"
|
|
33
|
+
@echo "package. To access them, you need to create a development environment first."
|
|
34
|
+
@echo
|
|
35
|
+
@echo "make build-env"
|
|
36
|
+
@echo
|
|
37
|
+
@echo "USAGE:"
|
|
38
|
+
@echo " make build-env [name=<environment name>] [py=<python version>] [artifactory_access=<yes|no>] [keep_env=<yes|no>]"
|
|
39
|
+
@echo
|
|
40
|
+
@echo "ARGUMENTS:"
|
|
41
|
+
@echo " name [optional]"
|
|
42
|
+
@echo " Name of the conda environment to create (defaults to <PACKAGE_NAME>)"
|
|
43
|
+
@echo " py [optional]"
|
|
44
|
+
@echo " Python version (defaults to latest supported)"
|
|
45
|
+
@echo " artifactory_access [optional]"
|
|
46
|
+
@echo " Whether the build host can reach the IHME artifactory. Either 'yes'"
|
|
47
|
+
@echo " (default) or 'no'; use 'no' to build off-VPN without artifactory."
|
|
48
|
+
@echo " keep_env [optional]"
|
|
49
|
+
@echo " Whether to keep a failed build's partial environment for inspection."
|
|
50
|
+
@echo " Either 'yes' or 'no' (default, i.e. tear it down)."
|
|
51
|
+
@echo
|
|
52
|
+
@echo "After creating the environment:"
|
|
53
|
+
@echo " 1. Activate it: 'conda activate <environment_name>'"
|
|
54
|
+
@echo " 2. Run 'make help' again to see all newly available targets"
|
|
55
|
+
@echo
|
|
56
|
+
endif
|
|
57
|
+
|
|
58
|
+
build-env: # Create a new environment with installed packages
|
|
59
|
+
# Validate arguments - exit if unsupported arguments are passed
|
|
60
|
+
@allowed="name py artifactory_access keep_env"; \
|
|
61
|
+
for arg in $(filter-out build-env,$(MAKECMDGOALS)) $(MAKEFLAGS); do \
|
|
62
|
+
case $$arg in \
|
|
63
|
+
*=*) \
|
|
64
|
+
arg_name=$${arg%%=*}; \
|
|
65
|
+
if ! echo " $$allowed " | grep -q " $$arg_name "; then \
|
|
66
|
+
allowed_list=$$(echo $$allowed | sed 's/ /, /g'); \
|
|
67
|
+
echo "Error: Invalid argument '$$arg_name'. Allowed arguments are: $$allowed_list" >&2; \
|
|
68
|
+
exit 1; \
|
|
69
|
+
fi \
|
|
70
|
+
;; \
|
|
71
|
+
esac; \
|
|
72
|
+
done
|
|
73
|
+
|
|
74
|
+
# Handle arguments and set defaults
|
|
75
|
+
# name
|
|
76
|
+
@$(eval name ?= $(PACKAGE_NAME))
|
|
77
|
+
# python version - validate if specified, else get default from json file
|
|
78
|
+
@supported_versions=$$(python -c "import json; print(' '.join(json.load(open('python_versions.json'))))" 2>/dev/null || echo ""); \
|
|
79
|
+
if [ -n "$(py)" ] && ! echo "$$supported_versions" | grep -q "$(py)"; then \
|
|
80
|
+
echo "Error: Python version '$(py)' is not supported. Available: $$(echo $$supported_versions | sed 's/ /, /g')" >&2; \
|
|
81
|
+
exit 1; \
|
|
82
|
+
fi
|
|
83
|
+
@$(eval py ?= $(shell python -c "import json; print(max(json.load(open('python_versions.json')), key=lambda x: tuple(map(int, x.split('.')))))"))
|
|
84
|
+
# artifactory_access
|
|
85
|
+
@$(eval artifactory_access ?= yes)
|
|
86
|
+
@case "$(artifactory_access)" in \
|
|
87
|
+
yes|no) ;; \
|
|
88
|
+
*) echo "Error: 'artifactory_access' must be 'yes' or 'no', got '$(artifactory_access)'" >&2; exit 1 ;; \
|
|
89
|
+
esac
|
|
90
|
+
# keep_env
|
|
91
|
+
@$(eval keep_env ?= no)
|
|
92
|
+
@case "$(keep_env)" in \
|
|
93
|
+
yes|no) ;; \
|
|
94
|
+
*) echo "Error: 'keep_env' must be 'yes' or 'no', got '$(keep_env)'" >&2; exit 1 ;; \
|
|
95
|
+
esac
|
|
96
|
+
|
|
97
|
+
# Tear down on failure rather than leave an env that activates with nothing installed.
|
|
98
|
+
@if ! $(MAKE) --no-print-directory _build-env \
|
|
99
|
+
name=$(name) py=$(py) artifactory_access=$(artifactory_access); then \
|
|
100
|
+
echo >&2; \
|
|
101
|
+
if [ "$(keep_env)" = "yes" ]; then \
|
|
102
|
+
echo "Error: failed to build environment '$(name)'. Keeping it (keep_env=yes)." >&2; \
|
|
103
|
+
else \
|
|
104
|
+
echo "Error: failed to build environment '$(name)'. Removing it; pass keep_env=yes to keep it for inspection." >&2; \
|
|
105
|
+
conda env remove -n $(name) --yes; \
|
|
106
|
+
fi; \
|
|
107
|
+
exit 1; \
|
|
108
|
+
fi
|
|
109
|
+
|
|
110
|
+
@echo
|
|
111
|
+
@echo "Finished building environment"
|
|
112
|
+
@echo " name: $(name)"
|
|
113
|
+
@echo " python version: $(py)"
|
|
114
|
+
@echo
|
|
115
|
+
@echo "Don't forget to activate it with:"
|
|
116
|
+
@echo "conda activate $(name)"
|
|
117
|
+
@echo
|
|
118
|
+
|
|
119
|
+
# Private: the build steps live here so `build-env` can tear down the env if any fails.
|
|
120
|
+
.PHONY: _build-env
|
|
121
|
+
_build-env:
|
|
122
|
+
conda create -n $(name) python=$(py) --yes
|
|
123
|
+
# --no-capture-output streams output, so a failure isn't hidden behind a long silence.
|
|
124
|
+
conda run --no-capture-output -n $(name) pip install vivarium-build-utils
|
|
125
|
+
# artifactory_access=no passes an empty IHME_PYPI, which clears base.mk's EXTRA_INDEX_FLAGS
|
|
126
|
+
conda run --no-capture-output -n $(name) make install $(if $(filter no,$(artifactory_access)),IHME_PYPI=)
|
|
127
|
+
# A fresh env's only editable install is this checkout, so an empty list means it never installed.
|
|
128
|
+
@conda run --no-capture-output -n $(name) pip list --editable --format=freeze | grep -q . \
|
|
129
|
+
|| { echo "Error: nothing was installed into '$(name)' from $(CURDIR)." >&2; exit 1; }
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: vivarium-interactive
|
|
3
|
+
Version: 1.0.0
|
|
4
|
+
Summary: Run and inspect vivarium simulations interactively, for example in a notebook.
|
|
5
|
+
Author-email: The vivarium developers <vivarium.dev@gmail.com>
|
|
6
|
+
License: BSD-3-Clause
|
|
7
|
+
Project-URL: Homepage, https://github.com/ihmeuw/vivarium-suite
|
|
8
|
+
Project-URL: Source, https://github.com/ihmeuw/vivarium-suite/tree/main/libs/interactive
|
|
9
|
+
Classifier: Intended Audience :: Developers
|
|
10
|
+
Classifier: Intended Audience :: Science/Research
|
|
11
|
+
Classifier: License :: OSI Approved :: BSD License
|
|
12
|
+
Classifier: Natural Language :: English
|
|
13
|
+
Classifier: Operating System :: MacOS :: MacOS X
|
|
14
|
+
Classifier: Operating System :: POSIX
|
|
15
|
+
Classifier: Operating System :: POSIX :: BSD
|
|
16
|
+
Classifier: Operating System :: POSIX :: Linux
|
|
17
|
+
Classifier: Operating System :: Microsoft :: Windows
|
|
18
|
+
Classifier: Programming Language :: Python
|
|
19
|
+
Classifier: Programming Language :: Python :: Implementation :: CPython
|
|
20
|
+
Classifier: Topic :: Scientific/Engineering
|
|
21
|
+
Classifier: Topic :: Scientific/Engineering :: Medical Science Apps.
|
|
22
|
+
Classifier: Topic :: Software Development :: Libraries
|
|
23
|
+
Requires-Python: >=3.11
|
|
24
|
+
Description-Content-Type: text/x-rst
|
|
25
|
+
License-File: LICENSE
|
|
26
|
+
Requires-Dist: vivarium-engine<7,>=5.19.1
|
|
27
|
+
Requires-Dist: vivarium-config-tree
|
|
28
|
+
Requires-Dist: vivarium-dependencies[numpy,pandas]
|
|
29
|
+
Requires-Dist: vivarium-build-utils<5.0.0,>=4.0.0
|
|
30
|
+
Provides-Extra: interactive
|
|
31
|
+
Requires-Dist: vivarium-dependencies[interactive]; extra == "interactive"
|
|
32
|
+
Provides-Extra: test
|
|
33
|
+
Requires-Dist: vivarium-dependencies[ipython,loguru,networkx,pytest,pyyaml]; extra == "test"
|
|
34
|
+
Requires-Dist: pytest-vivarium; extra == "test"
|
|
35
|
+
Requires-Dist: vivarium-fuzzy-checker; extra == "test"
|
|
36
|
+
Provides-Extra: docs
|
|
37
|
+
Requires-Dist: vivarium-dependencies[sphinx]; extra == "docs"
|
|
38
|
+
Provides-Extra: lint
|
|
39
|
+
Requires-Dist: vivarium-dependencies[lint]; extra == "lint"
|
|
40
|
+
Provides-Extra: dev
|
|
41
|
+
Requires-Dist: vivarium-interactive[docs,interactive,lint,test]; extra == "dev"
|
|
42
|
+
Provides-Extra: cluster
|
|
43
|
+
Provides-Extra: ci-github
|
|
44
|
+
Requires-Dist: vivarium-interactive[docs,lint,test]; extra == "ci-github"
|
|
45
|
+
Provides-Extra: ci-jenkins
|
|
46
|
+
Requires-Dist: vivarium-interactive[ci_github,cluster]; extra == "ci-jenkins"
|
|
47
|
+
Dynamic: license-file
|
|
48
|
+
|
|
49
|
+
====================
|
|
50
|
+
Vivarium Interactive
|
|
51
|
+
====================
|
|
52
|
+
|
|
53
|
+
.. image:: https://badge.fury.io/py/vivarium-interactive.svg
|
|
54
|
+
:target: https://badge.fury.io/py/vivarium-interactive
|
|
55
|
+
|
|
56
|
+
.. image:: https://readthedocs.org/projects/vivarium-interactive/badge/?version=latest
|
|
57
|
+
:target: https://vivarium-interactive.readthedocs.io/en/latest/?badge=latest
|
|
58
|
+
:alt: Documentation Status
|
|
59
|
+
|
|
60
|
+
This library provides ``Simulation``, a way to run and inspect a vivarium
|
|
61
|
+
simulation interactively, for example in a Jupyter notebook. It steps the
|
|
62
|
+
simulation on demand and exposes the population, pipelines, resources,
|
|
63
|
+
and results for inspection.
|
|
64
|
+
|
|
65
|
+
**Supported Python versions: 3.11, 3.12, 3.13**
|
|
66
|
+
|
|
67
|
+
You can install ``vivarium-interactive`` from PyPI with pip:
|
|
68
|
+
|
|
69
|
+
.. code-block:: bash
|
|
70
|
+
|
|
71
|
+
pip install vivarium-interactive
|
|
72
|
+
|
|
73
|
+
or build it from source by cloning the monorepo and installing this package:
|
|
74
|
+
|
|
75
|
+
.. code-block:: bash
|
|
76
|
+
|
|
77
|
+
git clone https://github.com/ihmeuw/vivarium-suite.git
|
|
78
|
+
cd vivarium-suite
|
|
79
|
+
pip install libs/interactive
|
|
80
|
+
|
|
81
|
+
For broader monorepo development setup, see the monorepo README at
|
|
82
|
+
https://github.com/ihmeuw/vivarium-suite.
|
|
83
|
+
|
|
84
|
+
`Check out the docs! <https://vivarium-interactive.readthedocs.io/en/latest/>`_
|
|
85
|
+
-------------------------------------------------------------------------------
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
====================
|
|
2
|
+
Vivarium Interactive
|
|
3
|
+
====================
|
|
4
|
+
|
|
5
|
+
.. image:: https://badge.fury.io/py/vivarium-interactive.svg
|
|
6
|
+
:target: https://badge.fury.io/py/vivarium-interactive
|
|
7
|
+
|
|
8
|
+
.. image:: https://readthedocs.org/projects/vivarium-interactive/badge/?version=latest
|
|
9
|
+
:target: https://vivarium-interactive.readthedocs.io/en/latest/?badge=latest
|
|
10
|
+
:alt: Documentation Status
|
|
11
|
+
|
|
12
|
+
This library provides ``Simulation``, a way to run and inspect a vivarium
|
|
13
|
+
simulation interactively, for example in a Jupyter notebook. It steps the
|
|
14
|
+
simulation on demand and exposes the population, pipelines, resources,
|
|
15
|
+
and results for inspection.
|
|
16
|
+
|
|
17
|
+
**Supported Python versions: 3.11, 3.12, 3.13**
|
|
18
|
+
|
|
19
|
+
You can install ``vivarium-interactive`` from PyPI with pip:
|
|
20
|
+
|
|
21
|
+
.. code-block:: bash
|
|
22
|
+
|
|
23
|
+
pip install vivarium-interactive
|
|
24
|
+
|
|
25
|
+
or build it from source by cloning the monorepo and installing this package:
|
|
26
|
+
|
|
27
|
+
.. code-block:: bash
|
|
28
|
+
|
|
29
|
+
git clone https://github.com/ihmeuw/vivarium-suite.git
|
|
30
|
+
cd vivarium-suite
|
|
31
|
+
pip install libs/interactive
|
|
32
|
+
|
|
33
|
+
For broader monorepo development setup, see the monorepo README at
|
|
34
|
+
https://github.com/ihmeuw/vivarium-suite.
|
|
35
|
+
|
|
36
|
+
`Check out the docs! <https://vivarium-interactive.readthedocs.io/en/latest/>`_
|
|
37
|
+
-------------------------------------------------------------------------------
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
# numpy
|
|
2
|
+
py:class np.number
|
|
3
|
+
py:class np.object_
|
|
4
|
+
py:class npt.NDArray
|
|
5
|
+
py:class npt.NBitBase
|
|
6
|
+
py:class NDArray
|
|
7
|
+
py:class numpy._typing._array_like.GenericAlias
|
|
8
|
+
# pandas
|
|
9
|
+
py:class CategoricalDtype
|
|
10
|
+
py:class pandas.api.typing.DataFrameGroupBy
|
|
11
|
+
py:class pandas.core.indexes.base.Index
|
|
12
|
+
py:class pandas.core.indexes.multi.MultiIndex
|
|
13
|
+
py:class pandas._libs.tslibs.timestamps.Timestamp
|
|
14
|
+
py:class pandas._libs.tslibs.timedeltas.Timedelta
|
|
15
|
+
py:class pandas.core.frame.DataFrame
|
|
16
|
+
py:class pandas.core.series.Series
|
|
17
|
+
py:class pandas.core.generic.PandasObject
|
|
18
|
+
py:class pandas.core.groupby.generic.DataFrameGroupBy
|
|
19
|
+
py:class pd.Index
|
|
20
|
+
py:class pd.Series
|
|
21
|
+
py:class pd.DataFrame
|
|
22
|
+
|
|
23
|
+
# loguru
|
|
24
|
+
py:class loguru.Logger
|
|
25
|
+
|
|
26
|
+
# networkx: the ``nx.DiGraph`` return annotation on the resource manager renders
|
|
27
|
+
# as a bare ``:class:`nx.DiGraph``` cross-ref that intersphinx (whose target is
|
|
28
|
+
# the qualified ``networkx.DiGraph``) can't match. autodoc-typehints also strips
|
|
29
|
+
# the ``[Resource]`` parameter, so the unresolved target is always ``nx.DiGraph``.
|
|
30
|
+
py:class nx.DiGraph
|
|
31
|
+
|
|
32
|
+
# vivarium-config-tree: type annotations in source use the bare name
|
|
33
|
+
# ``ConfigTree`` (via ``from vivarium.config_tree import ConfigTree``), which
|
|
34
|
+
# autodoc-typehints renders as a bare ``:class:`ConfigTree``` cross-ref that
|
|
35
|
+
# Sphinx can't match against the qualified intersphinx target. Fully-qualified
|
|
36
|
+
# references (e.g. ``:class:`~vivarium.config_tree.main.ConfigTree``` in
|
|
37
|
+
# docstrings/rst) resolve correctly via intersphinx; only the autodoc-derived
|
|
38
|
+
# bare form needs suppression.
|
|
39
|
+
py:class ConfigTree
|
|
40
|
+
|
|
41
|
+
# Special methods that Sphinx can't resolve
|
|
42
|
+
py:meth __init__
|
|
43
|
+
py:meth __repr__
|
|
44
|
+
py:meth __call__
|
|
45
|
+
|
|
46
|
+
# pathlib internals
|
|
47
|
+
py:class pathlib._local.Path
|
|
48
|
+
|
|
49
|
+
# typing
|
|
50
|
+
py:data typing.Union
|
|
51
|
+
|
|
52
|
+
# vivarium-engine type aliases render as bare names that Sphinx can't match.
|
|
53
|
+
py:class ClockTime
|
|
54
|
+
py:class ClockStepSize
|
|
55
|
+
py:class Time
|
|
56
|
+
py:class Timedelta
|
|
57
|
+
|
|
58
|
+
# Bare names from type hints and Raises sections that autodoc renders without a
|
|
59
|
+
# module, so Sphinx can't match them.
|
|
60
|
+
py:class Path
|
|
61
|
+
py:class Component
|
|
62
|
+
py:class LookupTable
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
# -*- coding: utf-8 -*-
|
|
3
|
+
"""Sphinx configuration for vivarium-interactive docs."""
|
|
4
|
+
|
|
5
|
+
import importlib.metadata
|
|
6
|
+
|
|
7
|
+
from vivarium.engine.framework.logging.utilities import configure_logging_to_terminal
|
|
8
|
+
|
|
9
|
+
# Simulations add their terminal log sink once per process, bound to whatever sys.stdout
|
|
10
|
+
# is at that moment. Add it now, while sys.stdout is the real terminal, so that log
|
|
11
|
+
# messages don't become part of a doctest example's checked output.
|
|
12
|
+
configure_logging_to_terminal(verbosity=0)
|
|
13
|
+
|
|
14
|
+
# -- Project information -----------------------------------------------------
|
|
15
|
+
|
|
16
|
+
project = "vivarium.interactive"
|
|
17
|
+
author = "The vivarium developers"
|
|
18
|
+
copyright = "2026, Institute for Health Metrics and Evaluation"
|
|
19
|
+
|
|
20
|
+
version = importlib.metadata.version("vivarium-interactive")
|
|
21
|
+
release = version
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
# -- General configuration ------------------------------------------------
|
|
25
|
+
|
|
26
|
+
needs_sphinx = "4.0"
|
|
27
|
+
|
|
28
|
+
extensions = [
|
|
29
|
+
"sphinx.ext.autodoc",
|
|
30
|
+
"sphinx_autodoc_typehints",
|
|
31
|
+
"sphinx.ext.intersphinx",
|
|
32
|
+
"sphinx.ext.doctest",
|
|
33
|
+
"sphinx.ext.todo",
|
|
34
|
+
"sphinx.ext.coverage",
|
|
35
|
+
"sphinx.ext.mathjax",
|
|
36
|
+
"sphinx.ext.napoleon",
|
|
37
|
+
"sphinx.ext.viewcode",
|
|
38
|
+
]
|
|
39
|
+
|
|
40
|
+
source_suffix = ".rst"
|
|
41
|
+
master_doc = "index"
|
|
42
|
+
language = "en"
|
|
43
|
+
exclude_patterns: list[str] = []
|
|
44
|
+
pygments_style = "sphinx"
|
|
45
|
+
todo_include_todos = True
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
# -- Options for HTML output ----------------------------------------------
|
|
49
|
+
|
|
50
|
+
html_theme = "sphinx_rtd_theme"
|
|
51
|
+
html_static_path = ["_static"]
|
|
52
|
+
html_css_files = ["style.css"]
|
|
53
|
+
html_sidebars = {
|
|
54
|
+
"**": [
|
|
55
|
+
"globaltoc.html",
|
|
56
|
+
"searchbox.html",
|
|
57
|
+
]
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
htmlhelp_basename = f"{project}doc"
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
# -- Options for LaTeX / man / texinfo output -----------------------------
|
|
64
|
+
|
|
65
|
+
latex_elements: dict[str, str] = {}
|
|
66
|
+
latex_documents = [
|
|
67
|
+
(master_doc, f"{project}.tex", f"{project} Documentation", author, "manual")
|
|
68
|
+
]
|
|
69
|
+
man_pages = [(master_doc, project, f"{project} Documentation", [author], 1)]
|
|
70
|
+
texinfo_documents = [
|
|
71
|
+
(
|
|
72
|
+
master_doc,
|
|
73
|
+
project,
|
|
74
|
+
f"{project} Documentation",
|
|
75
|
+
author,
|
|
76
|
+
project,
|
|
77
|
+
"Run and inspect vivarium simulations interactively, for example in a notebook.",
|
|
78
|
+
"Miscellaneous",
|
|
79
|
+
),
|
|
80
|
+
]
|
|
81
|
+
|
|
82
|
+
|
|
83
|
+
# -- Intersphinx ---------------------------------------------------------
|
|
84
|
+
|
|
85
|
+
intersphinx_mapping = {
|
|
86
|
+
"python": ("https://docs.python.org/3/", None),
|
|
87
|
+
"pandas": ("https://pandas.pydata.org/docs/", None),
|
|
88
|
+
"tables": ("https://www.pytables.org/", None),
|
|
89
|
+
"numpy": ("https://numpy.org/doc/stable/", None),
|
|
90
|
+
"networkx": ("https://networkx.org/documentation/stable/", None),
|
|
91
|
+
# Sibling monorepo libs whose docs these docs reference.
|
|
92
|
+
"vivarium_config_tree": ("https://vivarium-config-tree.readthedocs.io/en/latest/", None),
|
|
93
|
+
"vivarium_engine": ("https://vivarium-engine.readthedocs.io/en/latest/", None),
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
|
|
97
|
+
# -- Autodoc configuration ------------------------------------------------
|
|
98
|
+
|
|
99
|
+
autodoc_default_options = {
|
|
100
|
+
"members": True,
|
|
101
|
+
"member-order": "bysource",
|
|
102
|
+
"undoc-members": True,
|
|
103
|
+
"private-members": False,
|
|
104
|
+
}
|
|
105
|
+
autodoc_typehints = "description"
|
|
106
|
+
|
|
107
|
+
|
|
108
|
+
# -- nitpicky mode --------------------------------------------------------
|
|
109
|
+
|
|
110
|
+
nitpicky = True
|
|
111
|
+
|
|
112
|
+
nitpick_ignore: list[tuple[str, str]] = []
|
|
113
|
+
with open("../nitpick-exceptions") as f:
|
|
114
|
+
for line in f:
|
|
115
|
+
if line.strip() == "" or line.startswith("#"):
|
|
116
|
+
continue
|
|
117
|
+
dtype, target = line.split(None, 1)
|
|
118
|
+
target = target.strip()
|
|
119
|
+
nitpick_ignore.append((dtype, target))
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
====================
|
|
2
|
+
Vivarium Interactive
|
|
3
|
+
====================
|
|
4
|
+
|
|
5
|
+
This package provides :class:`~vivarium.interactive.simulation.Simulation`, a way to run
|
|
6
|
+
and inspect a `vivarium <https://vivarium-engine.readthedocs.io/en/latest/>`_
|
|
7
|
+
simulation interactively, for example in a Jupyter notebook.
|
|
8
|
+
|
|
9
|
+
It is one of the libraries in the
|
|
10
|
+
`vivarium-suite <https://github.com/ihmeuw/vivarium-suite>`_ monorepo, maintained
|
|
11
|
+
by the Institute for Health Metrics and Evaluation's Simulation Science team.
|
|
12
|
+
|
|
13
|
+
.. toctree::
|
|
14
|
+
:maxdepth: 2
|
|
15
|
+
|
|
16
|
+
tutorials/interactive
|
|
17
|
+
tutorials/exploration
|
|
18
|
+
api_reference
|