inspect-flow 0.0.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.
Files changed (37) hide show
  1. inspect_flow-0.0.1/.gitignore +229 -0
  2. inspect_flow-0.0.1/LICENSE +21 -0
  3. inspect_flow-0.0.1/PKG-INFO +51 -0
  4. inspect_flow-0.0.1/README.md +34 -0
  5. inspect_flow-0.0.1/pyproject.toml +112 -0
  6. inspect_flow-0.0.1/src/inspect_flow/README.md +54 -0
  7. inspect_flow-0.0.1/src/inspect_flow/__init__.py +57 -0
  8. inspect_flow-0.0.1/src/inspect_flow/_api/__init__.py +0 -0
  9. inspect_flow-0.0.1/src/inspect_flow/_api/api.py +36 -0
  10. inspect_flow-0.0.1/src/inspect_flow/_cli/__init__.py +0 -0
  11. inspect_flow-0.0.1/src/inspect_flow/_cli/config.py +30 -0
  12. inspect_flow-0.0.1/src/inspect_flow/_cli/main.py +45 -0
  13. inspect_flow-0.0.1/src/inspect_flow/_cli/options.py +103 -0
  14. inspect_flow-0.0.1/src/inspect_flow/_cli/run.py +30 -0
  15. inspect_flow-0.0.1/src/inspect_flow/_config/__init__.py +0 -0
  16. inspect_flow-0.0.1/src/inspect_flow/_config/load.py +140 -0
  17. inspect_flow-0.0.1/src/inspect_flow/_config/write.py +16 -0
  18. inspect_flow-0.0.1/src/inspect_flow/_launcher/__init__.py +0 -0
  19. inspect_flow-0.0.1/src/inspect_flow/_launcher/launch.py +90 -0
  20. inspect_flow-0.0.1/src/inspect_flow/_launcher/venv.py +223 -0
  21. inspect_flow-0.0.1/src/inspect_flow/_runner/__init__.py +0 -0
  22. inspect_flow-0.0.1/src/inspect_flow/_runner/instantiate.py +177 -0
  23. inspect_flow-0.0.1/src/inspect_flow/_runner/resolve.py +196 -0
  24. inspect_flow-0.0.1/src/inspect_flow/_runner/run.py +135 -0
  25. inspect_flow-0.0.1/src/inspect_flow/_types/__init__.py +0 -0
  26. inspect_flow-0.0.1/src/inspect_flow/_types/factories.py +260 -0
  27. inspect_flow-0.0.1/src/inspect_flow/_types/flow_types.py +558 -0
  28. inspect_flow-0.0.1/src/inspect_flow/_types/generated.py +445 -0
  29. inspect_flow-0.0.1/src/inspect_flow/_types/merge.py +63 -0
  30. inspect_flow-0.0.1/src/inspect_flow/_types/type_gen.py +354 -0
  31. inspect_flow-0.0.1/src/inspect_flow/_util/__init__.py +0 -0
  32. inspect_flow-0.0.1/src/inspect_flow/_util/list_util.py +13 -0
  33. inspect_flow-0.0.1/src/inspect_flow/_util/module_util.py +60 -0
  34. inspect_flow-0.0.1/src/inspect_flow/_util/path_util.py +32 -0
  35. inspect_flow-0.0.1/src/inspect_flow/_version.py +34 -0
  36. inspect_flow-0.0.1/src/inspect_flow/api/__init__.py +11 -0
  37. inspect_flow-0.0.1/src/inspect_flow/py.typed +0 -0
