pyrecap 0.0.1a0__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.
- pyrecap-0.0.1a0/.gitignore +174 -0
- pyrecap-0.0.1a0/AUTHORS.rst +13 -0
- pyrecap-0.0.1a0/LICENSE +29 -0
- pyrecap-0.0.1a0/LICENSE_README +5 -0
- pyrecap-0.0.1a0/PKG-INFO +47 -0
- pyrecap-0.0.1a0/README.rst +21 -0
- pyrecap-0.0.1a0/pyproject.toml +90 -0
- pyrecap-0.0.1a0/recap/__init__.py +4 -0
- pyrecap-0.0.1a0/recap/_version.py +34 -0
- pyrecap-0.0.1a0/recap/client/base_client.py +46 -0
- pyrecap-0.0.1a0/recap/dsl/process_builder.py +379 -0
- pyrecap-0.0.1a0/recap/dsl/resource_builder.py +159 -0
- pyrecap-0.0.1a0/recap/models/__init__.py +28 -0
- pyrecap-0.0.1a0/recap/models/attribute.py +202 -0
- pyrecap-0.0.1a0/recap/models/base.py +5 -0
- pyrecap-0.0.1a0/recap/models/process.py +152 -0
- pyrecap-0.0.1a0/recap/models/resource.py +194 -0
- pyrecap-0.0.1a0/recap/models/step.py +244 -0
- pyrecap-0.0.1a0/recap/schemas/common.py +45 -0
- pyrecap-0.0.1a0/recap/schemas/container.py +33 -0
- pyrecap-0.0.1a0/recap/schemas/experiment.py +57 -0
- pyrecap-0.0.1a0/recap/tests/__init__.py +0 -0
- pyrecap-0.0.1a0/recap/tests/conftest.py +49 -0
- pyrecap-0.0.1a0/recap/tests/lix/test_api_soln_scattering.py +126 -0
- pyrecap-0.0.1a0/recap/tests/lix/test_plate.py +19 -0
- pyrecap-0.0.1a0/recap/tests/lix/test_solution_scattering.py +189 -0
- pyrecap-0.0.1a0/recap/tests/schema_tests/test_container_schema.py +18 -0
- pyrecap-0.0.1a0/recap/tests/test_actions.py +73 -0
- pyrecap-0.0.1a0/recap/tests/test_container.py +101 -0
- pyrecap-0.0.1a0/recap/tests/test_data/example.yml +53 -0
- pyrecap-0.0.1a0/recap/tests/test_data/lix_containers.yml +134 -0
- pyrecap-0.0.1a0/recap/tests/test_data/lix_experiment.yml +62 -0
- pyrecap-0.0.1a0/recap/tests/test_experiment.py +5 -0
- pyrecap-0.0.1a0/recap/tests/test_fragment_screening.py +344 -0
- pyrecap-0.0.1a0/recap/utils/dsl.py +42 -0
- pyrecap-0.0.1a0/recap/utils/general.py +107 -0
|
@@ -0,0 +1,174 @@
|
|
|
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
|
+
|
|
29
|
+
# PyInstaller
|
|
30
|
+
# Usually these files are written by a python script from a template
|
|
31
|
+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
|
|
32
|
+
*.manifest
|
|
33
|
+
*.spec
|
|
34
|
+
|
|
35
|
+
# Installer logs
|
|
36
|
+
pip-log.txt
|
|
37
|
+
pip-delete-this-directory.txt
|
|
38
|
+
|
|
39
|
+
# Unit test / coverage reports
|
|
40
|
+
htmlcov/
|
|
41
|
+
.tox/
|
|
42
|
+
.nox/
|
|
43
|
+
.coverage
|
|
44
|
+
.coverage.*
|
|
45
|
+
.cache
|
|
46
|
+
nosetests.xml
|
|
47
|
+
coverage.xml
|
|
48
|
+
*.cover
|
|
49
|
+
*.py,cover
|
|
50
|
+
.hypothesis/
|
|
51
|
+
.pytest_cache/
|
|
52
|
+
cover/
|
|
53
|
+
|
|
54
|
+
# Translations
|
|
55
|
+
*.mo
|
|
56
|
+
*.pot
|
|
57
|
+
|
|
58
|
+
# Django stuff:
|
|
59
|
+
*.log
|
|
60
|
+
local_settings.py
|
|
61
|
+
db.sqlite3
|
|
62
|
+
db.sqlite3-journal
|
|
63
|
+
|
|
64
|
+
# Flask stuff:
|
|
65
|
+
instance/
|
|
66
|
+
.webassets-cache
|
|
67
|
+
|
|
68
|
+
# Scrapy stuff:
|
|
69
|
+
.scrapy
|
|
70
|
+
|
|
71
|
+
# Sphinx documentation
|
|
72
|
+
docs/_build/
|
|
73
|
+
|
|
74
|
+
# PyBuilder
|
|
75
|
+
.pybuilder/
|
|
76
|
+
target/
|
|
77
|
+
|
|
78
|
+
# Jupyter Notebook
|
|
79
|
+
.ipynb_checkpoints
|
|
80
|
+
|
|
81
|
+
# IPython
|
|
82
|
+
profile_default/
|
|
83
|
+
ipython_config.py
|
|
84
|
+
|
|
85
|
+
# pyenv
|
|
86
|
+
# For a library or package, you might want to ignore these files since the code is
|
|
87
|
+
# intended to run in multiple environments; otherwise, check them in:
|
|
88
|
+
# .python-version
|
|
89
|
+
|
|
90
|
+
# pipenv
|
|
91
|
+
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
|
|
92
|
+
# However, in case of collaboration, if having platform-specific dependencies or dependencies
|
|
93
|
+
# having no cross-platform support, pipenv may install dependencies that don't work, or not
|
|
94
|
+
# install all needed dependencies.
|
|
95
|
+
#Pipfile.lock
|
|
96
|
+
|
|
97
|
+
# UV
|
|
98
|
+
# Similar to Pipfile.lock, it is generally recommended to include uv.lock in version control.
|
|
99
|
+
# This is especially recommended for binary packages to ensure reproducibility, and is more
|
|
100
|
+
# commonly ignored for libraries.
|
|
101
|
+
#uv.lock
|
|
102
|
+
|
|
103
|
+
# poetry
|
|
104
|
+
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
|
|
105
|
+
# This is especially recommended for binary packages to ensure reproducibility, and is more
|
|
106
|
+
# commonly ignored for libraries.
|
|
107
|
+
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
|
|
108
|
+
#poetry.lock
|
|
109
|
+
|
|
110
|
+
# pdm
|
|
111
|
+
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
|
|
112
|
+
#pdm.lock
|
|
113
|
+
# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
|
|
114
|
+
# in version control.
|
|
115
|
+
# https://pdm.fming.dev/latest/usage/project/#working-with-version-control
|
|
116
|
+
.pdm.toml
|
|
117
|
+
.pdm-python
|
|
118
|
+
.pdm-build/
|
|
119
|
+
|
|
120
|
+
# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
|
|
121
|
+
__pypackages__/
|
|
122
|
+
|
|
123
|
+
# Celery stuff
|
|
124
|
+
celerybeat-schedule
|
|
125
|
+
celerybeat.pid
|
|
126
|
+
|
|
127
|
+
# SageMath parsed files
|
|
128
|
+
*.sage.py
|
|
129
|
+
|
|
130
|
+
# Environments
|
|
131
|
+
.env
|
|
132
|
+
.venv
|
|
133
|
+
env/
|
|
134
|
+
venv/
|
|
135
|
+
ENV/
|
|
136
|
+
env.bak/
|
|
137
|
+
venv.bak/
|
|
138
|
+
|
|
139
|
+
# Spyder project settings
|
|
140
|
+
.spyderproject
|
|
141
|
+
.spyproject
|
|
142
|
+
|
|
143
|
+
# Rope project settings
|
|
144
|
+
.ropeproject
|
|
145
|
+
|
|
146
|
+
# mkdocs documentation
|
|
147
|
+
/site
|
|
148
|
+
|
|
149
|
+
# mypy
|
|
150
|
+
.mypy_cache/
|
|
151
|
+
.dmypy.json
|
|
152
|
+
dmypy.json
|
|
153
|
+
|
|
154
|
+
# Pyre type checker
|
|
155
|
+
.pyre/
|
|
156
|
+
|
|
157
|
+
# pytype static type analyzer
|
|
158
|
+
.pytype/
|
|
159
|
+
|
|
160
|
+
# Cython debug symbols
|
|
161
|
+
cython_debug/
|
|
162
|
+
|
|
163
|
+
# PyCharm
|
|
164
|
+
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
|
|
165
|
+
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
|
|
166
|
+
# and can be added to the global gitignore or merged into this file. For a more nuclear
|
|
167
|
+
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
|
|
168
|
+
#.idea/
|
|
169
|
+
|
|
170
|
+
# Ruff stuff:
|
|
171
|
+
.ruff_cache/
|
|
172
|
+
|
|
173
|
+
# PyPI configuration file
|
|
174
|
+
.pypirc
|
pyrecap-0.0.1a0/LICENSE
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
BSD 3-Clause License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025, Brookhaven National Lab
|
|
4
|
+
All rights reserved.
|
|
5
|
+
|
|
6
|
+
Redistribution and use in source and binary forms, with or without
|
|
7
|
+
modification, are permitted provided that the following conditions are met:
|
|
8
|
+
|
|
9
|
+
1. Redistributions of source code must retain the above copyright notice, this
|
|
10
|
+
list of conditions and the following disclaimer.
|
|
11
|
+
|
|
12
|
+
2. Redistributions in binary form must reproduce the above copyright notice,
|
|
13
|
+
this list of conditions and the following disclaimer in the documentation
|
|
14
|
+
and/or other materials provided with the distribution.
|
|
15
|
+
|
|
16
|
+
3. Neither the name of the copyright holder nor the names of its contributors
|
|
17
|
+
may be used to endorse or promote products derived from this software
|
|
18
|
+
without specific prior written permission.
|
|
19
|
+
|
|
20
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
|
21
|
+
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
22
|
+
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
23
|
+
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
|
24
|
+
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
25
|
+
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
26
|
+
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
|
27
|
+
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
28
|
+
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
29
|
+
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
The Software resulted from work developed under a U.S. Government Contract No. DE-SC0012704 and are subject to the following terms: the U.S. Government is granted for itself and others acting on its behalf a paid-up, nonexclusive, irrevocable worldwide license in this computer software and data to reproduce, prepare derivative works, and perform publicly and display publicly.
|
|
2
|
+
|
|
3
|
+
THE SOFTWARE IS SUPPLIED "AS IS" WITHOUT WARRANTY OF ANY KIND. THE UNITED STATES, THE UNITED STATES DEPARTMENT OF ENERGY, AND THEIR EMPLOYEES: (1) DISCLAIM ANY WARRANTIES, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE OR NON-INFRINGEMENT, (2) DO NOT ASSUME ANY LEGAL LIABILITY OR RESPONSIBILITY FOR THE ACCURACY, COMPLETENESS, OR USEFULNESS OF THE SOFTWARE, (3) DO NOT REPRESENT THAT USE OF THE SOFTWARE WOULD NOT INFRINGE PRIVATELY OWNED RIGHTS, (4) DO NOT WARRANT THAT THE SOFTWARE WILL FUNCTION UNINTERRUPTED, THAT IT IS ERROR-FREE OR THAT ANY ERRORS WILL BE CORRECTED.
|
|
4
|
+
|
|
5
|
+
IN NO EVENT SHALL THE UNITED STATES, THE UNITED STATES DEPARTMENT OF ENERGY, OR THEIR EMPLOYEES BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, SPECIAL OR PUNITIVE DAMAGES OF ANY KIND OR NATURE RESULTING FROM EXERCISE OF THIS LICENSE AGREEMENT OR THE USE OF THE SOFTWARE.
|
pyrecap-0.0.1a0/PKG-INFO
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: pyrecap
|
|
3
|
+
Version: 0.0.1a0
|
|
4
|
+
Summary: Scientific framework for Reproducible Experiment Capture and Provenance
|
|
5
|
+
Author-email: Venkateswaran Shekar <vshekar1@bnl.gov>
|
|
6
|
+
License: BSD-3-Clause
|
|
7
|
+
License-File: AUTHORS.rst
|
|
8
|
+
License-File: LICENSE
|
|
9
|
+
License-File: LICENSE_README
|
|
10
|
+
Keywords: experiments,provenance,reproducibility
|
|
11
|
+
Classifier: Development Status :: 3 - Alpha
|
|
12
|
+
Classifier: License :: OSI Approved :: BSD License
|
|
13
|
+
Classifier: Operating System :: OS Independent
|
|
14
|
+
Classifier: Programming Language :: Python :: 3
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.8
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
19
|
+
Requires-Python: >=3.8
|
|
20
|
+
Requires-Dist: pydantic>=2.0
|
|
21
|
+
Requires-Dist: python-slugify
|
|
22
|
+
Requires-Dist: sqlalchemy>=2.0
|
|
23
|
+
Provides-Extra: dev
|
|
24
|
+
Requires-Dist: pytest; extra == 'dev'
|
|
25
|
+
Description-Content-Type: text/x-rst
|
|
26
|
+
|
|
27
|
+
======================================================
|
|
28
|
+
RECAP (Reproducible Experiment Capture and Provenance)
|
|
29
|
+
======================================================
|
|
30
|
+
|
|
31
|
+
.. image:: https://github.com/NSLS2/recap/actions/workflows/testing.yml/badge.svg
|
|
32
|
+
:target: https://github.com/NSLS2/recap/actions/workflows/testing.yml
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
.. image:: https://img.shields.io/pypi/v/recap.svg
|
|
36
|
+
:target: https://pypi.python.org/pypi/pyrecap
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
A scientific framework for Reproducible Experiment Capture, tracking, and metadata management
|
|
40
|
+
|
|
41
|
+
* Free software: 3-clause BSD license
|
|
42
|
+
* Documentation: (COMING SOON!)
|
|
43
|
+
|
|
44
|
+
Features
|
|
45
|
+
--------
|
|
46
|
+
|
|
47
|
+
* TODO
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
======================================================
|
|
2
|
+
RECAP (Reproducible Experiment Capture and Provenance)
|
|
3
|
+
======================================================
|
|
4
|
+
|
|
5
|
+
.. image:: https://github.com/NSLS2/recap/actions/workflows/testing.yml/badge.svg
|
|
6
|
+
:target: https://github.com/NSLS2/recap/actions/workflows/testing.yml
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
.. image:: https://img.shields.io/pypi/v/recap.svg
|
|
10
|
+
:target: https://pypi.python.org/pypi/pyrecap
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
A scientific framework for Reproducible Experiment Capture, tracking, and metadata management
|
|
14
|
+
|
|
15
|
+
* Free software: 3-clause BSD license
|
|
16
|
+
* Documentation: (COMING SOON!)
|
|
17
|
+
|
|
18
|
+
Features
|
|
19
|
+
--------
|
|
20
|
+
|
|
21
|
+
* TODO
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
|
|
2
|
+
[build-system]
|
|
3
|
+
requires = ["hatchling", "hatch-vcs"]
|
|
4
|
+
build-backend = "hatchling.build"
|
|
5
|
+
|
|
6
|
+
[project]
|
|
7
|
+
name = "pyrecap"
|
|
8
|
+
dynamic = ["version"]
|
|
9
|
+
description = "Scientific framework for Reproducible Experiment Capture and Provenance"
|
|
10
|
+
authors = [{ name = "Venkateswaran Shekar", email = "vshekar1@bnl.gov" }]
|
|
11
|
+
requires-python = ">=3.8"
|
|
12
|
+
readme = "README.rst"
|
|
13
|
+
license = { text = "BSD-3-Clause" }
|
|
14
|
+
dependencies = [
|
|
15
|
+
"sqlalchemy>=2.0",
|
|
16
|
+
"pydantic>=2.0",
|
|
17
|
+
"python-slugify"
|
|
18
|
+
]
|
|
19
|
+
|
|
20
|
+
keywords = ["experiments", "provenance", "reproducibility"]
|
|
21
|
+
classifiers = [
|
|
22
|
+
"Development Status :: 3 - Alpha",
|
|
23
|
+
"Programming Language :: Python :: 3",
|
|
24
|
+
"Programming Language :: Python :: 3.8",
|
|
25
|
+
"Programming Language :: Python :: 3.9",
|
|
26
|
+
"Programming Language :: Python :: 3.10",
|
|
27
|
+
"Programming Language :: Python :: 3.11",
|
|
28
|
+
"License :: OSI Approved :: BSD License",
|
|
29
|
+
"Operating System :: OS Independent"
|
|
30
|
+
]
|
|
31
|
+
|
|
32
|
+
[project.optional-dependencies]
|
|
33
|
+
dev = [
|
|
34
|
+
"pytest"
|
|
35
|
+
]
|
|
36
|
+
|
|
37
|
+
[tool.hatch.version]
|
|
38
|
+
source = "vcs"
|
|
39
|
+
|
|
40
|
+
[tool.hatch.build.hooks.vcs]
|
|
41
|
+
version-file = "recap/_version.py"
|
|
42
|
+
|
|
43
|
+
[tool.hatch.build.targets.wheel]
|
|
44
|
+
packages = ["recap"]
|
|
45
|
+
|
|
46
|
+
[tool.hatch.build]
|
|
47
|
+
include = [
|
|
48
|
+
"recap/**",
|
|
49
|
+
"README.rst",
|
|
50
|
+
"LICENSE*"
|
|
51
|
+
]
|
|
52
|
+
|
|
53
|
+
[tool.black]
|
|
54
|
+
line-length = 115
|
|
55
|
+
include = '\.pyi?$'
|
|
56
|
+
exclude = '''
|
|
57
|
+
/(
|
|
58
|
+
\.git
|
|
59
|
+
| \.hg
|
|
60
|
+
| \.mypy_cache
|
|
61
|
+
| \.tox
|
|
62
|
+
| \.venv
|
|
63
|
+
| _build
|
|
64
|
+
| buck-out
|
|
65
|
+
| build
|
|
66
|
+
| dist
|
|
67
|
+
|
|
68
|
+
# The following are specific to Black, you probably don't want those.
|
|
69
|
+
| blib2to3
|
|
70
|
+
| tests/data
|
|
71
|
+
)/
|
|
72
|
+
'''
|
|
73
|
+
|
|
74
|
+
[tool.ruff]
|
|
75
|
+
line-length = 88
|
|
76
|
+
target-version = "py311"
|
|
77
|
+
|
|
78
|
+
[tool.ruff.lint]
|
|
79
|
+
select = ["E", "F", "W", "I", "B", "UP", "SIM", "C90"]
|
|
80
|
+
ignore = ["E203", "E501"] # Black-style formatting norms
|
|
81
|
+
|
|
82
|
+
[tool.ruff.lint.per-file-ignores]
|
|
83
|
+
"**/versioneer.py" = ["ALL"]
|
|
84
|
+
"**/_version.py" = ["ALL"]
|
|
85
|
+
"**/setup.py" = ["ALL"]
|
|
86
|
+
"**/docs/**" = ["ALL"]
|
|
87
|
+
|
|
88
|
+
[tool.ruff.lint.isort]
|
|
89
|
+
known-first-party = []
|
|
90
|
+
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
# file generated by setuptools-scm
|
|
2
|
+
# don't change, don't track in version control
|
|
3
|
+
|
|
4
|
+
__all__ = [
|
|
5
|
+
"__version__",
|
|
6
|
+
"__version_tuple__",
|
|
7
|
+
"version",
|
|
8
|
+
"version_tuple",
|
|
9
|
+
"__commit_id__",
|
|
10
|
+
"commit_id",
|
|
11
|
+
]
|
|
12
|
+
|
|
13
|
+
TYPE_CHECKING = False
|
|
14
|
+
if TYPE_CHECKING:
|
|
15
|
+
from typing import Tuple
|
|
16
|
+
from typing import Union
|
|
17
|
+
|
|
18
|
+
VERSION_TUPLE = Tuple[Union[int, str], ...]
|
|
19
|
+
COMMIT_ID = Union[str, None]
|
|
20
|
+
else:
|
|
21
|
+
VERSION_TUPLE = object
|
|
22
|
+
COMMIT_ID = object
|
|
23
|
+
|
|
24
|
+
version: str
|
|
25
|
+
__version__: str
|
|
26
|
+
__version_tuple__: VERSION_TUPLE
|
|
27
|
+
version_tuple: VERSION_TUPLE
|
|
28
|
+
commit_id: COMMIT_ID
|
|
29
|
+
__commit_id__: COMMIT_ID
|
|
30
|
+
|
|
31
|
+
__version__ = version = '0.0.1a0'
|
|
32
|
+
__version_tuple__ = version_tuple = (0, 0, 1, 'a0')
|
|
33
|
+
|
|
34
|
+
__commit_id__ = commit_id = None
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
from contextlib import contextmanager
|
|
2
|
+
|
|
3
|
+
from sqlalchemy import create_engine
|
|
4
|
+
from sqlalchemy.orm import sessionmaker
|
|
5
|
+
|
|
6
|
+
from recap.dsl.process_builder import ProcessRunBuilder, ProcessTemplateBuilder
|
|
7
|
+
from recap.dsl.resource_builder import ResourceTemplateBuilder
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
class RecapClient:
|
|
11
|
+
def __init__(self, url: str | None = None, echo: bool = False, session=None):
|
|
12
|
+
if url is not None:
|
|
13
|
+
self.engine = create_engine(url, echo=echo)
|
|
14
|
+
self.Session = sessionmaker(
|
|
15
|
+
bind=self.engine, expire_on_commit=False, future=True
|
|
16
|
+
)
|
|
17
|
+
if session is not None:
|
|
18
|
+
self._session = session
|
|
19
|
+
|
|
20
|
+
@contextmanager
|
|
21
|
+
def session(self):
|
|
22
|
+
"""Yield a Session with transaction boundaries."""
|
|
23
|
+
with self.Session() as session:
|
|
24
|
+
try:
|
|
25
|
+
with session.begin():
|
|
26
|
+
yield session
|
|
27
|
+
finally:
|
|
28
|
+
# Session closed by context exit
|
|
29
|
+
...
|
|
30
|
+
|
|
31
|
+
def process_template(self, name: str, version: str) -> ProcessTemplateBuilder:
|
|
32
|
+
session = self._session
|
|
33
|
+
return ProcessTemplateBuilder(session=session, name=name, version=version)
|
|
34
|
+
|
|
35
|
+
def process_run(self, name: str, template_name: str, version: str):
|
|
36
|
+
return ProcessRunBuilder(
|
|
37
|
+
session=self._session,
|
|
38
|
+
name=name,
|
|
39
|
+
template_name=template_name,
|
|
40
|
+
version=version,
|
|
41
|
+
)
|
|
42
|
+
|
|
43
|
+
def resource_template(self, name: str, type_names: list[str]):
|
|
44
|
+
return ResourceTemplateBuilder(
|
|
45
|
+
session=self._session, name=name, type_names=type_names
|
|
46
|
+
)
|