caskade 0.6.1__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.
- caskade-0.6.1/.github/workflows/cd.yml +99 -0
- caskade-0.6.1/.github/workflows/ci.yml +83 -0
- caskade-0.6.1/.gitignore +163 -0
- caskade-0.6.1/.readthedocs.yml +43 -0
- caskade-0.6.1/LICENSE +21 -0
- caskade-0.6.1/PKG-INFO +113 -0
- caskade-0.6.1/README.md +66 -0
- caskade-0.6.1/docs/Makefile +19 -0
- caskade-0.6.1/docs/requirements.txt +7 -0
- caskade-0.6.1/docs/source/_config.yml +57 -0
- caskade-0.6.1/docs/source/_toc.yml +15 -0
- caskade-0.6.1/docs/source/install.md +7 -0
- caskade-0.6.1/docs/source/intro.md +64 -0
- caskade-0.6.1/docs/source/modules.rst +9 -0
- caskade-0.6.1/docs/source/notebooks/BeginnersGuide.ipynb +27302 -0
- caskade-0.6.1/pyproject.toml +65 -0
- caskade-0.6.1/requirements.txt +1 -0
- caskade-0.6.1/src/caskade/__init__.py +48 -0
- caskade-0.6.1/src/caskade/_version.py +16 -0
- caskade-0.6.1/src/caskade/base.py +224 -0
- caskade-0.6.1/src/caskade/context.py +73 -0
- caskade-0.6.1/src/caskade/decorators.py +75 -0
- caskade-0.6.1/src/caskade/errors.py +99 -0
- caskade-0.6.1/src/caskade/module.py +322 -0
- caskade-0.6.1/src/caskade/param.py +288 -0
- caskade-0.6.1/src/caskade/tests.py +48 -0
- caskade-0.6.1/src/caskade/warnings.py +17 -0
- caskade-0.6.1/tests/test_base.py +144 -0
- caskade-0.6.1/tests/test_context.py +61 -0
- caskade-0.6.1/tests/test_forward.py +211 -0
- caskade-0.6.1/tests/test_integration.py +114 -0
- caskade-0.6.1/tests/test_module.py +100 -0
- caskade-0.6.1/tests/test_param.py +164 -0
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
name: CD
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
workflow_dispatch:
|
|
5
|
+
push:
|
|
6
|
+
branches:
|
|
7
|
+
- main
|
|
8
|
+
- dev
|
|
9
|
+
release:
|
|
10
|
+
types:
|
|
11
|
+
- published
|
|
12
|
+
|
|
13
|
+
concurrency:
|
|
14
|
+
group: ${{ github.workflow }}-${{ github.ref }}
|
|
15
|
+
cancel-in-progress: true
|
|
16
|
+
|
|
17
|
+
env:
|
|
18
|
+
FORCE_COLOR: 3
|
|
19
|
+
|
|
20
|
+
jobs:
|
|
21
|
+
dist:
|
|
22
|
+
name: Distribution build
|
|
23
|
+
runs-on: ubuntu-latest
|
|
24
|
+
|
|
25
|
+
steps:
|
|
26
|
+
- uses: actions/checkout@v4
|
|
27
|
+
with:
|
|
28
|
+
fetch-depth: 0
|
|
29
|
+
|
|
30
|
+
- name: Build sdist and wheel
|
|
31
|
+
run: pipx run build
|
|
32
|
+
|
|
33
|
+
- uses: actions/upload-artifact@v4
|
|
34
|
+
with:
|
|
35
|
+
path: dist
|
|
36
|
+
|
|
37
|
+
- name: Check products
|
|
38
|
+
run: pipx run twine check dist/*
|
|
39
|
+
|
|
40
|
+
test-built-dist:
|
|
41
|
+
needs: [dist]
|
|
42
|
+
name: Test built distribution
|
|
43
|
+
runs-on: ubuntu-latest
|
|
44
|
+
permissions:
|
|
45
|
+
id-token: write
|
|
46
|
+
steps:
|
|
47
|
+
- uses: actions/setup-python@v5
|
|
48
|
+
name: Install Python
|
|
49
|
+
with:
|
|
50
|
+
python-version: "3.10"
|
|
51
|
+
- uses: actions/download-artifact@v4
|
|
52
|
+
with:
|
|
53
|
+
name: artifact
|
|
54
|
+
path: dist
|
|
55
|
+
- name: List contents of built dist
|
|
56
|
+
run: |
|
|
57
|
+
ls -ltrh
|
|
58
|
+
ls -ltrh dist
|
|
59
|
+
- name: Publish to Test PyPI
|
|
60
|
+
uses: pypa/gh-action-pypi-publish@v1.12.3
|
|
61
|
+
with:
|
|
62
|
+
repository-url: https://test.pypi.org/legacy/
|
|
63
|
+
verbose: true
|
|
64
|
+
skip-existing: true
|
|
65
|
+
- name: Check pypi packages
|
|
66
|
+
run: |
|
|
67
|
+
sleep 3
|
|
68
|
+
python -m pip install --upgrade pip
|
|
69
|
+
|
|
70
|
+
echo "=== Testing wheel file ==="
|
|
71
|
+
# Install wheel to get dependencies and check import
|
|
72
|
+
python -m pip install --extra-index-url https://test.pypi.org/simple --upgrade --pre caskade
|
|
73
|
+
python -c "import caskade; print(caskade.__version__); caskade.test()"
|
|
74
|
+
echo "=== Done testing wheel file ==="
|
|
75
|
+
|
|
76
|
+
echo "=== Testing source tar file ==="
|
|
77
|
+
# Install tar gz and check import
|
|
78
|
+
python -m pip uninstall --yes caskade
|
|
79
|
+
python -m pip install --extra-index-url https://test.pypi.org/simple --upgrade --pre --no-binary=:all: caskade
|
|
80
|
+
python -c "import caskade; print(caskade.__version__); caskade.test()"
|
|
81
|
+
echo "=== Done testing source tar file ==="
|
|
82
|
+
|
|
83
|
+
publish:
|
|
84
|
+
needs: [dist, test-built-dist]
|
|
85
|
+
name: Publish to PyPI
|
|
86
|
+
environment: pypi
|
|
87
|
+
permissions:
|
|
88
|
+
id-token: write
|
|
89
|
+
runs-on: ubuntu-latest
|
|
90
|
+
if: github.event_name == 'release' && github.event.action == 'published'
|
|
91
|
+
|
|
92
|
+
steps:
|
|
93
|
+
- uses: actions/download-artifact@v4
|
|
94
|
+
with:
|
|
95
|
+
name: artifact
|
|
96
|
+
path: dist
|
|
97
|
+
|
|
98
|
+
- uses: pypa/gh-action-pypi-publish@v1.12.3
|
|
99
|
+
if: startsWith(github.ref, 'refs/tags')
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
# This workflow will install Python dependencies, run tests and lint with a single version of Python
|
|
2
|
+
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python
|
|
3
|
+
|
|
4
|
+
name: CI
|
|
5
|
+
|
|
6
|
+
on:
|
|
7
|
+
workflow_dispatch:
|
|
8
|
+
pull_request:
|
|
9
|
+
push:
|
|
10
|
+
branches:
|
|
11
|
+
- main
|
|
12
|
+
- dev
|
|
13
|
+
|
|
14
|
+
concurrency:
|
|
15
|
+
group: ${{ github.workflow }}-${{ github.ref }}
|
|
16
|
+
cancel-in-progress: true
|
|
17
|
+
|
|
18
|
+
env:
|
|
19
|
+
FORCE_COLOR: 3
|
|
20
|
+
PROJECT_NAME: "caskade"
|
|
21
|
+
|
|
22
|
+
jobs:
|
|
23
|
+
build:
|
|
24
|
+
runs-on: ${{matrix.os}}
|
|
25
|
+
strategy:
|
|
26
|
+
fail-fast: false
|
|
27
|
+
matrix:
|
|
28
|
+
python-version: ["3.9", "3.10", "3.11"]
|
|
29
|
+
os: [ubuntu-latest, windows-latest, macOS-latest]
|
|
30
|
+
|
|
31
|
+
steps:
|
|
32
|
+
- name: Checkout caskade
|
|
33
|
+
uses: actions/checkout@v4
|
|
34
|
+
with:
|
|
35
|
+
fetch-depth: 0
|
|
36
|
+
|
|
37
|
+
- name: Set up Python ${{ matrix.python-version }}
|
|
38
|
+
uses: actions/setup-python@v5
|
|
39
|
+
with:
|
|
40
|
+
python-version: ${{ matrix.python-version }}
|
|
41
|
+
allow-prereleases: true
|
|
42
|
+
|
|
43
|
+
- name: Record State
|
|
44
|
+
run: |
|
|
45
|
+
pwd
|
|
46
|
+
echo github.ref is: ${{ github.ref }}
|
|
47
|
+
echo GITHUB_SHA is: $GITHUB_SHA
|
|
48
|
+
echo github.event_name is: ${{ github.event_name }}
|
|
49
|
+
echo github workspace: ${{ github.workspace }}
|
|
50
|
+
pip --version
|
|
51
|
+
|
|
52
|
+
- name: Install dependencies
|
|
53
|
+
run: |
|
|
54
|
+
python -m pip install --upgrade pip
|
|
55
|
+
pip install pytest pytest-cov torch wheel pydantic
|
|
56
|
+
|
|
57
|
+
# We only want to install this on one run, because otherwise we'll have
|
|
58
|
+
# duplicate annotations.
|
|
59
|
+
- name: Install error reporter
|
|
60
|
+
if: ${{ matrix.python-version == '3.10' }}
|
|
61
|
+
run: |
|
|
62
|
+
python -m pip install pytest-github-actions-annotate-failures
|
|
63
|
+
|
|
64
|
+
- name: Install caskade
|
|
65
|
+
run: |
|
|
66
|
+
pip install -e ".[dev]"
|
|
67
|
+
pip show ${{ env.PROJECT_NAME }}
|
|
68
|
+
|
|
69
|
+
- name: Test with pytest
|
|
70
|
+
run: |
|
|
71
|
+
pytest -vvv --cov=${{ env.PROJECT_NAME }} --cov-report=xml --cov-report=term tests/
|
|
72
|
+
|
|
73
|
+
- name: Upload coverage reports to Codecov with GitHub Action
|
|
74
|
+
if:
|
|
75
|
+
${{ matrix.python-version == '3.10' && matrix.os == 'ubuntu-latest'}}
|
|
76
|
+
uses: codecov/codecov-action@v4
|
|
77
|
+
env:
|
|
78
|
+
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
|
|
79
|
+
with:
|
|
80
|
+
files: ./coverage.xml
|
|
81
|
+
flags: unittests
|
|
82
|
+
name: codecov-umbrella
|
|
83
|
+
fail_ci_if_error: true
|
caskade-0.6.1/.gitignore
ADDED
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
# Byte-compiled / optimized / DLL files
|
|
2
|
+
__pycache__/
|
|
3
|
+
*.py[cod]
|
|
4
|
+
*$py.class
|
|
5
|
+
|
|
6
|
+
# C extensions
|
|
7
|
+
*.so
|
|
8
|
+
|
|
9
|
+
# Distribution / packaging
|
|
10
|
+
.Python
|
|
11
|
+
build/
|
|
12
|
+
develop-eggs/
|
|
13
|
+
dist/
|
|
14
|
+
downloads/
|
|
15
|
+
eggs/
|
|
16
|
+
.eggs/
|
|
17
|
+
lib/
|
|
18
|
+
lib64/
|
|
19
|
+
parts/
|
|
20
|
+
sdist/
|
|
21
|
+
var/
|
|
22
|
+
wheels/
|
|
23
|
+
share/python-wheels/
|
|
24
|
+
*.egg-info/
|
|
25
|
+
.installed.cfg
|
|
26
|
+
*.egg
|
|
27
|
+
MANIFEST
|
|
28
|
+
src/caskade/_version.py
|
|
29
|
+
|
|
30
|
+
# PyInstaller
|
|
31
|
+
# Usually these files are written by a python script from a template
|
|
32
|
+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
|
|
33
|
+
*.manifest
|
|
34
|
+
*.spec
|
|
35
|
+
|
|
36
|
+
# Installer logs
|
|
37
|
+
pip-log.txt
|
|
38
|
+
pip-delete-this-directory.txt
|
|
39
|
+
|
|
40
|
+
# Unit test / coverage reports
|
|
41
|
+
htmlcov/
|
|
42
|
+
.tox/
|
|
43
|
+
.nox/
|
|
44
|
+
.coverage
|
|
45
|
+
.coverage.*
|
|
46
|
+
.cache
|
|
47
|
+
nosetests.xml
|
|
48
|
+
coverage.xml
|
|
49
|
+
*.cover
|
|
50
|
+
*.py,cover
|
|
51
|
+
.hypothesis/
|
|
52
|
+
.pytest_cache/
|
|
53
|
+
cover/
|
|
54
|
+
|
|
55
|
+
# Translations
|
|
56
|
+
*.mo
|
|
57
|
+
*.pot
|
|
58
|
+
|
|
59
|
+
# Django stuff:
|
|
60
|
+
*.log
|
|
61
|
+
local_settings.py
|
|
62
|
+
db.sqlite3
|
|
63
|
+
db.sqlite3-journal
|
|
64
|
+
|
|
65
|
+
# Flask stuff:
|
|
66
|
+
instance/
|
|
67
|
+
.webassets-cache
|
|
68
|
+
|
|
69
|
+
# Scrapy stuff:
|
|
70
|
+
.scrapy
|
|
71
|
+
|
|
72
|
+
# Sphinx documentation
|
|
73
|
+
docs/_build/
|
|
74
|
+
|
|
75
|
+
# PyBuilder
|
|
76
|
+
.pybuilder/
|
|
77
|
+
target/
|
|
78
|
+
|
|
79
|
+
# Jupyter Notebook
|
|
80
|
+
.ipynb_checkpoints
|
|
81
|
+
|
|
82
|
+
# IPython
|
|
83
|
+
profile_default/
|
|
84
|
+
ipython_config.py
|
|
85
|
+
|
|
86
|
+
# pyenv
|
|
87
|
+
# For a library or package, you might want to ignore these files since the code is
|
|
88
|
+
# intended to run in multiple environments; otherwise, check them in:
|
|
89
|
+
# .python-version
|
|
90
|
+
|
|
91
|
+
# pipenv
|
|
92
|
+
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
|
|
93
|
+
# However, in case of collaboration, if having platform-specific dependencies or dependencies
|
|
94
|
+
# having no cross-platform support, pipenv may install dependencies that don't work, or not
|
|
95
|
+
# install all needed dependencies.
|
|
96
|
+
#Pipfile.lock
|
|
97
|
+
|
|
98
|
+
# poetry
|
|
99
|
+
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
|
|
100
|
+
# This is especially recommended for binary packages to ensure reproducibility, and is more
|
|
101
|
+
# commonly ignored for libraries.
|
|
102
|
+
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
|
|
103
|
+
#poetry.lock
|
|
104
|
+
|
|
105
|
+
# pdm
|
|
106
|
+
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
|
|
107
|
+
#pdm.lock
|
|
108
|
+
# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
|
|
109
|
+
# in version control.
|
|
110
|
+
# https://pdm.fming.dev/latest/usage/project/#working-with-version-control
|
|
111
|
+
.pdm.toml
|
|
112
|
+
.pdm-python
|
|
113
|
+
.pdm-build/
|
|
114
|
+
|
|
115
|
+
# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
|
|
116
|
+
__pypackages__/
|
|
117
|
+
|
|
118
|
+
# Celery stuff
|
|
119
|
+
celerybeat-schedule
|
|
120
|
+
celerybeat.pid
|
|
121
|
+
|
|
122
|
+
# SageMath parsed files
|
|
123
|
+
*.sage.py
|
|
124
|
+
|
|
125
|
+
# Environments
|
|
126
|
+
.env
|
|
127
|
+
.venv
|
|
128
|
+
env/
|
|
129
|
+
venv/
|
|
130
|
+
ENV/
|
|
131
|
+
env.bak/
|
|
132
|
+
venv.bak/
|
|
133
|
+
|
|
134
|
+
# Spyder project settings
|
|
135
|
+
.spyderproject
|
|
136
|
+
.spyproject
|
|
137
|
+
|
|
138
|
+
# Rope project settings
|
|
139
|
+
.ropeproject
|
|
140
|
+
|
|
141
|
+
# mkdocs documentation
|
|
142
|
+
/site
|
|
143
|
+
|
|
144
|
+
# mypy
|
|
145
|
+
.mypy_cache/
|
|
146
|
+
.dmypy.json
|
|
147
|
+
dmypy.json
|
|
148
|
+
|
|
149
|
+
# Pyre type checker
|
|
150
|
+
.pyre/
|
|
151
|
+
|
|
152
|
+
# pytype static type analyzer
|
|
153
|
+
.pytype/
|
|
154
|
+
|
|
155
|
+
# Cython debug symbols
|
|
156
|
+
cython_debug/
|
|
157
|
+
|
|
158
|
+
# PyCharm
|
|
159
|
+
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
|
|
160
|
+
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
|
|
161
|
+
# and can be added to the global gitignore or merged into this file. For a more nuclear
|
|
162
|
+
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
|
|
163
|
+
#.idea/
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
# .readthedocs.yaml
|
|
2
|
+
# Read the Docs configuration file
|
|
3
|
+
# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details
|
|
4
|
+
|
|
5
|
+
# Required
|
|
6
|
+
version: 2
|
|
7
|
+
|
|
8
|
+
# Build documentation in the "docs/" directory with Sphinx
|
|
9
|
+
sphinx:
|
|
10
|
+
configuration: docs/source/conf.py
|
|
11
|
+
|
|
12
|
+
# Optionally build your docs in additional formats such as PDF and ePub
|
|
13
|
+
# formats:
|
|
14
|
+
# - pdf
|
|
15
|
+
# - epub
|
|
16
|
+
|
|
17
|
+
# Optional but recommended, declare the Python requirements required
|
|
18
|
+
# to build your documentation
|
|
19
|
+
# See https://docs.readthedocs.io/en/stable/guides/reproducible-builds.html
|
|
20
|
+
# Specify dependencies to be installed
|
|
21
|
+
# Define the system dependencies
|
|
22
|
+
build:
|
|
23
|
+
os: "ubuntu-20.04"
|
|
24
|
+
tools:
|
|
25
|
+
python: "3.10"
|
|
26
|
+
apt_packages:
|
|
27
|
+
- pandoc # Specify pandoc to be installed via apt-get
|
|
28
|
+
- graphviz # Specify graphviz to be installed via apt-get
|
|
29
|
+
jobs:
|
|
30
|
+
pre_build:
|
|
31
|
+
# Generate the Sphinx configuration for this Jupyter Book so it builds.
|
|
32
|
+
- "jupyter-book config sphinx docs/source/"
|
|
33
|
+
# Create font cache ahead of jupyter book
|
|
34
|
+
- 'python -c "import matplotlib.pyplot as plt"'
|
|
35
|
+
# Get the API documentation dynamically
|
|
36
|
+
- "sphinx-apidoc -f -o docs/source/ src/caskade/"
|
|
37
|
+
|
|
38
|
+
python:
|
|
39
|
+
install:
|
|
40
|
+
- requirements: docs/requirements.txt # Path to your requirements.txt file
|
|
41
|
+
- requirements: requirements.txt # Path to your requirements.txt file
|
|
42
|
+
- method: pip
|
|
43
|
+
path: . # Install the package itself
|
caskade-0.6.1/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2024 Connor Stone, PhD
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
caskade-0.6.1/PKG-INFO
ADDED
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: caskade
|
|
3
|
+
Version: 0.6.1
|
|
4
|
+
Summary: Package for building scientific simulators, with dynamic arguments arranged in a directed acyclic graph.
|
|
5
|
+
Project-URL: Homepage, https://github.com/ConnorStoneAstro/caskade
|
|
6
|
+
Project-URL: Documentation, https://github.com/ConnorStoneAstro/caskade
|
|
7
|
+
Project-URL: Repository, https://github.com/ConnorStoneAstro/caskade
|
|
8
|
+
Project-URL: Issues, https://github.com/ConnorStoneAstro/caskade/issues
|
|
9
|
+
Author-email: Connor Stone <connorstone628@gmail.com>, Alexandre Adam <alexandre.adam@mila.quebec>
|
|
10
|
+
License: MIT License
|
|
11
|
+
|
|
12
|
+
Copyright (c) 2024 Connor Stone, PhD
|
|
13
|
+
|
|
14
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
15
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
16
|
+
in the Software without restriction, including without limitation the rights
|
|
17
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
18
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
19
|
+
furnished to do so, subject to the following conditions:
|
|
20
|
+
|
|
21
|
+
The above copyright notice and this permission notice shall be included in all
|
|
22
|
+
copies or substantial portions of the Software.
|
|
23
|
+
|
|
24
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
25
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
26
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
27
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
28
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
29
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
30
|
+
SOFTWARE.
|
|
31
|
+
License-File: LICENSE
|
|
32
|
+
Keywords: DAG,caskade,differentiable programming,pytorch,scientific python
|
|
33
|
+
Classifier: Development Status :: 1 - Planning
|
|
34
|
+
Classifier: Intended Audience :: Science/Research
|
|
35
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
36
|
+
Classifier: Operating System :: OS Independent
|
|
37
|
+
Classifier: Programming Language :: Python :: 3
|
|
38
|
+
Requires-Python: >=3.9
|
|
39
|
+
Requires-Dist: torch
|
|
40
|
+
Provides-Extra: dev
|
|
41
|
+
Requires-Dist: graphviz<1,>=0.17; extra == 'dev'
|
|
42
|
+
Requires-Dist: pre-commit<4,>=3.6; extra == 'dev'
|
|
43
|
+
Requires-Dist: pytest-cov<5,>=4.1; extra == 'dev'
|
|
44
|
+
Requires-Dist: pytest-mock<4,>=3.12; extra == 'dev'
|
|
45
|
+
Requires-Dist: pytest<9,>=8.0; extra == 'dev'
|
|
46
|
+
Description-Content-Type: text/markdown
|
|
47
|
+
|
|
48
|
+
# caskade
|
|
49
|
+
|
|
50
|
+
[](https://github.com/ConnorStoneAstro/caskade/actions/workflows/ci.yml)
|
|
51
|
+
[](https://github.com/ConnorStoneAstro/caskade/actions/workflows/cd.yml)
|
|
52
|
+
[](https://codecov.io/gh/ConnorStoneAstro/caskade)
|
|
53
|
+
[](https://pypi.org/project/caskade/)
|
|
54
|
+
[](https://caskade.readthedocs.io/en/latest/?badge=latest)
|
|
55
|
+
|
|
56
|
+
Build scientific simulators, treating them as a directed acyclic graph. Handles
|
|
57
|
+
argument passing for complex nested simulators.
|
|
58
|
+
|
|
59
|
+
## Install
|
|
60
|
+
|
|
61
|
+
``` bash
|
|
62
|
+
pip install caskade
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
## Usage
|
|
66
|
+
|
|
67
|
+
Make a `Module` object which may have some `Param`s. Define a `forward` method
|
|
68
|
+
using the decorator.
|
|
69
|
+
|
|
70
|
+
``` python
|
|
71
|
+
from caskade import Module, Param, forward
|
|
72
|
+
|
|
73
|
+
class MySim(Module):
|
|
74
|
+
def __init__(self, a, b=None):
|
|
75
|
+
super().__init__()
|
|
76
|
+
self.a = a
|
|
77
|
+
self.b = Param("b", b)
|
|
78
|
+
|
|
79
|
+
@forward
|
|
80
|
+
def myfun(self, x, b=None):
|
|
81
|
+
return x + self.a + b
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
We may now create instances of the simulator and pass the dynamic parameters.
|
|
85
|
+
|
|
86
|
+
``` python
|
|
87
|
+
import torch
|
|
88
|
+
|
|
89
|
+
sim = MySim(1.0)
|
|
90
|
+
|
|
91
|
+
params = [torch.tensor(2.0)]
|
|
92
|
+
|
|
93
|
+
print(sim.myfun(3.0, params=params))
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
Which will print `6` by automatically filling `b` with the value from `params`.
|
|
97
|
+
|
|
98
|
+
### Why do this?
|
|
99
|
+
|
|
100
|
+
The above example is not very impressive, the real power comes from the fact
|
|
101
|
+
that `Module` objects can be nested arbitrarily making a much more complicated
|
|
102
|
+
analysis graph. Further, the `Param` objects can be linked or have other complex
|
|
103
|
+
relationships. All of the complexity of the nested structure and argument
|
|
104
|
+
passing is abstracted away so that at the top one need only pass a list of
|
|
105
|
+
tensors for each parameter, a single large 1d tensor, or a dictionary with the
|
|
106
|
+
same structure as the graph.
|
|
107
|
+
|
|
108
|
+
## Documentation
|
|
109
|
+
|
|
110
|
+
The `caskade` interface has lots of flexibility, check out the
|
|
111
|
+
[docs](https://caskade.readthedocs.io) to learn more. For a quick start, jump
|
|
112
|
+
right to the [Jupyter notebook
|
|
113
|
+
tutorial](https://caskade.readthedocs.io/en/latest/notebooks/BeginnersGuide.html)!
|
caskade-0.6.1/README.md
ADDED
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
# caskade
|
|
2
|
+
|
|
3
|
+
[](https://github.com/ConnorStoneAstro/caskade/actions/workflows/ci.yml)
|
|
4
|
+
[](https://github.com/ConnorStoneAstro/caskade/actions/workflows/cd.yml)
|
|
5
|
+
[](https://codecov.io/gh/ConnorStoneAstro/caskade)
|
|
6
|
+
[](https://pypi.org/project/caskade/)
|
|
7
|
+
[](https://caskade.readthedocs.io/en/latest/?badge=latest)
|
|
8
|
+
|
|
9
|
+
Build scientific simulators, treating them as a directed acyclic graph. Handles
|
|
10
|
+
argument passing for complex nested simulators.
|
|
11
|
+
|
|
12
|
+
## Install
|
|
13
|
+
|
|
14
|
+
``` bash
|
|
15
|
+
pip install caskade
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
## Usage
|
|
19
|
+
|
|
20
|
+
Make a `Module` object which may have some `Param`s. Define a `forward` method
|
|
21
|
+
using the decorator.
|
|
22
|
+
|
|
23
|
+
``` python
|
|
24
|
+
from caskade import Module, Param, forward
|
|
25
|
+
|
|
26
|
+
class MySim(Module):
|
|
27
|
+
def __init__(self, a, b=None):
|
|
28
|
+
super().__init__()
|
|
29
|
+
self.a = a
|
|
30
|
+
self.b = Param("b", b)
|
|
31
|
+
|
|
32
|
+
@forward
|
|
33
|
+
def myfun(self, x, b=None):
|
|
34
|
+
return x + self.a + b
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
We may now create instances of the simulator and pass the dynamic parameters.
|
|
38
|
+
|
|
39
|
+
``` python
|
|
40
|
+
import torch
|
|
41
|
+
|
|
42
|
+
sim = MySim(1.0)
|
|
43
|
+
|
|
44
|
+
params = [torch.tensor(2.0)]
|
|
45
|
+
|
|
46
|
+
print(sim.myfun(3.0, params=params))
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
Which will print `6` by automatically filling `b` with the value from `params`.
|
|
50
|
+
|
|
51
|
+
### Why do this?
|
|
52
|
+
|
|
53
|
+
The above example is not very impressive, the real power comes from the fact
|
|
54
|
+
that `Module` objects can be nested arbitrarily making a much more complicated
|
|
55
|
+
analysis graph. Further, the `Param` objects can be linked or have other complex
|
|
56
|
+
relationships. All of the complexity of the nested structure and argument
|
|
57
|
+
passing is abstracted away so that at the top one need only pass a list of
|
|
58
|
+
tensors for each parameter, a single large 1d tensor, or a dictionary with the
|
|
59
|
+
same structure as the graph.
|
|
60
|
+
|
|
61
|
+
## Documentation
|
|
62
|
+
|
|
63
|
+
The `caskade` interface has lots of flexibility, check out the
|
|
64
|
+
[docs](https://caskade.readthedocs.io) to learn more. For a quick start, jump
|
|
65
|
+
right to the [Jupyter notebook
|
|
66
|
+
tutorial](https://caskade.readthedocs.io/en/latest/notebooks/BeginnersGuide.html)!
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# Minimal makefile for Sphinx documentation
|
|
2
|
+
#
|
|
3
|
+
|
|
4
|
+
# You can set these variables from the command line.
|
|
5
|
+
SPHINXOPTS =
|
|
6
|
+
SPHINXBUILD = sphinx-build
|
|
7
|
+
SOURCEDIR = .
|
|
8
|
+
BUILDDIR = _build
|
|
9
|
+
|
|
10
|
+
# Put it first so that "make" without argument is like "make help".
|
|
11
|
+
help:
|
|
12
|
+
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
|
|
13
|
+
|
|
14
|
+
.PHONY: help Makefile
|
|
15
|
+
|
|
16
|
+
# Catch-all target: route all unknown targets to Sphinx using the new
|
|
17
|
+
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
|
|
18
|
+
%: Makefile
|
|
19
|
+
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
# Book settings
|
|
2
|
+
# Learn more at https://jupyterbook.org/customize/config.html
|
|
3
|
+
|
|
4
|
+
title: caskade
|
|
5
|
+
author: Connor Stone and Alexandre Adam
|
|
6
|
+
# logo: ../../media/caustics_logo.png
|
|
7
|
+
|
|
8
|
+
# Force re-execution of notebooks on each build.
|
|
9
|
+
# See https://jupyterbook.org/content/execute.html
|
|
10
|
+
execute:
|
|
11
|
+
execute_notebooks: force
|
|
12
|
+
allow_errors: false
|
|
13
|
+
# Per-cell notebook execution limit (seconds)
|
|
14
|
+
timeout: 300
|
|
15
|
+
|
|
16
|
+
# Define the name of the latex output file for PDF builds
|
|
17
|
+
# latex:
|
|
18
|
+
# latex_documents:
|
|
19
|
+
# targetname: book.tex
|
|
20
|
+
|
|
21
|
+
# Add a bibtex file so that we can create citations
|
|
22
|
+
# bibtex_bibfiles:
|
|
23
|
+
# - references.bib
|
|
24
|
+
|
|
25
|
+
# Information about where the book exists on the web
|
|
26
|
+
repository:
|
|
27
|
+
url: https://github.com/ConnorStoneAstro/caskade # Online location of your book
|
|
28
|
+
path_to_book: docs/source # Optional path to your book, relative to the repository root
|
|
29
|
+
branch: main # Which branch of the repository should be used when creating links (optional)
|
|
30
|
+
|
|
31
|
+
# Add GitHub buttons to your book
|
|
32
|
+
# See https://jupyterbook.org/customize/config.html#add-a-link-to-your-repository
|
|
33
|
+
html:
|
|
34
|
+
# favicon: ../../media/caustics_favicon.ico
|
|
35
|
+
use_issues_button: true
|
|
36
|
+
use_repository_button: true
|
|
37
|
+
|
|
38
|
+
sphinx:
|
|
39
|
+
extra_extensions:
|
|
40
|
+
# - "sphinx_automodapi.automodapi"
|
|
41
|
+
- "sphinx.ext.autodoc"
|
|
42
|
+
- "sphinx.ext.napoleon"
|
|
43
|
+
- "sphinx.ext.viewcode"
|
|
44
|
+
- "sphinx.ext.autosummary"
|
|
45
|
+
- "sphinx.ext.doctest"
|
|
46
|
+
- "sphinx.ext.coverage"
|
|
47
|
+
- "sphinx.ext.mathjax"
|
|
48
|
+
- "sphinx.ext.ifconfig"
|
|
49
|
+
config:
|
|
50
|
+
autosummary_generate: True
|
|
51
|
+
# config:
|
|
52
|
+
# numpydoc_show_class_members: False
|
|
53
|
+
# config:
|
|
54
|
+
# html_theme_options:
|
|
55
|
+
# logo:
|
|
56
|
+
# image_light: ../../media/caustics_logo_white.png
|
|
57
|
+
# image_dark: ../../media/caustics_logo.png
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
# Table of contents
|
|
2
|
+
# Learn more at https://jupyterbook.org/customize/toc.html
|
|
3
|
+
|
|
4
|
+
format: jb-book
|
|
5
|
+
root: intro
|
|
6
|
+
chapters:
|
|
7
|
+
- file: notebooks/BeginnersGuide
|
|
8
|
+
- file: install
|
|
9
|
+
- file: modules
|
|
10
|
+
# - file: contributing
|
|
11
|
+
# - file: frequently_asked_questions
|
|
12
|
+
# - file: citation
|
|
13
|
+
# - file: license
|
|
14
|
+
# - file: glossary
|
|
15
|
+
# - file: genindex
|