vease 4.0.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.
vease-4.0.0/PKG-INFO ADDED
@@ -0,0 +1,175 @@
1
+ Metadata-Version: 2.4
2
+ Name: vease
3
+ Version: 4.0.0
4
+ Summary: Drive the Vease app from Python: install, launch, load, style, snapshot
5
+ Author-email: Geode-solutions <team-web@geode-solutions.com>
6
+ Project-URL: Homepage, https://github.com/Geode-solutions/Vease
7
+ Project-URL: Bug Tracker, https://github.com/Geode-solutions/Vease/issues
8
+ Classifier: Programming Language :: Python :: 3
9
+ Classifier: License :: OSI Approved :: MIT License
10
+ Classifier: Operating System :: OS Independent
11
+ Requires-Python: <3.15,>=3.12
12
+ Description-Content-Type: text/markdown
13
+ Requires-Dist: certifi==2026.7.22
14
+ Requires-Dist: charset-normalizer==3.4.9
15
+ Requires-Dist: idna>=3.18
16
+ Requires-Dist: requests==2.33.0
17
+ Requires-Dist: urllib3==2.7.0
18
+ Provides-Extra: test
19
+ Requires-Dist: pytest; extra == "test"
20
+
21
+ # vease
22
+
23
+ Drive the [Vease](https://github.com/Geode-solutions/Vease) app from Python: install it, launch
24
+ it, load data, style it, move the camera, apply filters and export screenshots or projects.
25
+
26
+ ```bash
27
+ pip install vease
28
+ ```
29
+
30
+ ## Install Vease
31
+
32
+ ```bash
33
+ python -m vease install # the release this package drives, into ~/.vease/app/<version>
34
+ python -m vease install --latest
35
+ python -m vease install --version 3.2.0
36
+ ```
37
+
38
+ It downloads the portable zip of the GitHub release for Linux or Windows, checks it against the
39
+ sha256 digest GitHub publishes, extracts it, and removes the other installed versions
40
+ (`--keep-others` keeps them). `$VEASE_HOME` replaces `~/.vease`; `$GITHUB_TOKEN`, if set, lifts
41
+ GitHub's limit on anonymous API calls.
42
+
43
+ ## Versions
44
+
45
+ The `vease` package X.Y.Z drives Vease X.Y.Z, released from the same commit: only that pair is
46
+ tested together, and only the latest release is supported. The portable zip never updates
47
+ itself, so update both together:
48
+
49
+ ```bash
50
+ pip install -U vease
51
+ python -m vease install
52
+ ```
53
+
54
+ `Vease.launch()` and `Vease.connect()` check the Vease they reach and raise
55
+ `VersionMismatchError` for another version, saying which side to update
56
+ (`check_version=False` skips the check). They also log a warning when a newer release is out,
57
+ asking GitHub at most once a day; `$VEASE_NO_UPDATE_CHECK` turns that off. A package or a
58
+ Vease built from a checkout (version 0.0.0) is never checked.
59
+
60
+ ## Launch Vease or connect to a running one
61
+
62
+ ```python
63
+ from vease import Vease
64
+
65
+ # Starts Vease, and closes it at the end of the block
66
+ with Vease.launch() as vease:
67
+ ...
68
+
69
+ # From its install folder (vease.exe, vease or vease_linux.AppImage)
70
+ with Vease.launch("/opt/vease") as vease:
71
+ ...
72
+
73
+ # Installs the release this package drives first, if needed
74
+ with Vease.launch(install=True) as vease:
75
+ ...
76
+
77
+ # Connect to a running Vease: close() leaves it open
78
+ vease = Vease.connect("http://127.0.0.1:3000")
79
+ ```
80
+
81
+ `Vease.launch()` without a folder runs the installed Vease this package drives, else the one on
82
+ `PATH`, else the newest installed one. A started Vease logs to a temporary file:
83
+ `vease.process.log_path`. `vease.mcp_url` is its MCP endpoint, for agents that drive Vease
84
+ through tools.
85
+
86
+ ## Keep one Vease open across scripts
87
+
88
+ ```bash
89
+ python -m vease start [--folder /opt/vease] [--install] [--skip-version-check]
90
+ python -m vease status # exit code 1 when none runs
91
+ python -m vease stop
92
+ ```
93
+
94
+ Each command prints JSON: `state`, and while Vease runs its `url`, `mcp_url`, `pid` and
95
+ `log_path`. `start` records them in `~/.vease/session.json` (or `$VEASE_SESSION_FILE`), and
96
+ `Vease.connect()` without arguments then connects to that Vease; its `close()` leaves it open.
97
+
98
+ ## Example
99
+
100
+ ```python
101
+ with Vease.launch() as vease:
102
+ loaded = vease.data.load("model.og_brep")["data"]
103
+ model_id = loaded[0]["id"]
104
+
105
+ details = vease.data.details(model_id) # targets, components, attributes, style
106
+ vease.style.model.surfaces.coloring(model_id, "random")
107
+ vease.style.model.blocks.visibility(model_id, False)
108
+
109
+ vease.view.orient("zminus")
110
+ vease.view.scene(z_scaling=2, background_color="#ffffff")
111
+ vease.export.screenshot("model.png")
112
+ ```
113
+
114
+ ## Recipes
115
+
116
+ Start from `vease.data.details(id)`: it lists the targets, components and attributes of a
117
+ data, which the style calls below rely on. A model's components are its mesh components
118
+ (Corner, Line, Surface, Block), each with its `style`, then its collection components, each
119
+ with the geode ids of the components it holds as `items`.
120
+
121
+ ```python
122
+ # Color by an attribute, wherever each data stores it (polygon before vertex, ...)
123
+ vease.style.attribute([mesh_id, model_id], "depth", colormap="batlow")
124
+
125
+ # Tell data apart: one color per mesh, random component colors for a model
126
+ colors = vease.style.distinct_colors(ids)["colors"]
127
+
128
+ # Color a model by collection: a distinct color each, or one color for all.
129
+ # Blocks are drawn over the surfaces that bound them: hide them to see those surfaces
130
+ vease.style.model.blocks.visibility(model_id, False)
131
+ components = vease.data.details(model_id)["components"]
132
+ collections = [c["geode_id"] for c in components if "items" in c]
133
+ legend = vease.style.color_collections(model_id, collections)
134
+ vease.style.color_collections(model_id, [faults_id], color="#d74242")
135
+
136
+ # An oblique snapshot: fit everything, turn and raise the camera, then save the view
137
+ vease.view.reset()
138
+ vease.view.camera(azimuth=30, elevation=30)
139
+ vease.export.screenshot("/abs/path/view.png")
140
+ ```
141
+
142
+ Style calls on several ids style every id they can: check `"failed"` in the result.
143
+ `vease.data.details(model_id)["components"]` gives each mesh component's own style, to check
144
+ what a call changed.
145
+
146
+ ## API
147
+
148
+ | Resource | Methods |
149
+ | --------------------- | ------------------------------------------------------------------------------------------------------------------------------------------- |
150
+ | `vease.data` | `list`, `details`, `load`, `create`, `rename`, `delete` |
151
+ | `vease.style` | `image`, `mesh`, `model` trees mirroring the style routes, `colormaps`, and the helpers `attribute`, `distinct_colors`, `color_collections` |
152
+ | `vease.view` | `reset`, `focus`, `orient`, `camera`, `save`, `restore`, `scene` |
153
+ | `vease.filter` | `shrink`, `explode`, `slice`, `clip`, `threshold` |
154
+ | `vease.viewer` | `state` |
155
+ | `vease.export` | `screenshot`, `project` |
156
+ | `vease.horizon_stack` | `create`, `info` |
157
+
158
+ Every method calls one route under `/api/controller`. Use `help()` on any of them for its parameters
159
+ and what it returns. When Vease refuses a request, it raises `VeaseError`, with
160
+ `status_code`, `message` (the reason Vease gave) and `data`.
161
+
162
+ ## Tests
163
+
164
+ ```bash
165
+ pip install "./python[test]" # from a Vease checkout
166
+ pytest python/tests
167
+ ```
168
+
169
+ `python/e2e` drives a real Vease desktop app: the unpacked app `npm run build:desktop:unpacked`
170
+ makes, given in `$VEASE_FOLDER` (on Linux without a display, under `xvfb-run`). CI runs it on the
171
+ app built from the commit it tests.
172
+
173
+ ```bash
174
+ VEASE_FOLDER=release/0.0.0/linux-unpacked pytest python/e2e
175
+ ```
vease-4.0.0/README.md ADDED
@@ -0,0 +1,155 @@
1
+ # vease
2
+
3
+ Drive the [Vease](https://github.com/Geode-solutions/Vease) app from Python: install it, launch
4
+ it, load data, style it, move the camera, apply filters and export screenshots or projects.
5
+
6
+ ```bash
7
+ pip install vease
8
+ ```
9
+
10
+ ## Install Vease
11
+
12
+ ```bash
13
+ python -m vease install # the release this package drives, into ~/.vease/app/<version>
14
+ python -m vease install --latest
15
+ python -m vease install --version 3.2.0
16
+ ```
17
+
18
+ It downloads the portable zip of the GitHub release for Linux or Windows, checks it against the
19
+ sha256 digest GitHub publishes, extracts it, and removes the other installed versions
20
+ (`--keep-others` keeps them). `$VEASE_HOME` replaces `~/.vease`; `$GITHUB_TOKEN`, if set, lifts
21
+ GitHub's limit on anonymous API calls.
22
+
23
+ ## Versions
24
+
25
+ The `vease` package X.Y.Z drives Vease X.Y.Z, released from the same commit: only that pair is
26
+ tested together, and only the latest release is supported. The portable zip never updates
27
+ itself, so update both together:
28
+
29
+ ```bash
30
+ pip install -U vease
31
+ python -m vease install
32
+ ```
33
+
34
+ `Vease.launch()` and `Vease.connect()` check the Vease they reach and raise
35
+ `VersionMismatchError` for another version, saying which side to update
36
+ (`check_version=False` skips the check). They also log a warning when a newer release is out,
37
+ asking GitHub at most once a day; `$VEASE_NO_UPDATE_CHECK` turns that off. A package or a
38
+ Vease built from a checkout (version 0.0.0) is never checked.
39
+
40
+ ## Launch Vease or connect to a running one
41
+
42
+ ```python
43
+ from vease import Vease
44
+
45
+ # Starts Vease, and closes it at the end of the block
46
+ with Vease.launch() as vease:
47
+ ...
48
+
49
+ # From its install folder (vease.exe, vease or vease_linux.AppImage)
50
+ with Vease.launch("/opt/vease") as vease:
51
+ ...
52
+
53
+ # Installs the release this package drives first, if needed
54
+ with Vease.launch(install=True) as vease:
55
+ ...
56
+
57
+ # Connect to a running Vease: close() leaves it open
58
+ vease = Vease.connect("http://127.0.0.1:3000")
59
+ ```
60
+
61
+ `Vease.launch()` without a folder runs the installed Vease this package drives, else the one on
62
+ `PATH`, else the newest installed one. A started Vease logs to a temporary file:
63
+ `vease.process.log_path`. `vease.mcp_url` is its MCP endpoint, for agents that drive Vease
64
+ through tools.
65
+
66
+ ## Keep one Vease open across scripts
67
+
68
+ ```bash
69
+ python -m vease start [--folder /opt/vease] [--install] [--skip-version-check]
70
+ python -m vease status # exit code 1 when none runs
71
+ python -m vease stop
72
+ ```
73
+
74
+ Each command prints JSON: `state`, and while Vease runs its `url`, `mcp_url`, `pid` and
75
+ `log_path`. `start` records them in `~/.vease/session.json` (or `$VEASE_SESSION_FILE`), and
76
+ `Vease.connect()` without arguments then connects to that Vease; its `close()` leaves it open.
77
+
78
+ ## Example
79
+
80
+ ```python
81
+ with Vease.launch() as vease:
82
+ loaded = vease.data.load("model.og_brep")["data"]
83
+ model_id = loaded[0]["id"]
84
+
85
+ details = vease.data.details(model_id) # targets, components, attributes, style
86
+ vease.style.model.surfaces.coloring(model_id, "random")
87
+ vease.style.model.blocks.visibility(model_id, False)
88
+
89
+ vease.view.orient("zminus")
90
+ vease.view.scene(z_scaling=2, background_color="#ffffff")
91
+ vease.export.screenshot("model.png")
92
+ ```
93
+
94
+ ## Recipes
95
+
96
+ Start from `vease.data.details(id)`: it lists the targets, components and attributes of a
97
+ data, which the style calls below rely on. A model's components are its mesh components
98
+ (Corner, Line, Surface, Block), each with its `style`, then its collection components, each
99
+ with the geode ids of the components it holds as `items`.
100
+
101
+ ```python
102
+ # Color by an attribute, wherever each data stores it (polygon before vertex, ...)
103
+ vease.style.attribute([mesh_id, model_id], "depth", colormap="batlow")
104
+
105
+ # Tell data apart: one color per mesh, random component colors for a model
106
+ colors = vease.style.distinct_colors(ids)["colors"]
107
+
108
+ # Color a model by collection: a distinct color each, or one color for all.
109
+ # Blocks are drawn over the surfaces that bound them: hide them to see those surfaces
110
+ vease.style.model.blocks.visibility(model_id, False)
111
+ components = vease.data.details(model_id)["components"]
112
+ collections = [c["geode_id"] for c in components if "items" in c]
113
+ legend = vease.style.color_collections(model_id, collections)
114
+ vease.style.color_collections(model_id, [faults_id], color="#d74242")
115
+
116
+ # An oblique snapshot: fit everything, turn and raise the camera, then save the view
117
+ vease.view.reset()
118
+ vease.view.camera(azimuth=30, elevation=30)
119
+ vease.export.screenshot("/abs/path/view.png")
120
+ ```
121
+
122
+ Style calls on several ids style every id they can: check `"failed"` in the result.
123
+ `vease.data.details(model_id)["components"]` gives each mesh component's own style, to check
124
+ what a call changed.
125
+
126
+ ## API
127
+
128
+ | Resource | Methods |
129
+ | --------------------- | ------------------------------------------------------------------------------------------------------------------------------------------- |
130
+ | `vease.data` | `list`, `details`, `load`, `create`, `rename`, `delete` |
131
+ | `vease.style` | `image`, `mesh`, `model` trees mirroring the style routes, `colormaps`, and the helpers `attribute`, `distinct_colors`, `color_collections` |
132
+ | `vease.view` | `reset`, `focus`, `orient`, `camera`, `save`, `restore`, `scene` |
133
+ | `vease.filter` | `shrink`, `explode`, `slice`, `clip`, `threshold` |
134
+ | `vease.viewer` | `state` |
135
+ | `vease.export` | `screenshot`, `project` |
136
+ | `vease.horizon_stack` | `create`, `info` |
137
+
138
+ Every method calls one route under `/api/controller`. Use `help()` on any of them for its parameters
139
+ and what it returns. When Vease refuses a request, it raises `VeaseError`, with
140
+ `status_code`, `message` (the reason Vease gave) and `data`.
141
+
142
+ ## Tests
143
+
144
+ ```bash
145
+ pip install "./python[test]" # from a Vease checkout
146
+ pytest python/tests
147
+ ```
148
+
149
+ `python/e2e` drives a real Vease desktop app: the unpacked app `npm run build:desktop:unpacked`
150
+ makes, given in `$VEASE_FOLDER` (on Linux without a display, under `xvfb-run`). CI runs it on the
151
+ app built from the commit it tests.
152
+
153
+ ```bash
154
+ VEASE_FOLDER=release/0.0.0/linux-unpacked pytest python/e2e
155
+ ```
@@ -0,0 +1,37 @@
1
+ [build-system]
2
+ requires = ["setuptools"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "vease"
7
+ version = "4.0.0"
8
+ dynamic = ["dependencies"]
9
+ authors = [{ name = "Geode-solutions", email = "team-web@geode-solutions.com" }]
10
+ description = "Drive the Vease app from Python: install, launch, load, style, snapshot"
11
+ readme = "README.md"
12
+ requires-python = ">=3.12, <3.15"
13
+ classifiers = [
14
+ "Programming Language :: Python :: 3",
15
+ "License :: OSI Approved :: MIT License",
16
+ "Operating System :: OS Independent",
17
+ ]
18
+
19
+ [project.urls]
20
+ "Homepage" = "https://github.com/Geode-solutions/Vease"
21
+ "Bug Tracker" = "https://github.com/Geode-solutions/Vease/issues"
22
+
23
+ [project.optional-dependencies]
24
+ test = ["pytest"]
25
+
26
+ [tool.pytest.ini_options]
27
+ # e2e drives a real Vease: run it explicitly, with $VEASE_FOLDER (see e2e/test_desktop.py)
28
+ testpaths = ["tests"]
29
+
30
+ [tool.setuptools.dynamic]
31
+ dependencies = { file = ["requirements.txt"] }
32
+
33
+ [tool.setuptools.packages.find]
34
+ where = ["src"]
35
+
36
+ [tool.setuptools.package-data]
37
+ vease = ["py.typed"]
@@ -0,0 +1,16 @@
1
+ #
2
+ # This file is autogenerated by pip-compile with Python 3.12
3
+ # by the following command:
4
+ #
5
+ # pip-compile Vease/Vease/python/requirements.in
6
+ #
7
+ certifi==2026.7.22
8
+ # via requests
9
+ charset-normalizer==3.4.9
10
+ # via requests
11
+ idna>=3.18
12
+ # via requests
13
+ requests==2.33.0
14
+ # via -r Vease/Vease/python/requirements.in
15
+ urllib3==2.7.0
16
+ # via requests
vease-4.0.0/setup.cfg ADDED
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1,228 @@
1
+ """Drive the Vease app from Python.
2
+
3
+ from vease import Vease
4
+
5
+ with Vease.launch() as vease: # starts Vease, closes it at the end of the block
6
+ loaded = vease.data.load("model.og_brep")["data"]
7
+ model_id = loaded[0]["id"]
8
+ vease.style.model.surfaces.coloring(model_id, "random")
9
+ vease.view.orient("zplus")
10
+ vease.export.screenshot("model.png")
11
+
12
+ Vease.launch() runs the Vease found in folder=, installed by `python -m vease install`, or
13
+ on PATH; launch(install=True) installs the Vease release this package drives first, if needed.
14
+
15
+ This package X.Y.Z drives Vease X.Y.Z only: launch() and connect() raise
16
+ VersionMismatchError for another Vease (check_version=False skips that), and log a warning
17
+ when a newer release is out. Update with `pip install -U vease`, then
18
+ `python -m vease install` (or launch(install=True)).
19
+
20
+ To keep one Vease open across scripts, start it once from a terminal:
21
+
22
+ python -m vease start # then: status, stop
23
+
24
+ Vease.connect() then connects to it, and leaves it open on close(); so does
25
+ Vease.connect("http://127.0.0.1:3000") for any running Vease.
26
+
27
+ Entry points (help() on each gives its parameters and what it returns):
28
+
29
+ Vease.launch, Vease.connect, install(version=None), __version__
30
+
31
+ vease.data list, details, load, create, rename, delete
32
+ details(id) tells what a data can be styled with: start there
33
+ vease.style .image / .mesh / .model trees, one route per property, and colormaps()
34
+ attribute(ids, name) color by an attribute, wherever it is stored
35
+ distinct_colors(ids) tell data apart
36
+ color_collections(model_id, collection_ids, color="random")
37
+ vease.view reset, focus, orient, camera (azimuth, elevation, zoom...), save,
38
+ restore, scene; each returns once the view is final
39
+ vease.filter shrink, explode, slice, clip, threshold
40
+ vease.viewer state: camera, saved positions, z scaling
41
+ vease.export screenshot, project
42
+ vease.horizon_stack create, info
43
+
44
+ Every call raises VeaseError (status_code, message) when Vease refuses it.
45
+ """
46
+
47
+ from __future__ import annotations
48
+
49
+ import os
50
+ from types import TracebackType
51
+ from typing import Self
52
+
53
+ from .client import (
54
+ DEFAULT_READY_TIMEOUT,
55
+ DEFAULT_REQUEST_TIMEOUT,
56
+ VeaseClient,
57
+ VeaseError,
58
+ )
59
+ from .installer import Installation, install
60
+
61
+ # Vease.launch() has an install flag, which hides install() in its body
62
+ from .installer import install as install_vease
63
+ from .launcher import DEFAULT_START_TIMEOUT, VeaseProcess, find_vease
64
+ from .resources.data import DataResource
65
+ from .resources.export import ExportResource
66
+ from .resources.filter import FilterResource
67
+ from .resources.horizon_stack import HorizonStackResource
68
+ from .resources.style import StyleResource
69
+ from .resources.view import ViewResource
70
+ from .resources.viewer import ViewerResource
71
+ from .session import running_session
72
+ from .version import (
73
+ VersionMismatchError,
74
+ check_version,
75
+ is_development,
76
+ matching_vease_version,
77
+ package_version,
78
+ warn_if_outdated,
79
+ )
80
+
81
+ __version__ = package_version()
82
+
83
+ __all__ = [
84
+ "Installation",
85
+ "Vease",
86
+ "VeaseClient",
87
+ "VeaseError",
88
+ "VeaseProcess",
89
+ "VersionMismatchError",
90
+ "__version__",
91
+ "install",
92
+ ]
93
+
94
+
95
+ class Vease:
96
+ """Entry point: vease.data, .style, .view, .filter, .viewer, .export and .horizon_stack.
97
+
98
+ Get one with Vease.connect() (a running Vease) or Vease.launch() (start one).
99
+ """
100
+
101
+ def __init__(self, client: VeaseClient, process: VeaseProcess | None = None):
102
+ """Wrap a ready client; process is the Vease to close on close(), if owned."""
103
+ self.client = client
104
+ self.process = process
105
+ self.data = DataResource(client)
106
+ self.style = StyleResource(client)
107
+ self.view = ViewResource(client)
108
+ self.filter = FilterResource(client)
109
+ self.viewer = ViewerResource(client)
110
+ self.export = ExportResource(client)
111
+ self.horizon_stack = HorizonStackResource(client)
112
+
113
+ @classmethod
114
+ def connect(
115
+ cls,
116
+ url: str | None = None,
117
+ *,
118
+ ready_timeout: float = DEFAULT_READY_TIMEOUT,
119
+ request_timeout: float | None = DEFAULT_REQUEST_TIMEOUT,
120
+ check_version: bool = True,
121
+ ) -> Self:
122
+ """Connect to a running Vease, which close() leaves open.
123
+
124
+ url: e.g. "http://127.0.0.1:3000"; without it, the Vease `python -m vease start`
125
+ started. Raises ConnectionError when no url is given and none was started, and
126
+ VersionMismatchError when that Vease is not the release this package drives, unless
127
+ check_version=False.
128
+ """
129
+ if url is None:
130
+ session = running_session()
131
+ if session is None:
132
+ raise ConnectionError(
133
+ "No running Vease was started with `python -m vease start`: "
134
+ "start one so, pass its url, or use Vease.launch()"
135
+ )
136
+ url = session.url
137
+ if not url.startswith(("http://", "https://")):
138
+ raise ValueError(
139
+ f"url must start with http:// or https://, got {url!r}; "
140
+ "to start Vease from a folder, use Vease.launch(folder)"
141
+ )
142
+ client = VeaseClient(url, request_timeout)
143
+ try:
144
+ client.wait_until_ready(ready_timeout)
145
+ _check(client, check_version)
146
+ except BaseException:
147
+ client.close()
148
+ raise
149
+ return cls(client)
150
+
151
+ @classmethod
152
+ def launch(
153
+ cls,
154
+ folder: str | os.PathLike[str] | None = None,
155
+ *,
156
+ install: bool = False,
157
+ log_path: str | os.PathLike[str] | None = None,
158
+ start_timeout: float = DEFAULT_START_TIMEOUT,
159
+ ready_timeout: float = DEFAULT_READY_TIMEOUT,
160
+ request_timeout: float | None = DEFAULT_REQUEST_TIMEOUT,
161
+ check_version: bool = True,
162
+ ) -> Self:
163
+ """Start Vease, and close it on close() or at the end of a with block.
164
+
165
+ Runs the Vease executable in folder; without folder, the installed Vease this
166
+ package drives, else the one on PATH, else the newest installed one.
167
+ install=True first installs the Vease release this package drives, unless it is
168
+ already (a download of several hundred MB), and removes the other installed
169
+ versions. Raises VersionMismatchError when the started Vease is not that release,
170
+ unless check_version=False. Its output goes to log_path, a new temporary file by
171
+ default.
172
+ """
173
+ if install and folder is None:
174
+ _install_matching()
175
+ process = VeaseProcess(folder, log_path, start_timeout)
176
+ client = VeaseClient(process.url, request_timeout)
177
+ try:
178
+ client.wait_until_ready(ready_timeout, process.is_alive)
179
+ _check(client, check_version)
180
+ except BaseException:
181
+ client.close()
182
+ process.stop()
183
+ raise
184
+ return cls(client, process)
185
+
186
+ @property
187
+ def url(self) -> str:
188
+ """Root URL of the Vease this object talks to."""
189
+ return self.client.app_url
190
+
191
+ @property
192
+ def mcp_url(self) -> str:
193
+ """MCP endpoint of this Vease, for agents that drive it through tools."""
194
+ return self.client.mcp_url
195
+
196
+ def close(self) -> None:
197
+ """Close the connection, and Vease itself if this object started it."""
198
+ self.client.close()
199
+ if self.process is not None:
200
+ self.process.stop()
201
+
202
+ def __enter__(self) -> Self:
203
+ return self
204
+
205
+ def __exit__(
206
+ self,
207
+ exc_type: type[BaseException] | None,
208
+ exc: BaseException | None,
209
+ traceback: TracebackType | None,
210
+ ) -> None:
211
+ self.close()
212
+
213
+
214
+ def _install_matching() -> None:
215
+ if not is_development(matching_vease_version()):
216
+ install_vease()
217
+ return
218
+ # A package installed from a checkout matches no release: any installed Vease will do
219
+ try:
220
+ find_vease()
221
+ except FileNotFoundError:
222
+ install_vease()
223
+
224
+
225
+ def _check(client: VeaseClient, check: bool) -> None:
226
+ if check:
227
+ check_version(client)
228
+ warn_if_outdated()