@@ -0,0 +1,229 @@
1
+ # Byte-compiled / optimized / DLL files
2
+ __pycache__/
3
+ *.py[codz]
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
+ #poetry.toml
110
+
111
+ # pdm
112
+ # Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
113
+ # pdm recommends including project-wide configuration in pdm.toml, but excluding .pdm-python.
114
+ # https://pdm-project.org/en/latest/usage/project/#working-with-version-control
115
+ #pdm.lock
116
+ #pdm.toml
117
+ .pdm-python
118
+ .pdm-build/
119
+
120
+ # pixi
121
+ # Similar to Pipfile.lock, it is generally recommended to include pixi.lock in version control.
122
+ #pixi.lock
123
+ # Pixi creates a virtual environment in the .pixi directory, just like venv module creates one
124
+ # in the .venv directory. It is recommended not to include this directory in version control.
125
+ .pixi
126
+
127
+ # PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
128
+ __pypackages__/
129
+
130
+ # Celery stuff
131
+ celerybeat-schedule
132
+ celerybeat.pid
133
+
134
+ # SageMath parsed files
135
+ *.sage.py
136
+
137
+ # Environments
138
+ .env
139
+ .envrc
140
+ .venv
141
+ env/
142
+ venv/
143
+ ENV/
144
+ env.bak/
145
+ venv.bak/
146
+
147
+ # Spyder project settings
148
+ .spyderproject
149
+ .spyproject
150
+
151
+ # Rope project settings
152
+ .ropeproject
153
+
154
+ # mkdocs documentation
155
+ /site
156
+
157
+ # mypy
158
+ .mypy_cache/
159
+ .dmypy.json
160
+ dmypy.json
161
+
162
+ # Pyre type checker
163
+ .pyre/
164
+
165
+ # pytype static type analyzer
166
+ .pytype/
167
+
168
+ # Cython debug symbols
169
+ cython_debug/
170
+
171
+ # PyCharm
172
+ # JetBrains specific template is maintained in a separate JetBrains.gitignore that can
173
+ # be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
174
+ # and can be added to the global gitignore or merged into this file. For a more nuclear
175
+ # option (not recommended) you can uncomment the following to ignore the entire idea folder.
176
+ #.idea/
177
+
178
+ # Abstra
179
+ # Abstra is an AI-powered process automation framework.
180
+ # Ignore directories containing user credentials, local state, and settings.
181
+ # Learn more at https://abstra.io/docs
182
+ .abstra/
183
+
184
+ # Visual Studio Code
185
+ # Visual Studio Code specific template is maintained in a separate VisualStudioCode.gitignore
186
+ # that can be found at https://github.com/github/gitignore/blob/main/Global/VisualStudioCode.gitignore
187
+ # and can be added to the global gitignore or merged into this file. However, if you prefer,
188
+ # you could uncomment the following to ignore the entire vscode folder
189
+ # .vscode/
190
+ .vscode/*
191
+ !.vscode/settings.json
192
+ !.vscode/tasks.json
193
+ #!.vscode/launch.json
194
+ !.vscode/extensions.json
195
+ !.vscode/*.code-snippets
196
+ !*.code-workspace
197
+
198
+ # Built Visual Studio Code Extensions
199
+ *.vsix
200
+
201
+ # python version
202
+ .python-version
203
+
204
+ # Ruff stuff:
205
+ .ruff_cache/
206
+
207
+ # PyPI configuration file
208
+ .pypirc
209
+
210
+ # Cursor
211
+ # Cursor is an AI-powered code editor. `.cursorignore` specifies files/directories to
212
+ # exclude from AI features like autocomplete and code analysis. Recommended for sensitive data
213
+ # refer to https://docs.cursor.com/context/ignore-files
214
+ .cursorignore
215
+ .cursorindexingignore
216
+
217
+ # Marimo
218
+ marimo/_static/
219
+ marimo/_lsp/
220
+ __marimo__/
221
+
222
+ # Dynamic version
223
+ src/inspect_flow/_version.py
224
+
225
+ # Inspect logs
226
+ logs/
227
+
228
+ # MacOS
229
+ .DS_Store
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 Meridian Labs
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.
@@ -0,0 +1,51 @@
1
+ Metadata-Version: 2.4
2
+ Name: inspect_flow
3
+ Version: 0.0.1
4
+ Summary: Inspect Flow is a workflow stack built on Inspect AI that enables research organizations to run AI evaluations at scale
5
+ Project-URL: Source Code, https://github.com/meridianlabs-ai/inspect_flow
6
+ Project-URL: Issue Tracker, https://github.com/meridianlabs-ai/inspect_flow/issues
7
+ Author: Meridian Labs
8
+ License: MIT License
9
+ License-File: LICENSE
10
+ Requires-Python: >=3.10
11
+ Requires-Dist: click>=8.2.1
12
+ Requires-Dist: inspect-ai>=0.3.131
13
+ Requires-Dist: pydantic>=2.11.2
14
+ Requires-Dist: python-dotenv>=1.1.1
15
+ Requires-Dist: typing-extensions>=4.9.0
16
+ Description-Content-Type: text/markdown
17
+
18
+ Welcome to Inspect Flow. Inspect Flow is a workflow stack built on Inspect AI that enables research organizations to run AI evaluations at scale.
19
+
20
+ ## Installation
21
+
22
+ Latest development version:
23
+
24
+ ```bash
25
+ pip install git+https://github.com/meridianlabs-ai/inspect_flow
26
+ ```
27
+
28
+ ## Development
29
+
30
+ To work on development of Inspect Flow, clone the repository and install with the `-e` flag and `[dev]` optional dependencies:
31
+
32
+ ```bash
33
+ git clone https://github.com/meridianlabs-ai/inspect_flow
34
+ cd inspect_flow
35
+ uv sync
36
+ ```
37
+
38
+ Optionally install pre-commit hooks via
39
+
40
+ ```bash
41
+ make hooks
42
+ ```
43
+
44
+ Run linting, formatting, and tests via
45
+
46
+ ```bash
47
+ make check
48
+ make test
49
+ ```
50
+
51
+
@@ -0,0 +1,34 @@
1
+ Welcome to Inspect Flow. Inspect Flow is a workflow stack built on Inspect AI that enables research organizations to run AI evaluations at scale.
2
+
3
+ ## Installation
4
+
5
+ Latest development version:
6
+
7
+ ```bash
8
+ pip install git+https://github.com/meridianlabs-ai/inspect_flow
9
+ ```
10
+
11
+ ## Development
12
+
13
+ To work on development of Inspect Flow, clone the repository and install with the `-e` flag and `[dev]` optional dependencies:
14
+
15
+ ```bash
16
+ git clone https://github.com/meridianlabs-ai/inspect_flow
17
+ cd inspect_flow
18
+ uv sync
19
+ ```
20
+
21
+ Optionally install pre-commit hooks via
22
+
23
+ ```bash
24
+ make hooks
25
+ ```
26
+
27
+ Run linting, formatting, and tests via
28
+
29
+ ```bash
30
+ make check
31
+ make test
32
+ ```
33
+
34
+
@@ -0,0 +1,112 @@
1
+ [build-system]
2
+ requires = ["hatchling", "hatch-vcs"]
3
+ build-backend = "hatchling.build"
4
+
5
+ [project]
6
+ name = "inspect_flow"
7
+ dynamic = ["version"]
8
+ description = "Inspect Flow is a workflow stack built on Inspect AI that enables research organizations to run AI evaluations at scale"
9
+ authors = [{ name = "Meridian Labs" }]
10
+ readme = "README.md"
11
+ requires-python = ">=3.10"
12
+ license = { text = "MIT License" }
13
+ dependencies = [
14
+ "click>=8.2.1",
15
+ "inspect-ai>=0.3.131",
16
+ "pydantic>=2.11.2",
17
+ "python-dotenv>=1.1.1",
18
+ "typing_extensions>=4.9.0",
19
+ ]
20
+
21
+ [project.urls]
22
+ "Source Code" = "https://github.com/meridianlabs-ai/inspect_flow"
23
+ "Issue Tracker" = "https://github.com/meridianlabs-ai/inspect_flow/issues"
24
+
25
+ [project.scripts]
26
+ flow = "inspect_flow._cli.main:main"
27
+
28
+ [dependency-groups]
29
+ dev = [
30
+ "ruff",
31
+ "pytest",
32
+ "pytest-cov",
33
+ "anthropic",
34
+ "openai",
35
+ "pytest-asyncio",
36
+ "pytest-dotenv",
37
+ "pyright",
38
+ "types-pyyaml>=6.0.12.20250915",
39
+ "datamodel-code-generator",
40
+ "pre-commit",
41
+ ]
42
+
43
+
44
+ [tool.hatch.build]
45
+ only-packages = true
46
+ exclude = ["docs/", "tests/"]
47
+
48
+ [tool.hatch.version]
49
+ source = "vcs"
50
+
51
+ [tool.hatch.build.hooks.vcs]
52
+ version-file = "src/inspect_flow/_version.py"
53
+
54
+ [tool.hatch.version.raw-options]
55
+ local_scheme = "no-local-version" # Important for PyPI compatibility
56
+
57
+ [tool.uv]
58
+ managed = true
59
+ add-bounds = "lower"
60
+ default-groups = ["dev"]
61
+
62
+ [tool.ruff]
63
+ extend-exclude = ["docs"]
64
+ src = ["."]
65
+
66
+ [tool.ruff.lint]
67
+ select = [
68
+ "E", # pycodestyle errors
69
+ "W", # pycodestyle warnings
70
+ "F", # flake8
71
+ "D", # pydocstyle
72
+ "I", # isort
73
+ "B", # flake8-bugbear
74
+ "SIM101", # duplicate isinstance
75
+ # "RET", # flake8-return
76
+ # "RUF", # ruff rules
77
+ ]
78
+ ignore = [
79
+ "E203", # whitespace before ':'
80
+ "E501", # line too long
81
+ "D105", # missing docstring in magic method
82
+ "D107", # missing docstring in __init__
83
+ "D212", # multi-line docstring summary should start at the first line
84
+ "D415", # first line should end with a period, question mark, or exclamation point
85
+ ]
86
+
87
+ [tool.ruff.lint.per-file-ignores]
88
+ "tests/**/*.py" = ["D"]
89
+
90
+ [tool.ruff.lint.pydocstyle]
91
+ convention = "google"
92
+
93
+ [tool.pytest.ini_options]
94
+ pythonpath = ["src"]
95
+ testpaths = ["tests"]
96
+
97
+ [tool.coverage.run]
98
+ source = ["src"]
99
+ omit = ["*/tests/*", "*/__pycache__/*", "*/test_*.py"]
100
+
101
+ [tool.coverage.report]
102
+ exclude_lines = [
103
+ "pragma: no cover",
104
+ "def __repr__",
105
+ "raise AssertionError",
106
+ "raise NotImplementedError",
107
+ "if __name__ == .__main__.:",
108
+ "if TYPE_CHECKING:",
109
+ "@abstractmethod",
110
+ ]
111
+ show_missing = true
112
+ precision = 2
@@ -0,0 +1,54 @@
1
+ # Inspect Flow Internals
2
+
3
+ ## _types Module
4
+
5
+ [_types](./_types) defines the types used in inspect flow configurations.
6
+
7
+ [flow_config.py](./_types/flow_config.py) defines the pydantic types for the configuration. These types have a "Flow" prefix, e.g. `FlowTask`.
8
+
9
+ [type_gen.py](./_types/type_gen.py) defines the code generation logic that generates TypedDict classes based on the pydantic types.
10
+ These generated types are in [generated.py](./_types/generated.py).
11
+
12
+ `FlowTaskDict` and other types with a `Dict` suffix are TypedDicts corresponding to the Pydantic types.
13
+ These are used primarily to unpack kwargs in the _with functions.
14
+ `FlowTaskMatrixDict` and the other types with a `MatrixDict` suffix are TypedDicts that store lists instead of single values.
15
+ These are for use in the matrix functions with lists for their field types.
16
+
17
+ [factories.py](./_types/factories.py) defines three types of functions.
18
+ The `_with` functions apply fields to all objects in a list. For example `task_with` sets fields on a list of tasks (specified as a list of string, `FTask`, `FlowTask`, and `FlowTaskDict`).
19
+ The `_matrix` functions, like `tasks_matrix` generate lists of types from the product of lists of field values.
20
+
21
+ ## _api Module
22
+
23
+ [_api](./_api) defines the public API for inspect flow.
24
+ This includes the main entry points for running flows and interacting with the framework.
25
+ These functions correspond to the CLI commands defined in the [_cli](./_cli) module.
26
+
27
+ ## _cli Module
28
+
29
+ [_cli](./_cli) defines the command line interface for inspect flow. The main command is `run`, defined in [run.py](./_cli/run.py).
30
+
31
+ ## _config Module
32
+
33
+ [_config](./_config) is responsible for loading and validating the flow configuration. The main function is `load_config`, defined in [config.py](./_config/config.py).
34
+
35
+ ## _launcher Module
36
+
37
+ [_launcher](./_launcher) is responsible for creating the virtual environment, installing package dependencies, and starting the flow runner process.
38
+ The main function is `launch`, defined in [launch.py](./_launcher/launch.py).
39
+
40
+ ## _runner Module
41
+
42
+ [_runner](./_runner) is responsible for running the flow tasks within the virtual environment.
43
+ The main function is `flow_run`, defined in [run.py](./_runner/run.py).
44
+ This involves:
45
+ 1. Resolving the flow configuration into a canonical representation of the tasks with all defaults explicitly set.
46
+ This may require loading source files to determine the exported task functions.
47
+ 2. Instantiating the tasks and all dependencies.
48
+ This converts from the configuration into the inspect AI objects required to run the tasks.
49
+ 3. Running the tasks.
50
+ Currently eval_set is used, although this may change in the future.
51
+
52
+ ## _util Module
53
+
54
+ [_util](./_util) defines utility functions and classes used throughout the inspect flow codebase.
@@ -0,0 +1,57 @@
1
+ """inspect_flow methods for constructing flow configs."""
2
+
3
+ try:
4
+ from ._version import __version__
5
+ except ImportError:
6
+ __version__ = "unknown"
7
+
8
+ from inspect_flow._types.factories import (
9
+ agents_matrix,
10
+ agents_with,
11
+ configs_matrix,
12
+ configs_with,
13
+ models_matrix,
14
+ models_with,
15
+ solvers_matrix,
16
+ solvers_with,
17
+ tasks_matrix,
18
+ tasks_with,
19
+ )
20
+ from inspect_flow._types.flow_types import (
21
+ FlowAgent,
22
+ FlowDefaults,
23
+ FlowEpochs,
24
+ FlowGenerateConfig,
25
+ FlowJob,
26
+ FlowModel,
27
+ FlowOptions,
28
+ FlowSolver,
29
+ FlowTask,
30
+ )
31
+ from inspect_flow._types.merge import (
32
+ merge,
33
+ )
34
+
35
+ __all__ = [
36
+ "__version__",
37
+ "FlowAgent",
38
+ "FlowJob",
39
+ "FlowDefaults",
40
+ "FlowEpochs",
41
+ "FlowGenerateConfig",
42
+ "FlowModel",
43
+ "FlowOptions",
44
+ "FlowSolver",
45
+ "FlowTask",
46
+ "agents_matrix",
47
+ "agents_with",
48
+ "configs_matrix",
49
+ "configs_with",
50
+ "merge",
51
+ "models_matrix",
52
+ "models_with",
53
+ "solvers_matrix",
54
+ "solvers_with",
55
+ "tasks_matrix",
56
+ "tasks_with",
57
+ ]
File without changes
@@ -0,0 +1,36 @@
1
+ import click
2
+
3
+ from inspect_flow._config.write import config_to_yaml
4
+ from inspect_flow._launcher.launch import launch
5
+ from inspect_flow._types.flow_types import FlowJob
6
+
7
+
8
+ def run(
9
+ config: FlowJob,
10
+ dry_run: bool = False,
11
+ ) -> None:
12
+ """Run an inspect_flow evaluation.
13
+
14
+ Args:
15
+ config: The flow configuration.
16
+ dry_run: If True, do not run eval, but show a count of tasks that would be run.
17
+ """
18
+ run_args = ["--dry-run"] if dry_run else []
19
+ launch(config=config, run_args=run_args)
20
+
21
+
22
+ def config(
23
+ config: FlowJob,
24
+ resolve: bool = False,
25
+ ) -> None:
26
+ """Print the flow configuration.
27
+
28
+ Args:
29
+ config: The flow configuration.
30
+ resolve: If True, resolve the configuration before printing.
31
+ """
32
+ if resolve:
33
+ launch(config=config, run_args=["--config"])
34
+ else:
35
+ dump = config_to_yaml(config)
36
+ click.echo(dump)
File without changes
@@ -0,0 +1,30 @@
1
+ import click
2
+ from typing_extensions import Unpack
3
+
4
+ from inspect_flow._api.api import config
5
+ from inspect_flow._cli.options import (
6
+ ConfigOptionArgs,
7
+ config_options,
8
+ parse_config_options,
9
+ )
10
+ from inspect_flow._config.load import load_config
11
+
12
+
13
+ @click.command("config", help="Output config")
14
+ @click.argument("config-file", type=str, required=True)
15
+ @click.option(
16
+ "--resolve",
17
+ type=bool,
18
+ is_flag=True,
19
+ envvar="INSPECT_FLOW_RESOLVE",
20
+ help="Fully resolve the config. Will create a venv and create all objects.",
21
+ )
22
+ @config_options
23
+ def config_command(
24
+ config_file: str,
25
+ resolve: bool,
26
+ **kwargs: Unpack[ConfigOptionArgs],
27
+ ) -> None:
28
+ config_options = parse_config_options(**kwargs)
29
+ fconfig = load_config(config_file, config_options=config_options)
30
+ config(fconfig, resolve=resolve)
@@ -0,0 +1,45 @@
1
+ import click
2
+ from dotenv import find_dotenv, load_dotenv
3
+
4
+ from inspect_flow._cli.config import config_command
5
+
6
+ from .. import __version__
7
+ from .run import run_command
8
+
9
+
10
+ @click.group(invoke_without_command=True)
11
+ @click.option(
12
+ "--version",
13
+ type=bool,
14
+ is_flag=True,
15
+ default=False,
16
+ help="Print the flow version.",
17
+ )
18
+ @click.pass_context
19
+ def flow(
20
+ ctx: click.Context,
21
+ version: bool,
22
+ ) -> None:
23
+ # if this was a subcommand then allow it to execute
24
+ if ctx.invoked_subcommand is not None:
25
+ return
26
+
27
+ if version:
28
+ click.echo(__version__)
29
+ ctx.exit()
30
+ else:
31
+ click.echo(ctx.get_help())
32
+ ctx.exit()
33
+
34
+
35
+ flow.add_command(run_command)
36
+ flow.add_command(config_command)
37
+
38
+
39
+ def main() -> None:
40
+ load_dotenv(find_dotenv(usecwd=True))
41
+ flow(auto_envvar_prefix="INSPECT_FLOW")
42
+
43
+
44
+ if __name__ == "__main__":
45
+ main()