nipact 0.0.1a1__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 (74) hide show
  1. nipact-0.0.1a1/LICENSE +21 -0
  2. nipact-0.0.1a1/PKG-INFO +169 -0
  3. nipact-0.0.1a1/README.md +140 -0
  4. nipact-0.0.1a1/pyproject.toml +61 -0
  5. nipact-0.0.1a1/setup.cfg +4 -0
  6. nipact-0.0.1a1/src/nipact/__init__.py +5 -0
  7. nipact-0.0.1a1/src/nipact/_version.py +3 -0
  8. nipact-0.0.1a1/src/nipact/artifacts.py +44 -0
  9. nipact-0.0.1a1/src/nipact/cli.py +708 -0
  10. nipact-0.0.1a1/src/nipact/cli_feedback.py +145 -0
  11. nipact-0.0.1a1/src/nipact/context_index.py +211 -0
  12. nipact-0.0.1a1/src/nipact/errors.py +11 -0
  13. nipact-0.0.1a1/src/nipact/examples/__init__.py +1 -0
  14. nipact-0.0.1a1/src/nipact/examples/colors_processing_demo/__init__.py +1 -0
  15. nipact-0.0.1a1/src/nipact/examples/colors_processing_demo/demo_names.py +18 -0
  16. nipact-0.0.1a1/src/nipact/examples/colors_processing_demo/model.py +401 -0
  17. nipact-0.0.1a1/src/nipact/examples/colors_processing_demo/project_template.py +386 -0
  18. nipact-0.0.1a1/src/nipact/examples/colors_processing_demo/runtime.py +339 -0
  19. nipact-0.0.1a1/src/nipact/examples/dynamic_functional_connectivity_demo/__init__.py +2 -0
  20. nipact-0.0.1a1/src/nipact/examples/dynamic_functional_connectivity_demo/project_template.py +185 -0
  21. nipact-0.0.1a1/src/nipact/examples/dynamic_functional_connectivity_demo/runtime.py +95 -0
  22. nipact-0.0.1a1/src/nipact/examples/fmri_preprocessing_demo/__init__.py +2 -0
  23. nipact-0.0.1a1/src/nipact/examples/fmri_preprocessing_demo/project_template.py +192 -0
  24. nipact-0.0.1a1/src/nipact/examples/fmri_preprocessing_demo/runtime.py +75 -0
  25. nipact-0.0.1a1/src/nipact/execution.py +1426 -0
  26. nipact-0.0.1a1/src/nipact/gui/__init__.py +11 -0
  27. nipact-0.0.1a1/src/nipact/gui/app.py +229 -0
  28. nipact-0.0.1a1/src/nipact/gui/models.py +186 -0
  29. nipact-0.0.1a1/src/nipact/gui/project.py +36 -0
  30. nipact-0.0.1a1/src/nipact/gui/service.py +235 -0
  31. nipact-0.0.1a1/src/nipact/gui/static/assets/ArtifactDetailPage-CeAvjVeR.js +1 -0
  32. nipact-0.0.1a1/src/nipact/gui/static/assets/ArtifactsPage-DPqK4hm-.js +1 -0
  33. nipact-0.0.1a1/src/nipact/gui/static/assets/DataTable-IIdX9zwr.js +1 -0
  34. nipact-0.0.1a1/src/nipact/gui/static/assets/EmptyPanel-ffwe1tSg.js +1 -0
  35. nipact-0.0.1a1/src/nipact/gui/static/assets/IdentifierValue-LV-Kl1jV.js +1 -0
  36. nipact-0.0.1a1/src/nipact/gui/static/assets/KeyValueGrid-Hn5u373-.js +1 -0
  37. nipact-0.0.1a1/src/nipact/gui/static/assets/LineageGraphCanvas-o0o1apQF.js +1 -0
  38. nipact-0.0.1a1/src/nipact/gui/static/assets/LineagePage-CJVkAo6F.js +2 -0
  39. nipact-0.0.1a1/src/nipact/gui/static/assets/ManifestDetailPage-C-Cx9uQg.js +1 -0
  40. nipact-0.0.1a1/src/nipact/gui/static/assets/ManifestsPage-SrWN8IbW.js +1 -0
  41. nipact-0.0.1a1/src/nipact/gui/static/assets/OverviewPage-D9_rWqoS.js +1 -0
  42. nipact-0.0.1a1/src/nipact/gui/static/assets/PathValue-DSQSuYC6.js +1 -0
  43. nipact-0.0.1a1/src/nipact/gui/static/assets/WorkflowsPage-DFWdUE1P.js +1 -0
  44. nipact-0.0.1a1/src/nipact/gui/static/assets/graph-layout-CpJM1p_x.js +1 -0
  45. nipact-0.0.1a1/src/nipact/gui/static/assets/graph-renderer-CxxVBMBR.js +322 -0
  46. nipact-0.0.1a1/src/nipact/gui/static/assets/index-BOTDQ-sh.js +12 -0
  47. nipact-0.0.1a1/src/nipact/gui/static/assets/index-Dw9U6Qx1.css +1 -0
  48. nipact-0.0.1a1/src/nipact/gui/static/assets/queryKeys-DOSXcu0s.js +1 -0
  49. nipact-0.0.1a1/src/nipact/gui/static/index.html +14 -0
  50. nipact-0.0.1a1/src/nipact/hashing.py +44 -0
  51. nipact-0.0.1a1/src/nipact/identity.py +48 -0
  52. nipact-0.0.1a1/src/nipact/manifest.py +118 -0
  53. nipact-0.0.1a1/src/nipact/project_context.py +80 -0
  54. nipact-0.0.1a1/src/nipact/project_setup.py +663 -0
  55. nipact-0.0.1a1/src/nipact/registry.py +2736 -0
  56. nipact-0.0.1a1/src/nipact/runtime.py +247 -0
  57. nipact-0.0.1a1/src/nipact/trace.py +447 -0
  58. nipact-0.0.1a1/src/nipact/workflow.py +1600 -0
  59. nipact-0.0.1a1/src/nipact.egg-info/PKG-INFO +169 -0
  60. nipact-0.0.1a1/src/nipact.egg-info/SOURCES.txt +72 -0
  61. nipact-0.0.1a1/src/nipact.egg-info/dependency_links.txt +1 -0
  62. nipact-0.0.1a1/src/nipact.egg-info/entry_points.txt +2 -0
  63. nipact-0.0.1a1/src/nipact.egg-info/requires.txt +7 -0
  64. nipact-0.0.1a1/src/nipact.egg-info/top_level.txt +1 -0
  65. nipact-0.0.1a1/tests/test_cli.py +405 -0
  66. nipact-0.0.1a1/tests/test_context_index.py +92 -0
  67. nipact-0.0.1a1/tests/test_execution.py +1062 -0
  68. nipact-0.0.1a1/tests/test_execution_cache.py +1199 -0
  69. nipact-0.0.1a1/tests/test_manifest_contract.py +83 -0
  70. nipact-0.0.1a1/tests/test_project_setup.py +762 -0
  71. nipact-0.0.1a1/tests/test_registry_reads.py +398 -0
  72. nipact-0.0.1a1/tests/test_trace.py +431 -0
  73. nipact-0.0.1a1/tests/test_trace_cli.py +361 -0
  74. nipact-0.0.1a1/tests/test_workflow.py +429 -0
