Metadata-Version: 2.4
Name: sophios
Version: 0.6.0
Summary: DSL for inferring the edges of a CWL workflow DAG
Author-email: Jake Fennick <jake.fennick@axleinfo.com>
Project-URL: Homepage, https://github.com/PolusAI/sophios
Project-URL: Bug Tracker, https://github.com/PolusAI/sophios/issues
Classifier: Programming Language :: Python :: 3
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Requires-Python: >=3.11
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: cwltool
Requires-Dist: graphviz
Requires-Dist: jsonschema
Requires-Dist: pyyaml
Requires-Dist: requests
Requires-Dist: mergedeep
Requires-Dist: networkx
Requires-Dist: cwl-utils>=0.32
Requires-Dist: pydantic>=2.6
Requires-Dist: pydantic[email]
Requires-Dist: docker
Requires-Dist: podman
Requires-Dist: toil[cwl]
Requires-Dist: fastapi
Requires-Dist: uvicorn
Requires-Dist: referencing
Requires-Dist: aiofiles
Provides-Extra: test
Requires-Dist: pre-commit; extra == "test"
Requires-Dist: py; extra == "test"
Requires-Dist: pytest; extra == "test"
Requires-Dist: pytest-cov; extra == "test"
Requires-Dist: pytest-parallel; extra == "test"
Requires-Dist: coverage; extra == "test"
Requires-Dist: mypy; extra == "test"
Requires-Dist: numpy; extra == "test"
Requires-Dist: scipy; extra == "test"
Requires-Dist: pylint; extra == "test"
Requires-Dist: autopep8; extra == "test"
Requires-Dist: pre-commit; extra == "test"
Requires-Dist: hypothesis; extra == "test"
Requires-Dist: hypothesis-jsonschema; extra == "test"
Provides-Extra: mypy-types
Requires-Dist: lxml-stubs; extra == "mypy-types"
Requires-Dist: types-Pillow; extra == "mypy-types"
Requires-Dist: types-PyYAML; extra == "mypy-types"
Requires-Dist: types-Pygments; extra == "mypy-types"
Requires-Dist: types-colorama; extra == "mypy-types"
Requires-Dist: types-decorator; extra == "mypy-types"
Requires-Dist: types-docutils; extra == "mypy-types"
Requires-Dist: types-html5lib; extra == "mypy-types"
Requires-Dist: types-jsonschema; extra == "mypy-types"
Requires-Dist: types-psutil; extra == "mypy-types"
Requires-Dist: types-python-jose; extra == "mypy-types"
Requires-Dist: types-pytz; extra == "mypy-types"
Requires-Dist: types-redis; extra == "mypy-types"
Requires-Dist: types-requests; extra == "mypy-types"
Requires-Dist: types-setuptools; extra == "mypy-types"
Requires-Dist: types-six; extra == "mypy-types"
Requires-Dist: types-urllib3; extra == "mypy-types"
Requires-Dist: types-aiofiles; extra == "mypy-types"
Provides-Extra: runners
Requires-Dist: toil[cwl]; extra == "runners"
Requires-Dist: cwl-utils; extra == "runners"
Provides-Extra: doc
Requires-Dist: sphinx; extra == "doc"
Requires-Dist: myst-parser; extra == "doc"
Requires-Dist: sphinx-autodoc-typehints; extra == "doc"
Provides-Extra: plots
Requires-Dist: matplotlib; extra == "plots"
Provides-Extra: cyto
Requires-Dist: ipycytoscape; extra == "cyto"
Provides-Extra: all-except-runner-src
Requires-Dist: sophios[cyto,doc,mypy-types,plots,test]; extra == "all-except-runner-src"
Dynamic: license-file

# Sophios

[![doc-build-status](https://readthedocs.org/projects/sophios/badge/?version=latest)](https://sophios.readthedocs.io/en/latest/)

Sophios is a Python-first authoring layer for [Common Workflow Language](https://www.commonwl.org) (CWL) workflows. It lets users describe command-line tool contracts, compose those tools into workflow DAGs, compile the graph to inspectable CWL, and run locally or prepare schema-validated compute submissions.

## Documentation
The documentation is available on [readthedocs](https://sophios.readthedocs.io/en/latest/).
## Quick Start
See the [installation guide](docs/installguide.md) for more details, but:

For pip users:

`pip install sophios`

Sophios installs its Python workflow-building and validation dependencies with
the package. Some workflows also depend on external system tools such as Docker,
Podman, Graphviz, Node.js, or the command-line programs invoked by your CWL
tools.

For conda users / developers:

See the [installation guide for developers](docs/dev/installguide.md)

```python
from pathlib import Path

from sophios.api.python.workflow import Step, Workflow


echo = Step(clt_path=Path("cwl_adapters") / "echo.cwl")
echo.inputs.message = "Hello World"

workflow = Workflow([echo], "hello_python")
compiled = workflow.compile()
compiled.write_cwl("autogenerated")
compiled.write_job_inputs("autogenerated")
```

For the file-native YAML path, the CLI still supports `.wic` workflows:

```bash
sophios --yaml docs/tutorials/helloworld.wic --graphviz --run_local --outdir helloworld_output --quiet
```

Sophios compiles both Python-authored workflows and `.wic` workflows to CWL. Users should inspect important generated DAGs and CWL artifacts before relying on edge inference in production workflows.

## Python API

The public Python API is split into three deliberate surfaces:

- `sophios.api.python.tool_builder` builds CWL `CommandLineTool` contracts.
- `sophios.api.python.workflow` composes `Step` and `Workflow` DAGs.
- `sophios.compute_request` packages compiled workflows for compute submission.

Use `Workflow([steps], "name")` to make the DAG explicit, `Step(clt_path=...)` for existing CWL tools, `Step(tool)` or `tool.to_step()` for in-memory tool-builder handoff, and `workflow.compile()` to produce the public compiled CWL boundary.

## Edge Inference

Sophios can infer many linear edges based on CWL types, file formats, and naming conventions. In Python workflows, leaving a required step input unbound allows the compiler to apply the same inference mechanism used by `.wic` workflows. Inference is useful, but it is not a substitute for reviewing generated artifacts when correctness matters.

## Subworkflows

Subworkflows are very useful for creating reusable, composable building blocks. As shown above, recursive subworkflows are fully supported, and the edge inference algorithm has been very carefully constructed to work across subworkflow boundaries.

## Explicit CWL

Sophios produces ordinary CWL artifacts. Users do not need to write raw CWL for the common path, but generated CWL remains available for inspection, execution by CWL runners, and advanced integration.
