spatho 0.1.0__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.
spatho-0.1.0/LICENSE ADDED
@@ -0,0 +1,10 @@
1
+ PolyForm Noncommercial License 1.0.0
2
+
3
+ Copyright (c) Taobo Hu
4
+
5
+ This project is made available for noncommercial use under the PolyForm Noncommercial 1.0.0 license.
6
+
7
+ License text:
8
+ https://polyformproject.org/licenses/noncommercial/1.0.0/
9
+
10
+ Commercial use requires a separate commercial license from the project owner.
spatho-0.1.0/PKG-INFO ADDED
@@ -0,0 +1,257 @@
1
+ Metadata-Version: 2.4
2
+ Name: spatho
3
+ Version: 0.1.0
4
+ Summary: Public-facing AI-driven spatial pathologist wrapper package for Xenium workflows.
5
+ Author-email: Taobo Hu <taobo.hu@scilifelab.se>
6
+ License-Expression: LicenseRef-PolyForm-Noncommercial-1.0.0
7
+ Project-URL: Homepage, https://github.com/hutaobo/AI-Driven-Spatial-Pathologist
8
+ Project-URL: Documentation, https://github.com/hutaobo/AI-Driven-Spatial-Pathologist
9
+ Project-URL: Repository, https://github.com/hutaobo/AI-Driven-Spatial-Pathologist
10
+ Project-URL: Issues, https://github.com/hutaobo/AI-Driven-Spatial-Pathologist/issues
11
+ Keywords: spatial-transcriptomics,xenium,pathology,bioinformatics,ai
12
+ Classifier: Development Status :: 3 - Alpha
13
+ Classifier: Intended Audience :: Science/Research
14
+ Classifier: Programming Language :: Python :: 3
15
+ Classifier: Programming Language :: Python :: 3 :: Only
16
+ Classifier: Programming Language :: Python :: 3.10
17
+ Classifier: Programming Language :: Python :: 3.11
18
+ Classifier: Programming Language :: Python :: 3.12
19
+ Classifier: Topic :: Scientific/Engineering :: Bio-Informatics
20
+ Requires-Python: >=3.10
21
+ Description-Content-Type: text/markdown
22
+ License-File: LICENSE
23
+ Requires-Dist: histoseg>=0.1.9.1
24
+ Requires-Dist: gradio<6.0,>=5.24
25
+ Requires-Dist: pydantic<3,>=2
26
+ Provides-Extra: dev
27
+ Requires-Dist: build<2,>=1; extra == "dev"
28
+ Requires-Dist: pytest<9,>=8; extra == "dev"
29
+ Requires-Dist: twine<7,>=5; extra == "dev"
30
+ Dynamic: license-file
31
+
32
+ # SPatho
33
+
34
+ `spatho` is the public-facing product layer for an AI-driven spatial pathologist workflow built around Xenium-scale spatial transcriptomics.
35
+
36
+ It is designed to sit above the lower-level `histoseg` engine and expose a cleaner public experience:
37
+
38
+ - OpenAI-driven cluster annotation
39
+ - dendrogram-guided structure discovery
40
+ - H&E overlay generation
41
+ - structure-level pathology review
42
+ - HTML reporting for human-in-the-loop interpretation
43
+
44
+ This repo is where the public product experience should live.
45
+ The underlying geometry and segmentation engine still comes from `histoseg`.
46
+
47
+ ## Current Status
48
+
49
+ This is the first public product-layer scaffold.
50
+
51
+ Today it provides:
52
+
53
+ - a package name: `spatho`
54
+ - a user-facing CLI
55
+ - a starter-workflow generator
56
+ - built-in `lung` and `breast` organ packs
57
+ - a formal workflow config schema
58
+ - automatic artifact manifest generation
59
+ - a wrapper API that runs the existing `histoseg` full-auto workflow
60
+ - a roadmap for gradually migrating product logic out of `histoseg`
61
+
62
+ ## Why a Separate Repo?
63
+
64
+ `histoseg` started as a segmentation and contour-generation toolkit.
65
+
66
+ The full pathology workflow now has a different audience and a different contract:
67
+
68
+ - users care about complete case analysis, not just contour extraction
69
+ - users want reports, review priorities, and organ-specific workflows
70
+ - public documentation should focus on pathology workflows, not internal engine history
71
+
72
+ This repo creates that separation.
73
+
74
+ ## Quick Start
75
+
76
+ ### Install for local development
77
+
78
+ ```bash
79
+ git clone https://github.com/hutaobo/AI-Driven-Spatial-Pathologist.git
80
+ cd AI-Driven-Spatial-Pathologist
81
+ pip install -U pip
82
+ pip install -e .
83
+ ```
84
+
85
+ If you are actively developing against a local `histoseg` checkout, also install that editable copy first:
86
+
87
+ ```bash
88
+ pip install -e ../HistoSeg
89
+ ```
90
+
91
+ ### Check your environment
92
+
93
+ ```bash
94
+ spatho doctor --config /path/to/workflow.json
95
+ ```
96
+
97
+ ### List built-in organ packs
98
+
99
+ ```bash
100
+ spatho list-organ-packs
101
+ ```
102
+
103
+ ### Generate a starter workflow
104
+
105
+ ```bash
106
+ spatho init-workflow \
107
+ --organ breast \
108
+ --case-name breast_case_01 \
109
+ --dataset-root /path/to/Xenium_outs \
110
+ --base-pipeline-config /path/to/project/configs/breast_case_01.json \
111
+ --output /path/to/workflows/breast_case_01_full_auto_openai.json
112
+ ```
113
+
114
+ ### Run a full workflow
115
+
116
+ ```bash
117
+ spatho run --config /path/to/workflow.json
118
+ ```
119
+
120
+ Disable OpenAI and force heuristic mode:
121
+
122
+ ```bash
123
+ spatho run --config /path/to/workflow.json --heuristic-only
124
+ ```
125
+
126
+ ### Export the workflow JSON schema
127
+
128
+ ```bash
129
+ spatho config-schema --output /path/to/workflow.schema.json
130
+ ```
131
+
132
+ ### Build or refresh an artifact manifest
133
+
134
+ ```bash
135
+ spatho build-manifest --config /path/to/workflow.json
136
+ ```
137
+
138
+ ## Python Usage
139
+
140
+ ```python
141
+ from spatho import run_workflow
142
+
143
+ result = run_workflow(r"D:\GitHub\HistoSeg\workflows\breast_s1_top_graphclust_full_auto_openai.json")
144
+ print(result["pathology_report_html"])
145
+ ```
146
+
147
+ You can also generate the starter config from Python:
148
+
149
+ ```python
150
+ from spatho import init_workflow
151
+
152
+ result = init_workflow(
153
+ r"D:\GitHub\HistoSeg\workflows\breast_case_01_full_auto_openai.json",
154
+ organ="breast",
155
+ case_name="breast_case_01",
156
+ dataset_root=r"Y:\long\10X_datasets\Xenium\Xenium_Breast_Cancer\Human_Breast_Biomarkers_S1_Top_outs",
157
+ base_pipeline_config=r"D:\GitHub\sfplot\segmentation_methods\projects\breast_s1_top_graphclust\configs\breast_s1_top_graphclust.json",
158
+ )
159
+ print(result["workflow_config"])
160
+ ```
161
+
162
+ ## What a Workflow Produces
163
+
164
+ A typical full run produces:
165
+
166
+ - cluster evidence bundles
167
+ - OpenAI or heuristic cluster annotations
168
+ - structure assignments
169
+ - clustermap and overlay artifacts
170
+ - structure-level pathology reviews
171
+ - case-level HTML report
172
+ - a machine-readable artifact manifest
173
+
174
+ ## Organ Packs
175
+
176
+ `spatho` now ships with built-in organ packs that define:
177
+
178
+ - the annotation taxonomy
179
+ - default study context
180
+ - workflow parameter defaults
181
+ - the expected artifact contract for completed runs
182
+
183
+ The first built-in packs are:
184
+
185
+ - `lung`
186
+ - `breast`
187
+
188
+ These packs live in [src/spatho/organ_packs](src/spatho/organ_packs).
189
+
190
+ ## Config Contract
191
+
192
+ Workflow JSON files are now backed by a formal schema exported from the package.
193
+ This is the first step toward stable public contracts and backward-compatible workflow upgrades.
194
+
195
+ ## Repository Layout
196
+
197
+ - `src/spatho`
198
+ Public-facing Python package and CLI
199
+
200
+ - `src/spatho/organ_packs`
201
+ Built-in public organ packs
202
+
203
+ - `docs/SPATHO_ROADMAP.md`
204
+ Productization and migration plan
205
+
206
+ - `docs/COMMERCIALIZATION_PLAN.md`
207
+ Academic/community vs commercial edition strategy
208
+
209
+ - `docs/PYPI_RELEASE.md`
210
+ Official PyPI publishing checklist for this package
211
+
212
+ - `examples/workflows`
213
+ Public-safe starter workflow templates for `lung` and `breast`
214
+
215
+ - `main.py`
216
+ Existing Gradio/Serve deployment surface kept for backward compatibility
217
+
218
+ ## Relationship to HistoSeg
219
+
220
+ Current implementation model:
221
+
222
+ - `histoseg` executes the workflow
223
+ - `spatho` wraps and presents it as a product
224
+
225
+ Target implementation model:
226
+
227
+ - `histoseg` becomes the geometry/segmentation engine
228
+ - `spatho` owns workflow UX, organ packs, public docs, reports, and deployment surfaces
229
+
230
+ ## Public Release Plan
231
+
232
+ The next milestones are:
233
+
234
+ 1. expand organ packs beyond `lung` and `breast`
235
+ 2. add richer tests and CI for CLI + workflow smoke checks
236
+ 3. stabilize config schema and artifact manifest versions
237
+ 4. migrate public-safe workflow logic from `histoseg` into `spatho`
238
+ 5. add example reports and example datasets
239
+
240
+ See [docs/SPATHO_ROADMAP.md](docs/SPATHO_ROADMAP.md) and [docs/COMMERCIALIZATION_PLAN.md](docs/COMMERCIALIZATION_PLAN.md).
241
+
242
+ ## Publishing
243
+
244
+ This repo now includes a PyPI publishing workflow based on GitHub Actions Trusted Publishing.
245
+ See [docs/PYPI_RELEASE.md](docs/PYPI_RELEASE.md) for the exact setup and release steps.
246
+
247
+ ## Existing Serve App
248
+
249
+ This repo also contains an older Gradio deployment layer in [main.py](main.py).
250
+
251
+ That app should now be treated as one deployment surface, not the core product definition.
252
+ The package and CLI in `src/spatho` are the preferred direction for public-tool development.
253
+
254
+ ## License
255
+
256
+ This project is intended for noncommercial research use unless separately licensed.
257
+ Before public release, the license text and commercial boundary should be reviewed together with the underlying `histoseg` dependency.
spatho-0.1.0/README.md ADDED
@@ -0,0 +1,226 @@
1
+ # SPatho
2
+
3
+ `spatho` is the public-facing product layer for an AI-driven spatial pathologist workflow built around Xenium-scale spatial transcriptomics.
4
+
5
+ It is designed to sit above the lower-level `histoseg` engine and expose a cleaner public experience:
6
+
7
+ - OpenAI-driven cluster annotation
8
+ - dendrogram-guided structure discovery
9
+ - H&E overlay generation
10
+ - structure-level pathology review
11
+ - HTML reporting for human-in-the-loop interpretation
12
+
13
+ This repo is where the public product experience should live.
14
+ The underlying geometry and segmentation engine still comes from `histoseg`.
15
+
16
+ ## Current Status
17
+
18
+ This is the first public product-layer scaffold.
19
+
20
+ Today it provides:
21
+
22
+ - a package name: `spatho`
23
+ - a user-facing CLI
24
+ - a starter-workflow generator
25
+ - built-in `lung` and `breast` organ packs
26
+ - a formal workflow config schema
27
+ - automatic artifact manifest generation
28
+ - a wrapper API that runs the existing `histoseg` full-auto workflow
29
+ - a roadmap for gradually migrating product logic out of `histoseg`
30
+
31
+ ## Why a Separate Repo?
32
+
33
+ `histoseg` started as a segmentation and contour-generation toolkit.
34
+
35
+ The full pathology workflow now has a different audience and a different contract:
36
+
37
+ - users care about complete case analysis, not just contour extraction
38
+ - users want reports, review priorities, and organ-specific workflows
39
+ - public documentation should focus on pathology workflows, not internal engine history
40
+
41
+ This repo creates that separation.
42
+
43
+ ## Quick Start
44
+
45
+ ### Install for local development
46
+
47
+ ```bash
48
+ git clone https://github.com/hutaobo/AI-Driven-Spatial-Pathologist.git
49
+ cd AI-Driven-Spatial-Pathologist
50
+ pip install -U pip
51
+ pip install -e .
52
+ ```
53
+
54
+ If you are actively developing against a local `histoseg` checkout, also install that editable copy first:
55
+
56
+ ```bash
57
+ pip install -e ../HistoSeg
58
+ ```
59
+
60
+ ### Check your environment
61
+
62
+ ```bash
63
+ spatho doctor --config /path/to/workflow.json
64
+ ```
65
+
66
+ ### List built-in organ packs
67
+
68
+ ```bash
69
+ spatho list-organ-packs
70
+ ```
71
+
72
+ ### Generate a starter workflow
73
+
74
+ ```bash
75
+ spatho init-workflow \
76
+ --organ breast \
77
+ --case-name breast_case_01 \
78
+ --dataset-root /path/to/Xenium_outs \
79
+ --base-pipeline-config /path/to/project/configs/breast_case_01.json \
80
+ --output /path/to/workflows/breast_case_01_full_auto_openai.json
81
+ ```
82
+
83
+ ### Run a full workflow
84
+
85
+ ```bash
86
+ spatho run --config /path/to/workflow.json
87
+ ```
88
+
89
+ Disable OpenAI and force heuristic mode:
90
+
91
+ ```bash
92
+ spatho run --config /path/to/workflow.json --heuristic-only
93
+ ```
94
+
95
+ ### Export the workflow JSON schema
96
+
97
+ ```bash
98
+ spatho config-schema --output /path/to/workflow.schema.json
99
+ ```
100
+
101
+ ### Build or refresh an artifact manifest
102
+
103
+ ```bash
104
+ spatho build-manifest --config /path/to/workflow.json
105
+ ```
106
+
107
+ ## Python Usage
108
+
109
+ ```python
110
+ from spatho import run_workflow
111
+
112
+ result = run_workflow(r"D:\GitHub\HistoSeg\workflows\breast_s1_top_graphclust_full_auto_openai.json")
113
+ print(result["pathology_report_html"])
114
+ ```
115
+
116
+ You can also generate the starter config from Python:
117
+
118
+ ```python
119
+ from spatho import init_workflow
120
+
121
+ result = init_workflow(
122
+ r"D:\GitHub\HistoSeg\workflows\breast_case_01_full_auto_openai.json",
123
+ organ="breast",
124
+ case_name="breast_case_01",
125
+ dataset_root=r"Y:\long\10X_datasets\Xenium\Xenium_Breast_Cancer\Human_Breast_Biomarkers_S1_Top_outs",
126
+ base_pipeline_config=r"D:\GitHub\sfplot\segmentation_methods\projects\breast_s1_top_graphclust\configs\breast_s1_top_graphclust.json",
127
+ )
128
+ print(result["workflow_config"])
129
+ ```
130
+
131
+ ## What a Workflow Produces
132
+
133
+ A typical full run produces:
134
+
135
+ - cluster evidence bundles
136
+ - OpenAI or heuristic cluster annotations
137
+ - structure assignments
138
+ - clustermap and overlay artifacts
139
+ - structure-level pathology reviews
140
+ - case-level HTML report
141
+ - a machine-readable artifact manifest
142
+
143
+ ## Organ Packs
144
+
145
+ `spatho` now ships with built-in organ packs that define:
146
+
147
+ - the annotation taxonomy
148
+ - default study context
149
+ - workflow parameter defaults
150
+ - the expected artifact contract for completed runs
151
+
152
+ The first built-in packs are:
153
+
154
+ - `lung`
155
+ - `breast`
156
+
157
+ These packs live in [src/spatho/organ_packs](src/spatho/organ_packs).
158
+
159
+ ## Config Contract
160
+
161
+ Workflow JSON files are now backed by a formal schema exported from the package.
162
+ This is the first step toward stable public contracts and backward-compatible workflow upgrades.
163
+
164
+ ## Repository Layout
165
+
166
+ - `src/spatho`
167
+ Public-facing Python package and CLI
168
+
169
+ - `src/spatho/organ_packs`
170
+ Built-in public organ packs
171
+
172
+ - `docs/SPATHO_ROADMAP.md`
173
+ Productization and migration plan
174
+
175
+ - `docs/COMMERCIALIZATION_PLAN.md`
176
+ Academic/community vs commercial edition strategy
177
+
178
+ - `docs/PYPI_RELEASE.md`
179
+ Official PyPI publishing checklist for this package
180
+
181
+ - `examples/workflows`
182
+ Public-safe starter workflow templates for `lung` and `breast`
183
+
184
+ - `main.py`
185
+ Existing Gradio/Serve deployment surface kept for backward compatibility
186
+
187
+ ## Relationship to HistoSeg
188
+
189
+ Current implementation model:
190
+
191
+ - `histoseg` executes the workflow
192
+ - `spatho` wraps and presents it as a product
193
+
194
+ Target implementation model:
195
+
196
+ - `histoseg` becomes the geometry/segmentation engine
197
+ - `spatho` owns workflow UX, organ packs, public docs, reports, and deployment surfaces
198
+
199
+ ## Public Release Plan
200
+
201
+ The next milestones are:
202
+
203
+ 1. expand organ packs beyond `lung` and `breast`
204
+ 2. add richer tests and CI for CLI + workflow smoke checks
205
+ 3. stabilize config schema and artifact manifest versions
206
+ 4. migrate public-safe workflow logic from `histoseg` into `spatho`
207
+ 5. add example reports and example datasets
208
+
209
+ See [docs/SPATHO_ROADMAP.md](docs/SPATHO_ROADMAP.md) and [docs/COMMERCIALIZATION_PLAN.md](docs/COMMERCIALIZATION_PLAN.md).
210
+
211
+ ## Publishing
212
+
213
+ This repo now includes a PyPI publishing workflow based on GitHub Actions Trusted Publishing.
214
+ See [docs/PYPI_RELEASE.md](docs/PYPI_RELEASE.md) for the exact setup and release steps.
215
+
216
+ ## Existing Serve App
217
+
218
+ This repo also contains an older Gradio deployment layer in [main.py](main.py).
219
+
220
+ That app should now be treated as one deployment surface, not the core product definition.
221
+ The package and CLI in `src/spatho` are the preferred direction for public-tool development.
222
+
223
+ ## License
224
+
225
+ This project is intended for noncommercial research use unless separately licensed.
226
+ Before public release, the license text and commercial boundary should be reviewed together with the underlying `histoseg` dependency.
@@ -0,0 +1,60 @@
1
+ [build-system]
2
+ requires = ["setuptools>=68", "wheel"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "spatho"
7
+ dynamic = ["version"]
8
+ description = "Public-facing AI-driven spatial pathologist wrapper package for Xenium workflows."
9
+ readme = "README.md"
10
+ requires-python = ">=3.10"
11
+ license = "LicenseRef-PolyForm-Noncommercial-1.0.0"
12
+ license-files = ["LICENSE"]
13
+ authors = [{ name = "Taobo Hu", email = "taobo.hu@scilifelab.se" }]
14
+ keywords = ["spatial-transcriptomics", "xenium", "pathology", "bioinformatics", "ai"]
15
+ classifiers = [
16
+ "Development Status :: 3 - Alpha",
17
+ "Intended Audience :: Science/Research",
18
+ "Programming Language :: Python :: 3",
19
+ "Programming Language :: Python :: 3 :: Only",
20
+ "Programming Language :: Python :: 3.10",
21
+ "Programming Language :: Python :: 3.11",
22
+ "Programming Language :: Python :: 3.12",
23
+ "Topic :: Scientific/Engineering :: Bio-Informatics",
24
+ ]
25
+ dependencies = [
26
+ "histoseg>=0.1.9.1",
27
+ "gradio>=5.24,<6.0",
28
+ "pydantic>=2,<3",
29
+ ]
30
+
31
+ [project.optional-dependencies]
32
+ dev = [
33
+ "build>=1,<2",
34
+ "pytest>=8,<9",
35
+ "twine>=5,<7",
36
+ ]
37
+
38
+ [project.urls]
39
+ Homepage = "https://github.com/hutaobo/AI-Driven-Spatial-Pathologist"
40
+ Documentation = "https://github.com/hutaobo/AI-Driven-Spatial-Pathologist"
41
+ Repository = "https://github.com/hutaobo/AI-Driven-Spatial-Pathologist"
42
+ Issues = "https://github.com/hutaobo/AI-Driven-Spatial-Pathologist/issues"
43
+
44
+ [project.scripts]
45
+ spatho = "spatho.cli:main"
46
+
47
+ [tool.setuptools]
48
+ package-dir = {"" = "src"}
49
+
50
+ [tool.setuptools.packages.find]
51
+ where = ["src"]
52
+
53
+ [tool.setuptools.package-data]
54
+ "spatho.organ_packs" = ["data/*.json"]
55
+
56
+ [tool.setuptools.dynamic]
57
+ version = {attr = "spatho.__version__"}
58
+
59
+ [tool.pytest.ini_options]
60
+ testpaths = ["tests"]
spatho-0.1.0/setup.cfg ADDED
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1,14 @@
1
+ from __future__ import annotations
2
+
3
+ from .api import build_manifest, init_workflow, list_available_organ_packs, run_workflow, workflow_doctor_report, write_schema
4
+
5
+ __all__ = [
6
+ "build_manifest",
7
+ "run_workflow",
8
+ "workflow_doctor_report",
9
+ "init_workflow",
10
+ "list_available_organ_packs",
11
+ "write_schema",
12
+ ]
13
+
14
+ __version__ = "0.1.0"