nipact-0.0.1a1/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 liuforest
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,169 @@
1
+ Metadata-Version: 2.4
2
+ Name: nipact
3
+ Version: 0.0.1a1
4
+ Summary: Lightweight Snakemake wrapper and orchestrator for NIPACT workflows.
5
+ Author-email: liuforest <lshangming@gmail.com>
6
+ License-Expression: MIT
7
+ Project-URL: Homepage, https://liuforest.github.io/nipact-docs/
8
+ Project-URL: Documentation, https://liuforest.github.io/nipact-docs/
9
+ Project-URL: Source, https://github.com/liuforest/nipact
10
+ Project-URL: Issues, https://github.com/liuforest/nipact/issues
11
+ Keywords: snakemake,workflow,orchestration,provenance,neuroimaging
12
+ Classifier: Development Status :: 3 - Alpha
13
+ Classifier: Intended Audience :: Science/Research
14
+ Classifier: Operating System :: OS Independent
15
+ Classifier: Programming Language :: Python :: 3
16
+ Classifier: Programming Language :: Python :: 3.12
17
+ Classifier: Topic :: Scientific/Engineering
18
+ Requires-Python: >=3.12
19
+ Description-Content-Type: text/markdown
20
+ License-File: LICENSE
21
+ Requires-Dist: fastapi>=0.115
22
+ Requires-Dist: numpy>=1.26
23
+ Requires-Dist: pydantic>=2.7
24
+ Requires-Dist: PyYAML>=6.0
25
+ Requires-Dist: rich>=13.7
26
+ Requires-Dist: snakemake<10,>=9
27
+ Requires-Dist: uvicorn>=0.30
28
+ Dynamic: license-file
29
+
30
+ # NIPACT
31
+
32
+ NIPACT is a Python package and CLI tool for orchestrating, executing, and auditing scientific workflows. Currently it is built around Snakemake and uses a SQLite registry for tracking steps and artifacts.
33
+
34
+ Public documentation lives in a separate repository, `nipact-docs`. See: https://liuforest.github.io/nipact-docs/.
35
+
36
+ Contents:
37
+ - a `nipact` Python package under `src/`
38
+ - deterministic packaged demo generators used by the tests
39
+
40
+ Features:
41
+ - Workflow inspection commands (`workflow list`, `workflow steps`, `workflow plan`, `workflow graph`)
42
+ - Workflow execution via Snakemake (`workflow run`)
43
+ - Runtime artifact provenance auditing in a SQLite registry (`trace`)
44
+ - Project-specific GUI viewer for browsing workflow runs, artifacts, and provenance (`gui`)
45
+ - Fully runnable colors demo with synthetic data and no external dependencies
46
+
47
+ Work in Progress:
48
+ - fMRI and dFC demos
49
+
50
+
51
+ ## Installation
52
+
53
+ Initial pre-release is `0.0.1a1`. Install it from PyPI in a clean
54
+ environment:
55
+
56
+ ```bash
57
+ python -m pip install nipact==0.0.1a1
58
+ nipact --version
59
+ ```
60
+
61
+ For development from this repo:
62
+
63
+ ```bash
64
+ python -m pip install -e . pytest
65
+ ```
66
+
67
+ ## Local Setup
68
+
69
+ Install the package and test runner from the repo root:
70
+
71
+ ```bash
72
+ python -m pip install -e . pytest
73
+ ```
74
+
75
+ Run the Python tests:
76
+
77
+ ```bash
78
+ python -m pytest
79
+ ```
80
+
81
+
82
+ ## Colors Demo via CLI
83
+
84
+ See more details in the documentation at https://liuforest.github.io/nipact-docs/
85
+
86
+ The current release supports three packaged demos:
87
+
88
+ ```bash
89
+ nipact init \
90
+ --demo colors \
91
+ --project-dir demos/colors/project \
92
+ --runtime-dir demos/colors/runtime
93
+
94
+ nipact validate --context colors
95
+ ```
96
+
97
+ ```bash
98
+ nipact init \
99
+ --demo fmri \
100
+ --project-dir demos/fmri/project \
101
+ --runtime-dir demos/fmri/runtime
102
+
103
+ nipact validate --context fmri
104
+ ```
105
+
106
+ ```bash
107
+ nipact init \
108
+ --demo dfc \
109
+ --project-dir demos/dfc/project \
110
+ --runtime-dir demos/dfc/runtime
111
+
112
+ nipact validate --context dfc
113
+ ```
114
+
115
+ NOTES:
116
+ `--project-dir` and `--runtime-dir` must be empty and must not contain each other.
117
+
118
+ `init` creates a generated demo project plus mutable runtime files. The project contains `nipact.yaml`, `sources.yaml`, manifests, step YAML, and workflow YAML.
119
+
120
+ The runtime contains demo source files under `data/` and `database/registry.db`. It also writes `nipact.contexts.yaml` in the current workspace so later commands can resolve `--context <demo>` to the generated project root. The context index is workspace-local state; this repository ignores the root file so source-checkout testing does not add tutorial state to version control. `validate` is read-only.
121
+
122
+ Workflow inspection and execution:
123
+
124
+ ```bash
125
+ nipact workflow list \
126
+ --context colors
127
+
128
+ nipact workflow steps \
129
+ --context colors \
130
+ --workflow base
131
+
132
+ nipact workflow plan \
133
+ --context colors \
134
+ --workflow base \
135
+ --step color_sector_analysis
136
+
137
+ nipact workflow graph \
138
+ --context colors \
139
+ --workflow base \
140
+ --step color_sector_analysis
141
+
142
+ nipact workflow run \
143
+ --context colors \
144
+ --workflow base \
145
+ --step color_sector_analysis \
146
+ --dry-run
147
+
148
+ nipact workflow run \
149
+ --context colors \
150
+ --workflow base \
151
+ --step color_sector_analysis \
152
+ --cores 1
153
+
154
+ nipact trace \
155
+ --context colors \
156
+ --workflow base \
157
+ --step color_sector_analysis \
158
+ --output sector_counts \
159
+ --address init
160
+
161
+ nipact gui \
162
+ --context colors \
163
+ --port 8765
164
+ ```
165
+
166
+ `trace` and `gui` read `runtime/database/registry.db`. The GUI binds to `127.0.0.1` and serves a local browser view for current workflows, manifests, artifacts, workflow topology, and focused artifact lineage.
167
+
168
+ The gui is for viewing only, not to execute workflows, registry rows, etc.
169
+
@@ -0,0 +1,140 @@
1
+ # NIPACT
2
+
3
+ NIPACT is a Python package and CLI tool for orchestrating, executing, and auditing scientific workflows. Currently it is built around Snakemake and uses a SQLite registry for tracking steps and artifacts.
4
+
5
+ Public documentation lives in a separate repository, `nipact-docs`. See: https://liuforest.github.io/nipact-docs/.
6
+
7
+ Contents:
8
+ - a `nipact` Python package under `src/`
9
+ - deterministic packaged demo generators used by the tests
10
+
11
+ Features:
12
+ - Workflow inspection commands (`workflow list`, `workflow steps`, `workflow plan`, `workflow graph`)
13
+ - Workflow execution via Snakemake (`workflow run`)
14
+ - Runtime artifact provenance auditing in a SQLite registry (`trace`)
15
+ - Project-specific GUI viewer for browsing workflow runs, artifacts, and provenance (`gui`)
16
+ - Fully runnable colors demo with synthetic data and no external dependencies
17
+
18
+ Work in Progress:
19
+ - fMRI and dFC demos
20
+
21
+
22
+ ## Installation
23
+
24
+ Initial pre-release is `0.0.1a1`. Install it from PyPI in a clean
25
+ environment:
26
+
27
+ ```bash
28
+ python -m pip install nipact==0.0.1a1
29
+ nipact --version
30
+ ```
31
+
32
+ For development from this repo:
33
+
34
+ ```bash
35
+ python -m pip install -e . pytest
36
+ ```
37
+
38
+ ## Local Setup
39
+
40
+ Install the package and test runner from the repo root:
41
+
42
+ ```bash
43
+ python -m pip install -e . pytest
44
+ ```
45
+
46
+ Run the Python tests:
47
+
48
+ ```bash
49
+ python -m pytest
50
+ ```
51
+
52
+
53
+ ## Colors Demo via CLI
54
+
55
+ See more details in the documentation at https://liuforest.github.io/nipact-docs/
56
+
57
+ The current release supports three packaged demos:
58
+
59
+ ```bash
60
+ nipact init \
61
+ --demo colors \
62
+ --project-dir demos/colors/project \
63
+ --runtime-dir demos/colors/runtime
64
+
65
+ nipact validate --context colors
66
+ ```
67
+
68
+ ```bash
69
+ nipact init \
70
+ --demo fmri \
71
+ --project-dir demos/fmri/project \
72
+ --runtime-dir demos/fmri/runtime
73
+
74
+ nipact validate --context fmri
75
+ ```
76
+
77
+ ```bash
78
+ nipact init \
79
+ --demo dfc \
80
+ --project-dir demos/dfc/project \
81
+ --runtime-dir demos/dfc/runtime
82
+
83
+ nipact validate --context dfc
84
+ ```
85
+
86
+ NOTES:
87
+ `--project-dir` and `--runtime-dir` must be empty and must not contain each other.
88
+
89
+ `init` creates a generated demo project plus mutable runtime files. The project contains `nipact.yaml`, `sources.yaml`, manifests, step YAML, and workflow YAML.
90
+
91
+ The runtime contains demo source files under `data/` and `database/registry.db`. It also writes `nipact.contexts.yaml` in the current workspace so later commands can resolve `--context <demo>` to the generated project root. The context index is workspace-local state; this repository ignores the root file so source-checkout testing does not add tutorial state to version control. `validate` is read-only.
92
+
93
+ Workflow inspection and execution:
94
+
95
+ ```bash
96
+ nipact workflow list \
97
+ --context colors
98
+
99
+ nipact workflow steps \
100
+ --context colors \
101
+ --workflow base
102
+
103
+ nipact workflow plan \
104
+ --context colors \
105
+ --workflow base \
106
+ --step color_sector_analysis
107
+
108
+ nipact workflow graph \
109
+ --context colors \
110
+ --workflow base \
111
+ --step color_sector_analysis
112
+
113
+ nipact workflow run \
114
+ --context colors \
115
+ --workflow base \
116
+ --step color_sector_analysis \
117
+ --dry-run
118
+
119
+ nipact workflow run \
120
+ --context colors \
121
+ --workflow base \
122
+ --step color_sector_analysis \
123
+ --cores 1
124
+
125
+ nipact trace \
126
+ --context colors \
127
+ --workflow base \
128
+ --step color_sector_analysis \
129
+ --output sector_counts \
130
+ --address init
131
+
132
+ nipact gui \
133
+ --context colors \
134
+ --port 8765
135
+ ```
136
+
137
+ `trace` and `gui` read `runtime/database/registry.db`. The GUI binds to `127.0.0.1` and serves a local browser view for current workflows, manifests, artifacts, workflow topology, and focused artifact lineage.
138
+
139
+ The gui is for viewing only, not to execute workflows, registry rows, etc.
140
+
@@ -0,0 +1,61 @@
1
+ [build-system]
2
+ requires = ["setuptools>=77"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "nipact"
7
+ dynamic = ["version"]
8
+ description = "Lightweight Snakemake wrapper and orchestrator for NIPACT workflows."
9
+ readme = "README.md"
10
+ requires-python = ">=3.12"
11
+ license = "MIT"
12
+ license-files = ["LICENSE"]
13
+ authors = [
14
+ {name = "liuforest", email = "lshangming@gmail.com"},
15
+ ]
16
+ keywords = [
17
+ "snakemake",
18
+ "workflow",
19
+ "orchestration",
20
+ "provenance",
21
+ "neuroimaging",
22
+ ]
23
+ classifiers = [
24
+ "Development Status :: 3 - Alpha",
25
+ "Intended Audience :: Science/Research",
26
+ "Operating System :: OS Independent",
27
+ "Programming Language :: Python :: 3",
28
+ "Programming Language :: Python :: 3.12",
29
+ "Topic :: Scientific/Engineering",
30
+ ]
31
+ dependencies = [
32
+ "fastapi>=0.115",
33
+ "numpy>=1.26",
34
+ "pydantic>=2.7",
35
+ "PyYAML>=6.0",
36
+ "rich>=13.7",
37
+ "snakemake>=9,<10",
38
+ "uvicorn>=0.30",
39
+ ]
40
+
41
+ [project.urls]
42
+ Homepage = "https://liuforest.github.io/nipact-docs/"
43
+ Documentation = "https://liuforest.github.io/nipact-docs/"
44
+ Source = "https://github.com/liuforest/nipact"
45
+ Issues = "https://github.com/liuforest/nipact/issues"
46
+
47
+ [project.scripts]
48
+ nipact = "nipact.cli:main"
49
+
50
+ [tool.setuptools.packages.find]
51
+ where = ["src"]
52
+
53
+ [tool.setuptools.package-data]
54
+ "nipact.gui" = ["static/index.html", "static/assets/*"]
55
+
56
+ [tool.setuptools.dynamic]
57
+ version = {attr = "nipact._version.__version__"}
58
+
59
+ [tool.pytest.ini_options]
60
+ pythonpath = ["src"]
61
+ testpaths = ["tests"]
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1,5 @@
1
+ """NIPACT package."""
2
+
3
+ from ._version import __version__
4
+
5
+ __all__ = ["__version__"]
@@ -0,0 +1,3 @@
1
+ """Package version."""
2
+
3
+ __version__ = "0.0.1a1"
@@ -0,0 +1,44 @@
1
+ """Small helpers for published artifact filenames."""
2
+
3
+ from __future__ import annotations
4
+
5
+ from .errors import ValidationError
6
+ from .identity import validate_hash_alias, validate_path_token
7
+
8
+
9
+ def output_filename(*, address: str, output_hash: str, declared_extension: str) -> str:
10
+ """Return the final hash-named output filename."""
11
+ address = validate_path_token(address, label="output address")
12
+ output_hash = validate_hash_alias(output_hash)
13
+ _validate_declared_extension(declared_extension)
14
+ return f"{address}.{output_hash}{declared_extension}"
15
+
16
+
17
+ def parse_output_filename(
18
+ filename: str,
19
+ *,
20
+ declared_extension: str,
21
+ ) -> tuple[str, str]:
22
+ """Parse a final output filename using the declared extension, not Path.suffix."""
23
+ if not isinstance(filename, str) or not filename:
24
+ raise ValidationError("output filename must be a non-empty string")
25
+ _validate_declared_extension(declared_extension)
26
+ if not filename.endswith(declared_extension):
27
+ raise ValidationError("output filename does not end with declared extension")
28
+ stem = filename[: -len(declared_extension)]
29
+ try:
30
+ address, output_hash = stem.rsplit(".", maxsplit=1)
31
+ except ValueError as exc:
32
+ raise ValidationError("output filename must include output_hash") from exc
33
+ return (
34
+ validate_path_token(address, label="output address"),
35
+ validate_hash_alias(output_hash),
36
+ )
37
+
38
+
39
+ def _validate_declared_extension(value: object) -> str:
40
+ if not isinstance(value, str) or not value.startswith("."):
41
+ raise ValidationError("declared extension must start with '.'")
42
+ if "/" in value or "\\" in value or value in {".", ".."}:
43
+ raise ValidationError("declared extension must be a file extension")
44
+ return value