mivia 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.
- mivia-0.1.0/.gitignore +165 -0
- mivia-0.1.0/.prototools +2 -0
- mivia-0.1.0/.python-version +1 -0
- mivia-0.1.0/LICENSE +21 -0
- mivia-0.1.0/PKG-INFO +176 -0
- mivia-0.1.0/README.md +139 -0
- mivia-0.1.0/pyproject.toml +70 -0
- mivia-0.1.0/src/mivia/__init__.py +46 -0
- mivia-0.1.0/src/mivia/cli/__init__.py +1 -0
- mivia-0.1.0/src/mivia/cli/main.py +414 -0
- mivia-0.1.0/src/mivia/client.py +445 -0
- mivia-0.1.0/src/mivia/exceptions.py +45 -0
- mivia-0.1.0/src/mivia/models.py +180 -0
- mivia-0.1.0/src/mivia/py.typed +0 -0
- mivia-0.1.0/src/mivia/sync_client.py +305 -0
- mivia-0.1.0/uv.lock +488 -0
mivia-0.1.0/.gitignore
ADDED
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
# ---> Node
|
|
2
|
+
# Logs
|
|
3
|
+
logs
|
|
4
|
+
*.log
|
|
5
|
+
npm-debug.log*
|
|
6
|
+
yarn-debug.log*
|
|
7
|
+
yarn-error.log*
|
|
8
|
+
lerna-debug.log*
|
|
9
|
+
.pnpm-debug.log*
|
|
10
|
+
|
|
11
|
+
# Diagnostic reports (https://nodejs.org/api/report.html)
|
|
12
|
+
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
|
|
13
|
+
|
|
14
|
+
# Runtime data
|
|
15
|
+
pids
|
|
16
|
+
*.pid
|
|
17
|
+
*.seed
|
|
18
|
+
*.pid.lock
|
|
19
|
+
|
|
20
|
+
# Directory for instrumented libs generated by jscoverage/JSCover
|
|
21
|
+
lib-cov
|
|
22
|
+
|
|
23
|
+
# Coverage directory used by tools like istanbul
|
|
24
|
+
coverage
|
|
25
|
+
*.lcov
|
|
26
|
+
|
|
27
|
+
# nyc test coverage
|
|
28
|
+
.nyc_output
|
|
29
|
+
|
|
30
|
+
# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
|
|
31
|
+
.grunt
|
|
32
|
+
|
|
33
|
+
# Bower dependency directory (https://bower.io/)
|
|
34
|
+
bower_components
|
|
35
|
+
|
|
36
|
+
# node-waf configuration
|
|
37
|
+
.lock-wscript
|
|
38
|
+
|
|
39
|
+
# Compiled binary addons (https://nodejs.org/api/addons.html)
|
|
40
|
+
build/Release
|
|
41
|
+
|
|
42
|
+
# Dependency directories
|
|
43
|
+
node_modules/
|
|
44
|
+
jspm_packages/
|
|
45
|
+
|
|
46
|
+
# Snowpack dependency directory (https://snowpack.dev/)
|
|
47
|
+
web_modules/
|
|
48
|
+
|
|
49
|
+
# TypeScript cache
|
|
50
|
+
*.tsbuildinfo
|
|
51
|
+
|
|
52
|
+
# Optional npm cache directory
|
|
53
|
+
.npm
|
|
54
|
+
|
|
55
|
+
# Optional eslint cache
|
|
56
|
+
.eslintcache
|
|
57
|
+
|
|
58
|
+
# Microbundle cache
|
|
59
|
+
.rpt2_cache/
|
|
60
|
+
.rts2_cache_cjs/
|
|
61
|
+
.rts2_cache_es/
|
|
62
|
+
.rts2_cache_umd/
|
|
63
|
+
|
|
64
|
+
# Optional REPL history
|
|
65
|
+
.node_repl_history
|
|
66
|
+
|
|
67
|
+
# Output of 'npm pack'
|
|
68
|
+
*.tgz
|
|
69
|
+
|
|
70
|
+
# Yarn Integrity file
|
|
71
|
+
.yarn-integrity
|
|
72
|
+
|
|
73
|
+
# dotenv environment variables file
|
|
74
|
+
.env
|
|
75
|
+
.env.test
|
|
76
|
+
!e2e/.env
|
|
77
|
+
|
|
78
|
+
# parcel-bundler cache (https://parceljs.org/)
|
|
79
|
+
.cache
|
|
80
|
+
.parcel-cache
|
|
81
|
+
|
|
82
|
+
# Next.js build output
|
|
83
|
+
.next
|
|
84
|
+
out
|
|
85
|
+
|
|
86
|
+
# Nuxt.js build / generate output
|
|
87
|
+
.nuxt
|
|
88
|
+
dist
|
|
89
|
+
|
|
90
|
+
# Gatsby files
|
|
91
|
+
.cache/
|
|
92
|
+
# Comment in the public line in if your project uses Gatsby and not Next.js
|
|
93
|
+
# https://nextjs.org/blog/next-9-1#public-directory-support
|
|
94
|
+
# public
|
|
95
|
+
|
|
96
|
+
# vuepress build output
|
|
97
|
+
.vuepress/dist
|
|
98
|
+
|
|
99
|
+
# Serverless directories
|
|
100
|
+
.serverless/
|
|
101
|
+
|
|
102
|
+
# FuseBox cache
|
|
103
|
+
.fusebox/
|
|
104
|
+
|
|
105
|
+
# DynamoDB Local files
|
|
106
|
+
.dynamodb/
|
|
107
|
+
|
|
108
|
+
# TernJS port file
|
|
109
|
+
.tern-port
|
|
110
|
+
|
|
111
|
+
# Stores VSCode versions used for testing VSCode extensions
|
|
112
|
+
.vscode-test
|
|
113
|
+
.vscode
|
|
114
|
+
|
|
115
|
+
# yarn v2
|
|
116
|
+
.yarn/cache
|
|
117
|
+
.yarn/unplugged
|
|
118
|
+
.yarn/build-state.yml
|
|
119
|
+
.yarn/install-state.gz
|
|
120
|
+
.pnp.*
|
|
121
|
+
|
|
122
|
+
|
|
123
|
+
# Python
|
|
124
|
+
.venv
|
|
125
|
+
samples
|
|
126
|
+
*.h5
|
|
127
|
+
control-node/test-keys
|
|
128
|
+
/monitor/node-monitor
|
|
129
|
+
/monitor/node-monitor.exe
|
|
130
|
+
bin
|
|
131
|
+
|
|
132
|
+
#Data
|
|
133
|
+
/www-data
|
|
134
|
+
wasm-build
|
|
135
|
+
/www/server/.idea/cody_history.xml
|
|
136
|
+
/www/server/.idea/cody_project_settings.xml
|
|
137
|
+
/www/shared/.idea/aws.xml
|
|
138
|
+
/e2e/.idea/aws.xml
|
|
139
|
+
#/ui/*
|
|
140
|
+
/e2e/config/*.env
|
|
141
|
+
!/e2e/config/api.env
|
|
142
|
+
!/e2e/config/mail.env
|
|
143
|
+
!/e2e/config/ui-config.js
|
|
144
|
+
!/e2e/docker-compose.yml
|
|
145
|
+
/www/server/.idea/dataSources.local.xml
|
|
146
|
+
/www/server/.idea/inspectionProfiles/Project_Default.xml
|
|
147
|
+
/www/server/.idea/sqldialects.xml
|
|
148
|
+
/www/server/.idea/vcs.xml
|
|
149
|
+
mockups
|
|
150
|
+
e2e-old
|
|
151
|
+
|
|
152
|
+
# Playwright
|
|
153
|
+
/test-results/
|
|
154
|
+
/playwright-report/
|
|
155
|
+
/blob-report/
|
|
156
|
+
/playwright/.cache/
|
|
157
|
+
/playwright/.auth/
|
|
158
|
+
|
|
159
|
+
# others
|
|
160
|
+
.mcp*
|
|
161
|
+
.claude/
|
|
162
|
+
.playwright-mcp/
|
|
163
|
+
CLAUDE.md
|
|
164
|
+
azure-cli.md
|
|
165
|
+
results
|
mivia-0.1.0/.prototools
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
3.12
|
mivia-0.1.0/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2024 MiViA Team
|
|
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.
|
mivia-0.1.0/PKG-INFO
ADDED
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: mivia
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Python API client for MiViA (Microstructure Analysis)
|
|
5
|
+
Project-URL: Homepage, https://mivia.ai
|
|
6
|
+
Project-URL: Documentation, https://github.com/MiViA-GmbH/mivia-api-python#readme
|
|
7
|
+
Project-URL: Repository, https://github.com/MiViA-GmbH/mivia-api-python
|
|
8
|
+
Project-URL: Issues, https://github.com/MiViA-GmbH/mivia-api-python/issues
|
|
9
|
+
Author-email: Krzysztof Bzowski <krzysztof.bzowski@mivia.ai>
|
|
10
|
+
License: MIT
|
|
11
|
+
License-File: LICENSE
|
|
12
|
+
Keywords: analysis,api,client,microscopy,microstructure,mivia
|
|
13
|
+
Classifier: Development Status :: 4 - Beta
|
|
14
|
+
Classifier: Intended Audience :: Developers
|
|
15
|
+
Classifier: Intended Audience :: Science/Research
|
|
16
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
17
|
+
Classifier: Operating System :: OS Independent
|
|
18
|
+
Classifier: Programming Language :: Python :: 3
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
21
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
22
|
+
Classifier: Topic :: Scientific/Engineering :: Image Processing
|
|
23
|
+
Classifier: Typing :: Typed
|
|
24
|
+
Requires-Python: >=3.11
|
|
25
|
+
Requires-Dist: httpx>=0.27.0
|
|
26
|
+
Requires-Dist: pydantic-settings>=2.0.0
|
|
27
|
+
Requires-Dist: pydantic>=2.0.0
|
|
28
|
+
Requires-Dist: rich>=13.0.0
|
|
29
|
+
Requires-Dist: typer>=0.12.0
|
|
30
|
+
Provides-Extra: dev
|
|
31
|
+
Requires-Dist: mypy>=1.10.0; extra == 'dev'
|
|
32
|
+
Requires-Dist: pytest-asyncio>=0.23.0; extra == 'dev'
|
|
33
|
+
Requires-Dist: pytest-httpx>=0.30.0; extra == 'dev'
|
|
34
|
+
Requires-Dist: pytest>=8.0.0; extra == 'dev'
|
|
35
|
+
Requires-Dist: ruff>=0.4.0; extra == 'dev'
|
|
36
|
+
Description-Content-Type: text/markdown
|
|
37
|
+
|
|
38
|
+
# MiViA Python Client
|
|
39
|
+
|
|
40
|
+
Python API client for MiViA (Microstructure Analysis).
|
|
41
|
+
|
|
42
|
+
## Installation
|
|
43
|
+
|
|
44
|
+
```bash
|
|
45
|
+
pip install -e .
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
## Configuration
|
|
49
|
+
|
|
50
|
+
Set your API key as environment variable:
|
|
51
|
+
|
|
52
|
+
```bash
|
|
53
|
+
export MIVIA_API_KEY="your-api-key"
|
|
54
|
+
export MIVIA_BASE_URL="https://app.mivia.ai/api" # optional, default
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
## Usage
|
|
58
|
+
|
|
59
|
+
### Async Client
|
|
60
|
+
|
|
61
|
+
```python
|
|
62
|
+
import asyncio
|
|
63
|
+
from mivia import MiviaClient
|
|
64
|
+
|
|
65
|
+
async def main():
|
|
66
|
+
async with MiviaClient() as client:
|
|
67
|
+
# List models
|
|
68
|
+
models = await client.list_models()
|
|
69
|
+
print(f"Models: {[m.display_name for m in models]}")
|
|
70
|
+
|
|
71
|
+
# High-level: analyze images
|
|
72
|
+
jobs = await client.analyze(
|
|
73
|
+
file_paths=["image1.png", "image2.png"],
|
|
74
|
+
model_id=models[0].id,
|
|
75
|
+
wait=True,
|
|
76
|
+
)
|
|
77
|
+
|
|
78
|
+
for job in jobs:
|
|
79
|
+
print(f"Job {job.id}: {job.status}")
|
|
80
|
+
|
|
81
|
+
# Download report
|
|
82
|
+
await client.download_pdf(
|
|
83
|
+
job_ids=[j.id for j in jobs],
|
|
84
|
+
output_path="report.pdf",
|
|
85
|
+
)
|
|
86
|
+
|
|
87
|
+
asyncio.run(main())
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
### Sync Client
|
|
91
|
+
|
|
92
|
+
```python
|
|
93
|
+
from mivia import SyncMiviaClient
|
|
94
|
+
|
|
95
|
+
client = SyncMiviaClient()
|
|
96
|
+
|
|
97
|
+
# List models
|
|
98
|
+
models = client.list_models()
|
|
99
|
+
|
|
100
|
+
# Get customizations for a model
|
|
101
|
+
customizations = client.get_model_customizations(models[0].id)
|
|
102
|
+
|
|
103
|
+
# Upload and analyze with customization
|
|
104
|
+
jobs = client.analyze(
|
|
105
|
+
file_paths=["image.png"],
|
|
106
|
+
model_id=models[0].id,
|
|
107
|
+
customization_id=customizations[0].id if customizations else None,
|
|
108
|
+
)
|
|
109
|
+
|
|
110
|
+
# Download report
|
|
111
|
+
client.download_csv(
|
|
112
|
+
job_ids=[j.id for j in jobs],
|
|
113
|
+
output_path="report.zip",
|
|
114
|
+
)
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
## CLI
|
|
118
|
+
|
|
119
|
+
```bash
|
|
120
|
+
# List models
|
|
121
|
+
mivia models
|
|
122
|
+
|
|
123
|
+
# List customizations for a model
|
|
124
|
+
mivia customizations MODEL_UUID
|
|
125
|
+
|
|
126
|
+
# Upload images
|
|
127
|
+
mivia upload image1.png image2.png
|
|
128
|
+
|
|
129
|
+
# Analyze (upload + run + wait)
|
|
130
|
+
mivia analyze image.png --model MODEL_UUID
|
|
131
|
+
|
|
132
|
+
# Analyze with customization (by name or UUID)
|
|
133
|
+
mivia analyze image.png --model MODEL_UUID --customization "Template Name"
|
|
134
|
+
|
|
135
|
+
# List available customizations for analyze
|
|
136
|
+
mivia analyze --model MODEL_UUID --list-customizations
|
|
137
|
+
|
|
138
|
+
# List jobs
|
|
139
|
+
mivia jobs list
|
|
140
|
+
|
|
141
|
+
# Get job details
|
|
142
|
+
mivia jobs get JOB_UUID
|
|
143
|
+
|
|
144
|
+
# Wait for jobs
|
|
145
|
+
mivia jobs wait JOB_UUID1 JOB_UUID2
|
|
146
|
+
|
|
147
|
+
# Download PDF report
|
|
148
|
+
mivia report pdf JOB_UUID -o report.pdf
|
|
149
|
+
|
|
150
|
+
# Download CSV report
|
|
151
|
+
mivia report csv JOB_UUID -o report.zip --no-images
|
|
152
|
+
|
|
153
|
+
# Show config
|
|
154
|
+
mivia config
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
## API Reference
|
|
158
|
+
|
|
159
|
+
### MiviaClient
|
|
160
|
+
|
|
161
|
+
| Method | Description |
|
|
162
|
+
|--------|-------------|
|
|
163
|
+
| `upload_image(path)` | Upload single image |
|
|
164
|
+
| `upload_images(paths)` | Upload multiple images |
|
|
165
|
+
| `list_images()` | List uploaded images |
|
|
166
|
+
| `delete_image(id)` | Delete image |
|
|
167
|
+
| `list_models()` | List available models |
|
|
168
|
+
| `get_model_customizations(id)` | Get model customizations |
|
|
169
|
+
| `create_jobs(image_ids, model_id)` | Create computation jobs |
|
|
170
|
+
| `get_job(id)` | Get job details with results |
|
|
171
|
+
| `list_jobs()` | List jobs with pagination |
|
|
172
|
+
| `wait_for_job(id)` | Poll until job completes |
|
|
173
|
+
| `wait_for_jobs(ids)` | Wait for multiple jobs |
|
|
174
|
+
| `download_pdf(job_ids, path)` | Download PDF report |
|
|
175
|
+
| `download_csv(job_ids, path)` | Download CSV report |
|
|
176
|
+
| `analyze(paths, model_id)` | High-level: upload + run + wait |
|
mivia-0.1.0/README.md
ADDED
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
# MiViA Python Client
|
|
2
|
+
|
|
3
|
+
Python API client for MiViA (Microstructure Analysis).
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
pip install -e .
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Configuration
|
|
12
|
+
|
|
13
|
+
Set your API key as environment variable:
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
export MIVIA_API_KEY="your-api-key"
|
|
17
|
+
export MIVIA_BASE_URL="https://app.mivia.ai/api" # optional, default
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
## Usage
|
|
21
|
+
|
|
22
|
+
### Async Client
|
|
23
|
+
|
|
24
|
+
```python
|
|
25
|
+
import asyncio
|
|
26
|
+
from mivia import MiviaClient
|
|
27
|
+
|
|
28
|
+
async def main():
|
|
29
|
+
async with MiviaClient() as client:
|
|
30
|
+
# List models
|
|
31
|
+
models = await client.list_models()
|
|
32
|
+
print(f"Models: {[m.display_name for m in models]}")
|
|
33
|
+
|
|
34
|
+
# High-level: analyze images
|
|
35
|
+
jobs = await client.analyze(
|
|
36
|
+
file_paths=["image1.png", "image2.png"],
|
|
37
|
+
model_id=models[0].id,
|
|
38
|
+
wait=True,
|
|
39
|
+
)
|
|
40
|
+
|
|
41
|
+
for job in jobs:
|
|
42
|
+
print(f"Job {job.id}: {job.status}")
|
|
43
|
+
|
|
44
|
+
# Download report
|
|
45
|
+
await client.download_pdf(
|
|
46
|
+
job_ids=[j.id for j in jobs],
|
|
47
|
+
output_path="report.pdf",
|
|
48
|
+
)
|
|
49
|
+
|
|
50
|
+
asyncio.run(main())
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
### Sync Client
|
|
54
|
+
|
|
55
|
+
```python
|
|
56
|
+
from mivia import SyncMiviaClient
|
|
57
|
+
|
|
58
|
+
client = SyncMiviaClient()
|
|
59
|
+
|
|
60
|
+
# List models
|
|
61
|
+
models = client.list_models()
|
|
62
|
+
|
|
63
|
+
# Get customizations for a model
|
|
64
|
+
customizations = client.get_model_customizations(models[0].id)
|
|
65
|
+
|
|
66
|
+
# Upload and analyze with customization
|
|
67
|
+
jobs = client.analyze(
|
|
68
|
+
file_paths=["image.png"],
|
|
69
|
+
model_id=models[0].id,
|
|
70
|
+
customization_id=customizations[0].id if customizations else None,
|
|
71
|
+
)
|
|
72
|
+
|
|
73
|
+
# Download report
|
|
74
|
+
client.download_csv(
|
|
75
|
+
job_ids=[j.id for j in jobs],
|
|
76
|
+
output_path="report.zip",
|
|
77
|
+
)
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
## CLI
|
|
81
|
+
|
|
82
|
+
```bash
|
|
83
|
+
# List models
|
|
84
|
+
mivia models
|
|
85
|
+
|
|
86
|
+
# List customizations for a model
|
|
87
|
+
mivia customizations MODEL_UUID
|
|
88
|
+
|
|
89
|
+
# Upload images
|
|
90
|
+
mivia upload image1.png image2.png
|
|
91
|
+
|
|
92
|
+
# Analyze (upload + run + wait)
|
|
93
|
+
mivia analyze image.png --model MODEL_UUID
|
|
94
|
+
|
|
95
|
+
# Analyze with customization (by name or UUID)
|
|
96
|
+
mivia analyze image.png --model MODEL_UUID --customization "Template Name"
|
|
97
|
+
|
|
98
|
+
# List available customizations for analyze
|
|
99
|
+
mivia analyze --model MODEL_UUID --list-customizations
|
|
100
|
+
|
|
101
|
+
# List jobs
|
|
102
|
+
mivia jobs list
|
|
103
|
+
|
|
104
|
+
# Get job details
|
|
105
|
+
mivia jobs get JOB_UUID
|
|
106
|
+
|
|
107
|
+
# Wait for jobs
|
|
108
|
+
mivia jobs wait JOB_UUID1 JOB_UUID2
|
|
109
|
+
|
|
110
|
+
# Download PDF report
|
|
111
|
+
mivia report pdf JOB_UUID -o report.pdf
|
|
112
|
+
|
|
113
|
+
# Download CSV report
|
|
114
|
+
mivia report csv JOB_UUID -o report.zip --no-images
|
|
115
|
+
|
|
116
|
+
# Show config
|
|
117
|
+
mivia config
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
## API Reference
|
|
121
|
+
|
|
122
|
+
### MiviaClient
|
|
123
|
+
|
|
124
|
+
| Method | Description |
|
|
125
|
+
|--------|-------------|
|
|
126
|
+
| `upload_image(path)` | Upload single image |
|
|
127
|
+
| `upload_images(paths)` | Upload multiple images |
|
|
128
|
+
| `list_images()` | List uploaded images |
|
|
129
|
+
| `delete_image(id)` | Delete image |
|
|
130
|
+
| `list_models()` | List available models |
|
|
131
|
+
| `get_model_customizations(id)` | Get model customizations |
|
|
132
|
+
| `create_jobs(image_ids, model_id)` | Create computation jobs |
|
|
133
|
+
| `get_job(id)` | Get job details with results |
|
|
134
|
+
| `list_jobs()` | List jobs with pagination |
|
|
135
|
+
| `wait_for_job(id)` | Poll until job completes |
|
|
136
|
+
| `wait_for_jobs(ids)` | Wait for multiple jobs |
|
|
137
|
+
| `download_pdf(job_ids, path)` | Download PDF report |
|
|
138
|
+
| `download_csv(job_ids, path)` | Download CSV report |
|
|
139
|
+
| `analyze(paths, model_id)` | High-level: upload + run + wait |
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
[project]
|
|
2
|
+
name = "mivia"
|
|
3
|
+
version = "0.1.0"
|
|
4
|
+
description = "Python API client for MiViA (Microstructure Analysis)"
|
|
5
|
+
readme = "README.md"
|
|
6
|
+
license = {text = "MIT"}
|
|
7
|
+
requires-python = ">=3.11"
|
|
8
|
+
authors = [
|
|
9
|
+
{name = "Krzysztof Bzowski", email = "krzysztof.bzowski@mivia.ai"},
|
|
10
|
+
]
|
|
11
|
+
keywords = ["mivia", "microstructure", "analysis", "api", "client", "microscopy"]
|
|
12
|
+
classifiers = [
|
|
13
|
+
"Development Status :: 4 - Beta",
|
|
14
|
+
"Intended Audience :: Science/Research",
|
|
15
|
+
"Intended Audience :: Developers",
|
|
16
|
+
"License :: OSI Approved :: MIT License",
|
|
17
|
+
"Operating System :: OS Independent",
|
|
18
|
+
"Programming Language :: Python :: 3",
|
|
19
|
+
"Programming Language :: Python :: 3.11",
|
|
20
|
+
"Programming Language :: Python :: 3.12",
|
|
21
|
+
"Programming Language :: Python :: 3.13",
|
|
22
|
+
"Topic :: Scientific/Engineering :: Image Processing",
|
|
23
|
+
"Typing :: Typed",
|
|
24
|
+
]
|
|
25
|
+
dependencies = [
|
|
26
|
+
"httpx>=0.27.0",
|
|
27
|
+
"pydantic>=2.0.0",
|
|
28
|
+
"pydantic-settings>=2.0.0",
|
|
29
|
+
"typer>=0.12.0",
|
|
30
|
+
"rich>=13.0.0",
|
|
31
|
+
]
|
|
32
|
+
|
|
33
|
+
[project.optional-dependencies]
|
|
34
|
+
dev = [
|
|
35
|
+
"pytest>=8.0.0",
|
|
36
|
+
"pytest-asyncio>=0.23.0",
|
|
37
|
+
"pytest-httpx>=0.30.0",
|
|
38
|
+
"ruff>=0.4.0",
|
|
39
|
+
"mypy>=1.10.0",
|
|
40
|
+
]
|
|
41
|
+
|
|
42
|
+
[project.urls]
|
|
43
|
+
Homepage = "https://mivia.ai"
|
|
44
|
+
Documentation = "https://github.com/MiViA-GmbH/mivia-api-python#readme"
|
|
45
|
+
Repository = "https://github.com/MiViA-GmbH/mivia-api-python"
|
|
46
|
+
Issues = "https://github.com/MiViA-GmbH/mivia-api-python/issues"
|
|
47
|
+
|
|
48
|
+
[project.scripts]
|
|
49
|
+
mivia = "mivia.cli.main:app"
|
|
50
|
+
|
|
51
|
+
[build-system]
|
|
52
|
+
requires = ["hatchling"]
|
|
53
|
+
build-backend = "hatchling.build"
|
|
54
|
+
|
|
55
|
+
[tool.hatch.build.targets.wheel]
|
|
56
|
+
packages = ["src/mivia"]
|
|
57
|
+
|
|
58
|
+
[tool.ruff]
|
|
59
|
+
line-length = 88
|
|
60
|
+
target-version = "py311"
|
|
61
|
+
|
|
62
|
+
[tool.ruff.lint]
|
|
63
|
+
select = ["E", "F", "I", "UP"]
|
|
64
|
+
|
|
65
|
+
[tool.mypy]
|
|
66
|
+
python_version = "3.11"
|
|
67
|
+
strict = true
|
|
68
|
+
|
|
69
|
+
[tool.pytest.ini_options]
|
|
70
|
+
asyncio_mode = "auto"
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
"""MiViA Python API client."""
|
|
2
|
+
|
|
3
|
+
from mivia.client import MiviaClient
|
|
4
|
+
from mivia.exceptions import (
|
|
5
|
+
AuthenticationError,
|
|
6
|
+
JobTimeoutError,
|
|
7
|
+
MiviaError,
|
|
8
|
+
NotFoundError,
|
|
9
|
+
ServerError,
|
|
10
|
+
ValidationError,
|
|
11
|
+
)
|
|
12
|
+
from mivia.models import (
|
|
13
|
+
CreateJobsRequest,
|
|
14
|
+
CreateReportRequest,
|
|
15
|
+
CustomizationDto,
|
|
16
|
+
ImageDto,
|
|
17
|
+
JobDto,
|
|
18
|
+
JobListResponse,
|
|
19
|
+
JobStatus,
|
|
20
|
+
ModelDto,
|
|
21
|
+
)
|
|
22
|
+
from mivia.sync_client import SyncMiviaClient
|
|
23
|
+
|
|
24
|
+
__all__ = [
|
|
25
|
+
# Clients
|
|
26
|
+
"MiviaClient",
|
|
27
|
+
"SyncMiviaClient",
|
|
28
|
+
# Exceptions
|
|
29
|
+
"MiviaError",
|
|
30
|
+
"AuthenticationError",
|
|
31
|
+
"NotFoundError",
|
|
32
|
+
"ValidationError",
|
|
33
|
+
"ServerError",
|
|
34
|
+
"JobTimeoutError",
|
|
35
|
+
# Models
|
|
36
|
+
"ImageDto",
|
|
37
|
+
"ModelDto",
|
|
38
|
+
"CustomizationDto",
|
|
39
|
+
"JobDto",
|
|
40
|
+
"JobStatus",
|
|
41
|
+
"JobListResponse",
|
|
42
|
+
"CreateJobsRequest",
|
|
43
|
+
"CreateReportRequest",
|
|
44
|
+
]
|
|
45
|
+
|
|
46
|
+
__version__ = "0.1.0"
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"""MiViA CLI module."""
|