Compare commits
6 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| c04a97780c | |||
| c5cd69569e | |||
| e38249bc38 | |||
| 08fbf59c8a | |||
| e9cdd3e900 | |||
| 20bb0449e8 |
@@ -59,8 +59,6 @@ jobs:
|
||||
test-public: # Run integration tests against the public server image
|
||||
name: Test (public)
|
||||
runs-on: ubuntu-latest
|
||||
env:
|
||||
IS_PUBLIC: "true"
|
||||
strategy:
|
||||
matrix:
|
||||
python-version:
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
words = ["specklepy"]
|
||||
@@ -1,50 +0,0 @@
|
||||
# specklepy API Reference
|
||||
|
||||
> The Python SDK for Speckle - Build powerful AEC data workflows
|
||||
|
||||
**specklepy** is the Python SDK for Speckle, enabling you to interact with Speckle Server, send and receive geometry, and build custom integrations for the AEC industry.
|
||||
|
||||
## What is specklepy?
|
||||
|
||||
specklepy is a comprehensive Python library that provides:
|
||||
|
||||
* **Object-based data exchange** - Send and receive geometry and BIM data without files
|
||||
* **GraphQL API client** - Full access to Speckle Server's API
|
||||
* **Extensible object model** - Create custom objects that inherit from `Base`
|
||||
* **Multiple transport options** - Store data locally (SQLite), in-memory, or on Speckle Server
|
||||
* **Geometry support** - Rich geometric primitives (Point, Line, Mesh, etc.)
|
||||
|
||||
## Speckle Automate
|
||||
|
||||
Speckle Automate is a fully fledged CI/CD platform designed to run custom code on Speckle models whenever a new version is available.
|
||||
|
||||
As a software developer, you can develop Functions that others in your team consume in Automations. From creating reports to running code compliance checks to wind simulations, there is no limit to what you can do with Automate.
|
||||
|
||||
## Installation
|
||||
|
||||
Install specklepy using pip:
|
||||
|
||||
```bash
|
||||
pip install specklepy
|
||||
```
|
||||
|
||||
## Quick Example
|
||||
|
||||
```python
|
||||
from specklepy.api.client import SpeckleClient
|
||||
from specklepy.api.credentials import get_default_account
|
||||
from specklepy.objects.geometry import Point
|
||||
|
||||
# Authenticate
|
||||
client = SpeckleClient(host="https://app.speckle.systems")
|
||||
account = get_default_account()
|
||||
client.authenticate_with_account(account)
|
||||
|
||||
# Create geometry
|
||||
point = Point(x=10, y=20, z=5)
|
||||
```
|
||||
|
||||
## Getting Help
|
||||
|
||||
- **Community Forum**: [speckle.community](https://speckle.community/c/help/developers)
|
||||
- **GitHub Issues**: [github.com/specklesystems/specklepy](https://github.com/specklesystems/specklepy/issues)
|
||||
@@ -1 +0,0 @@
|
||||
::: speckle_automate.AutomationContext
|
||||
@@ -1,3 +0,0 @@
|
||||
::: speckle_automate.runner.execute_automate_function
|
||||
|
||||
::: speckle_automate.runner.run_function
|
||||
@@ -1,11 +0,0 @@
|
||||
::: speckle_automate.AutomateBase
|
||||
|
||||
::: speckle_automate.AutomationRunData
|
||||
|
||||
::: speckle_automate.AutomationResult
|
||||
|
||||
::: speckle_automate.ResultCase
|
||||
|
||||
::: speckle_automate.AutomationStatus
|
||||
|
||||
::: speckle_automate.ObjectResultLevel
|
||||
@@ -1,5 +0,0 @@
|
||||
::: specklepy.api.credentials.Account
|
||||
|
||||
::: specklepy.api.credentials.UserInfo
|
||||
|
||||
::: specklepy.api.credentials.StreamWrapper
|
||||
@@ -1,7 +0,0 @@
|
||||
::: specklepy.api.operations.send
|
||||
|
||||
::: specklepy.api.operations.receive
|
||||
|
||||
::: specklepy.api.operations.serialize
|
||||
|
||||
::: specklepy.api.operations.deserialize
|
||||
@@ -1 +0,0 @@
|
||||
::: specklepy.api.resources.ActiveUserResource
|
||||
@@ -1 +0,0 @@
|
||||
::: specklepy.api.resources.FileImportResource
|
||||
@@ -1 +0,0 @@
|
||||
::: specklepy.api.resources.ModelResource
|
||||
@@ -1 +0,0 @@
|
||||
::: specklepy.api.resources.OtherUserResource
|
||||
@@ -1 +0,0 @@
|
||||
::: specklepy.api.resources.ProjectInviteResource
|
||||
@@ -1 +0,0 @@
|
||||
::: specklepy.api.resources.ProjectResource
|
||||
@@ -1 +0,0 @@
|
||||
::: specklepy.api.resources.ServerResource
|
||||
@@ -1 +0,0 @@
|
||||
::: specklepy.api.resources.SubscriptionResource
|
||||
@@ -1 +0,0 @@
|
||||
::: specklepy.api.resources.VersionResource
|
||||
@@ -1 +0,0 @@
|
||||
::: specklepy.api.resources.WorkspaceResource
|
||||
@@ -1 +0,0 @@
|
||||
::: specklepy.core.api.enums.ProjectVisibility
|
||||
@@ -1,11 +0,0 @@
|
||||
::: specklepy.core.api.inputs.ProjectCreateInput
|
||||
|
||||
::: specklepy.core.api.inputs.ProjectUpdateInput
|
||||
|
||||
::: specklepy.core.api.inputs.CreateModelInput
|
||||
|
||||
::: specklepy.core.api.inputs.UpdateModelInput
|
||||
|
||||
::: specklepy.core.api.inputs.CreateVersionInput
|
||||
|
||||
::: specklepy.core.api.inputs.UpdateVersionInput
|
||||
@@ -1,13 +0,0 @@
|
||||
::: specklepy.core.api.models.User
|
||||
|
||||
::: specklepy.core.api.models.LimitedUser
|
||||
|
||||
::: specklepy.core.api.models.ServerInfo
|
||||
|
||||
::: specklepy.core.api.models.Project
|
||||
|
||||
::: specklepy.core.api.models.Model
|
||||
|
||||
::: specklepy.core.api.models.Version
|
||||
|
||||
::: specklepy.core.api.models.current.Workspace
|
||||
@@ -1,7 +0,0 @@
|
||||
::: specklepy.logging.exceptions.SpeckleException
|
||||
|
||||
::: specklepy.logging.exceptions.GraphQLException
|
||||
|
||||
::: specklepy.logging.exceptions.SerializationException
|
||||
|
||||
::: specklepy.logging.exceptions.SpeckleWarning
|
||||
@@ -1,3 +0,0 @@
|
||||
::: specklepy.objects.Base
|
||||
|
||||
::: specklepy.objects.base.DataChunk
|
||||
@@ -1,5 +0,0 @@
|
||||
::: specklepy.objects.DataObject
|
||||
|
||||
::: specklepy.objects.QgisObject
|
||||
|
||||
::: specklepy.objects.BlenderObject
|
||||
@@ -1 +0,0 @@
|
||||
::: specklepy.objects.geometry.Arc
|
||||
@@ -1 +0,0 @@
|
||||
::: specklepy.objects.geometry.Box
|
||||
@@ -1 +0,0 @@
|
||||
::: specklepy.objects.geometry.Circle
|
||||
@@ -1 +0,0 @@
|
||||
::: specklepy.objects.geometry.ControlPoint
|
||||
@@ -1 +0,0 @@
|
||||
::: specklepy.objects.geometry.Curve
|
||||
@@ -1 +0,0 @@
|
||||
::: specklepy.objects.geometry.Ellipse
|
||||
@@ -1 +0,0 @@
|
||||
::: specklepy.objects.geometry.Line
|
||||
@@ -1 +0,0 @@
|
||||
::: specklepy.objects.geometry.Mesh
|
||||
@@ -1 +0,0 @@
|
||||
::: specklepy.objects.geometry.Plane
|
||||
@@ -1 +0,0 @@
|
||||
::: specklepy.objects.geometry.Point
|
||||
@@ -1 +0,0 @@
|
||||
::: specklepy.objects.geometry.PointCloud
|
||||
@@ -1 +0,0 @@
|
||||
::: specklepy.objects.geometry.Polycurve
|
||||
@@ -1 +0,0 @@
|
||||
::: specklepy.objects.geometry.Polyline
|
||||
@@ -1 +0,0 @@
|
||||
::: specklepy.objects.geometry.Spiral
|
||||
@@ -1 +0,0 @@
|
||||
::: specklepy.objects.geometry.Surface
|
||||
@@ -1 +0,0 @@
|
||||
::: specklepy.objects.geometry.Vector
|
||||
@@ -1,7 +0,0 @@
|
||||
::: specklepy.objects.graph_traversal.GraphTraversal
|
||||
|
||||
::: specklepy.objects.graph_traversal.TraversalContext
|
||||
|
||||
::: specklepy.objects.graph_traversal.TraversalRule
|
||||
|
||||
::: specklepy.objects.graph_traversal.DefaultRule
|
||||
@@ -1 +0,0 @@
|
||||
::: specklepy.objects.models.collections.collection.Collection
|
||||
@@ -1 +0,0 @@
|
||||
::: specklepy.objects.proxies.LevelProxy
|
||||
@@ -1 +0,0 @@
|
||||
::: specklepy.serialization.base_object_serializer.BaseObjectSerializer
|
||||
@@ -1,7 +0,0 @@
|
||||
::: specklepy.transports.abstract_transport.AbstractTransport
|
||||
|
||||
::: specklepy.transports.memory.MemoryTransport
|
||||
|
||||
::: specklepy.transports.sqlite.SQLiteTransport
|
||||
|
||||
::: specklepy.transports.server.ServerTransport
|
||||
@@ -1,304 +0,0 @@
|
||||
.md-content h1 {
|
||||
font-size: 1.125rem;
|
||||
font-weight: 700;
|
||||
color: #111827;
|
||||
letter-spacing: -0.025em;
|
||||
line-height: 1.2;
|
||||
}
|
||||
|
||||
@media (min-width: 640px) {
|
||||
.md-content h1 {
|
||||
font-size: 1.25rem;
|
||||
}
|
||||
}
|
||||
|
||||
[data-md-color-scheme="slate"] .md-content h1 {
|
||||
color: #e5e7eb;
|
||||
}
|
||||
|
||||
.md-content h2 {
|
||||
font-size: 1rem;
|
||||
font-weight: 700;
|
||||
color: #111827;
|
||||
letter-spacing: -0.025em;
|
||||
margin-top: 2rem;
|
||||
}
|
||||
|
||||
@media (min-width: 640px) {
|
||||
.md-content h2 {
|
||||
font-size: 1.125rem;
|
||||
}
|
||||
}
|
||||
|
||||
[data-md-color-scheme="slate"] .md-content h2 {
|
||||
color: #e5e7eb;
|
||||
}
|
||||
|
||||
.md-content h3 {
|
||||
font-size: 0.9375rem;
|
||||
font-weight: 600;
|
||||
color: #1f2937;
|
||||
margin-top: 1.5rem;
|
||||
}
|
||||
|
||||
@media (min-width: 640px) {
|
||||
.md-content h3 {
|
||||
font-size: 1rem;
|
||||
}
|
||||
}
|
||||
|
||||
[data-md-color-scheme="slate"] .md-content h3 {
|
||||
color: #d1d5db;
|
||||
}
|
||||
|
||||
.md-content p,
|
||||
.md-content li {
|
||||
font-size: 0.875rem;
|
||||
line-height: 1.6;
|
||||
color: #374151;
|
||||
margin-top: 0.5rem;
|
||||
}
|
||||
|
||||
[data-md-color-scheme="slate"] .md-content p,
|
||||
[data-md-color-scheme="slate"] .md-content li {
|
||||
color: #d1d5db;
|
||||
}
|
||||
|
||||
.doc.doc-object-name {
|
||||
font-size: 1.125rem;
|
||||
font-weight: 700;
|
||||
color: #111827;
|
||||
}
|
||||
|
||||
[data-md-color-scheme="slate"] .doc.doc-object-name {
|
||||
color: #e5e7eb;
|
||||
}
|
||||
|
||||
.doc.doc-heading {
|
||||
font-size: 0.9375rem;
|
||||
font-weight: 600;
|
||||
color: #1f2937;
|
||||
}
|
||||
|
||||
[data-md-color-scheme="slate"] .doc.doc-heading {
|
||||
color: #d1d5db;
|
||||
}
|
||||
|
||||
.md-content code {
|
||||
font-size: 0.75rem;
|
||||
color: #dc2626;
|
||||
background-color: #f3f4f6;
|
||||
padding: 0.125rem 0.375rem;
|
||||
border-radius: 0.25rem;
|
||||
}
|
||||
|
||||
[data-md-color-scheme="slate"] .md-content code {
|
||||
color: #fca5a5;
|
||||
background-color: #1f2937;
|
||||
}
|
||||
|
||||
.md-content pre code {
|
||||
font-size: 0.75rem;
|
||||
color: inherit;
|
||||
background-color: transparent;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
.md-content a {
|
||||
color: #2563eb;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
.md-content a:hover {
|
||||
color: #1d4ed8;
|
||||
text-decoration: underline;
|
||||
}
|
||||
|
||||
[data-md-color-scheme="slate"] .md-content a {
|
||||
color: #60a5fa;
|
||||
}
|
||||
|
||||
[data-md-color-scheme="slate"] .md-content a:hover {
|
||||
color: #93c5fd;
|
||||
}
|
||||
|
||||
[data-md-color-scheme="slate"] {
|
||||
--md-default-bg-color: #000000;
|
||||
--md-default-fg-color: #ffffff;
|
||||
--md-code-bg-color: #0a0a0a;
|
||||
--md-code-fg-color: #ffffff;
|
||||
}
|
||||
|
||||
[data-md-color-scheme="slate"] .md-header {
|
||||
background-color: #000000;
|
||||
}
|
||||
|
||||
[data-md-color-scheme="slate"] .md-tabs {
|
||||
background-color: #000000;
|
||||
}
|
||||
|
||||
[data-md-color-scheme="slate"] .md-footer {
|
||||
background-color: #000000;
|
||||
}
|
||||
|
||||
[data-md-color-scheme="slate"] .md-sidebar {
|
||||
background-color: #000000;
|
||||
}
|
||||
|
||||
[data-md-color-scheme="slate"] .md-nav {
|
||||
background-color: #000000;
|
||||
}
|
||||
|
||||
.highlight pre,
|
||||
.highlight code {
|
||||
background-color: #f6f8fa !important;
|
||||
color: #24292e !important;
|
||||
}
|
||||
|
||||
.highlight .k,
|
||||
.highlight .kc,
|
||||
.highlight .kd,
|
||||
.highlight .kn,
|
||||
.highlight .kp,
|
||||
.highlight .kr,
|
||||
.highlight .kt {
|
||||
color: #d73a49 !important;
|
||||
}
|
||||
|
||||
.highlight .s,
|
||||
.highlight .s1,
|
||||
.highlight .s2,
|
||||
.highlight .sb,
|
||||
.highlight .sc,
|
||||
.highlight .sd,
|
||||
.highlight .se,
|
||||
.highlight .sh,
|
||||
.highlight .si,
|
||||
.highlight .sx,
|
||||
.highlight .sr,
|
||||
.highlight .ss {
|
||||
color: #032f62 !important;
|
||||
}
|
||||
|
||||
.highlight .nf,
|
||||
.highlight .fm,
|
||||
.highlight .nc {
|
||||
color: #6f42c1 !important;
|
||||
}
|
||||
|
||||
.highlight .m,
|
||||
.highlight .mf,
|
||||
.highlight .mh,
|
||||
.highlight .mi,
|
||||
.highlight .mo {
|
||||
color: #005cc5 !important;
|
||||
}
|
||||
|
||||
.highlight .c,
|
||||
.highlight .c1,
|
||||
.highlight .cm,
|
||||
.highlight .cp,
|
||||
.highlight .cs {
|
||||
color: #6a737d !important;
|
||||
font-style: italic;
|
||||
}
|
||||
|
||||
.highlight .o,
|
||||
.highlight .ow {
|
||||
color: #d73a49 !important;
|
||||
}
|
||||
|
||||
.highlight .n,
|
||||
.highlight .na,
|
||||
.highlight .nb,
|
||||
.highlight .nd,
|
||||
.highlight .ni,
|
||||
.highlight .nl,
|
||||
.highlight .nn,
|
||||
.highlight .nx,
|
||||
.highlight .py,
|
||||
.highlight .nt,
|
||||
.highlight .nv,
|
||||
.highlight .bp,
|
||||
.highlight .vc,
|
||||
.highlight .vg,
|
||||
.highlight .vi {
|
||||
color: #e36209 !important;
|
||||
}
|
||||
|
||||
[data-md-color-scheme="slate"] .highlight pre,
|
||||
[data-md-color-scheme="slate"] .highlight code {
|
||||
background-color: #0d1117 !important;
|
||||
color: #e6edf3 !important;
|
||||
}
|
||||
|
||||
[data-md-color-scheme="slate"] .highlight .k,
|
||||
[data-md-color-scheme="slate"] .highlight .kc,
|
||||
[data-md-color-scheme="slate"] .highlight .kd,
|
||||
[data-md-color-scheme="slate"] .highlight .kn,
|
||||
[data-md-color-scheme="slate"] .highlight .kp,
|
||||
[data-md-color-scheme="slate"] .highlight .kr,
|
||||
[data-md-color-scheme="slate"] .highlight .kt {
|
||||
color: #ff7b72 !important;
|
||||
}
|
||||
|
||||
[data-md-color-scheme="slate"] .highlight .s,
|
||||
[data-md-color-scheme="slate"] .highlight .s1,
|
||||
[data-md-color-scheme="slate"] .highlight .s2,
|
||||
[data-md-color-scheme="slate"] .highlight .sb,
|
||||
[data-md-color-scheme="slate"] .highlight .sc,
|
||||
[data-md-color-scheme="slate"] .highlight .sd,
|
||||
[data-md-color-scheme="slate"] .highlight .se,
|
||||
[data-md-color-scheme="slate"] .highlight .sh,
|
||||
[data-md-color-scheme="slate"] .highlight .si,
|
||||
[data-md-color-scheme="slate"] .highlight .sx,
|
||||
[data-md-color-scheme="slate"] .highlight .sr,
|
||||
[data-md-color-scheme="slate"] .highlight .ss {
|
||||
color: #a5d6ff !important;
|
||||
}
|
||||
|
||||
[data-md-color-scheme="slate"] .highlight .nf,
|
||||
[data-md-color-scheme="slate"] .highlight .fm,
|
||||
[data-md-color-scheme="slate"] .highlight .nc {
|
||||
color: #d2a8ff !important;
|
||||
}
|
||||
|
||||
[data-md-color-scheme="slate"] .highlight .m,
|
||||
[data-md-color-scheme="slate"] .highlight .mf,
|
||||
[data-md-color-scheme="slate"] .highlight .mh,
|
||||
[data-md-color-scheme="slate"] .highlight .mi,
|
||||
[data-md-color-scheme="slate"] .highlight .mo {
|
||||
color: #79c0ff !important;
|
||||
}
|
||||
|
||||
[data-md-color-scheme="slate"] .highlight .c,
|
||||
[data-md-color-scheme="slate"] .highlight .c1,
|
||||
[data-md-color-scheme="slate"] .highlight .cm,
|
||||
[data-md-color-scheme="slate"] .highlight .cp,
|
||||
[data-md-color-scheme="slate"] .highlight .cs {
|
||||
color: #8b949e !important;
|
||||
font-style: italic;
|
||||
}
|
||||
|
||||
[data-md-color-scheme="slate"] .highlight .o,
|
||||
[data-md-color-scheme="slate"] .highlight .ow {
|
||||
color: #ff7b72 !important;
|
||||
}
|
||||
|
||||
[data-md-color-scheme="slate"] .highlight .n,
|
||||
[data-md-color-scheme="slate"] .highlight .na,
|
||||
[data-md-color-scheme="slate"] .highlight .nb,
|
||||
[data-md-color-scheme="slate"] .highlight .nd,
|
||||
[data-md-color-scheme="slate"] .highlight .ni,
|
||||
[data-md-color-scheme="slate"] .highlight .nl,
|
||||
[data-md-color-scheme="slate"] .highlight .nn,
|
||||
[data-md-color-scheme="slate"] .highlight .nx,
|
||||
[data-md-color-scheme="slate"] .highlight .py,
|
||||
[data-md-color-scheme="slate"] .highlight .nt,
|
||||
[data-md-color-scheme="slate"] .highlight .nv,
|
||||
[data-md-color-scheme="slate"] .highlight .bp,
|
||||
[data-md-color-scheme="slate"] .highlight .vc,
|
||||
[data-md-color-scheme="slate"] .highlight .vg,
|
||||
[data-md-color-scheme="slate"] .highlight .vi {
|
||||
color: #ffa657 !important;
|
||||
}
|
||||
@@ -1,27 +1,6 @@
|
||||
[tools]
|
||||
python = "3.13.7"
|
||||
uv = "0.9.11"
|
||||
|
||||
[settings]
|
||||
experimental = true
|
||||
python.uv_venv_auto = true
|
||||
|
||||
|
||||
[tasks.install]
|
||||
run= "uv sync --all-extras --all-groups"
|
||||
|
||||
|
||||
[tasks.install_docs]
|
||||
run= "uv sync --group docs"
|
||||
|
||||
[tasks.build_docs]
|
||||
description = "Build static docs "
|
||||
run = "uv run mkdocs build"
|
||||
depends = ['install_docs']
|
||||
|
||||
[tasks.test]
|
||||
run = "uv run pytest"
|
||||
|
||||
|
||||
[env]
|
||||
IS_PUBLIC = "false"
|
||||
|
||||
-130
@@ -1,130 +0,0 @@
|
||||
site_name: specklepy Docs
|
||||
theme:
|
||||
name: material
|
||||
font:
|
||||
text: Inter
|
||||
favicon: assets/speckle_logo.png
|
||||
logo: assets/speckle_logo.png
|
||||
features:
|
||||
- navigation.tabs
|
||||
palette:
|
||||
# Palette toggle for light mode
|
||||
- scheme: default
|
||||
primary: white
|
||||
toggle:
|
||||
icon: material/weather-night
|
||||
name: Switch to dark mode
|
||||
|
||||
# Palette toggle for dark mode
|
||||
- scheme: slate
|
||||
primary: black
|
||||
logo: assets/logo_white.png
|
||||
toggle:
|
||||
icon: material/weather-sunny
|
||||
name: Switch to light mode
|
||||
|
||||
|
||||
|
||||
markdown_extensions:
|
||||
- pymdownx.highlight:
|
||||
anchor_linenums: true
|
||||
line_spans: __span
|
||||
pygments_lang_class: true
|
||||
- pymdownx.inlinehilite
|
||||
- pymdownx.snippets
|
||||
- pymdownx.superfences
|
||||
|
||||
extra_css:
|
||||
- stylesheets/extra.css
|
||||
|
||||
plugins:
|
||||
- search
|
||||
- mkdocstrings:
|
||||
handlers:
|
||||
python:
|
||||
paths: [src]
|
||||
options:
|
||||
parameter_headings: false
|
||||
members_order: source
|
||||
separate_signature: true
|
||||
filters: ["!^_"] #Ignore _ prefixed properties
|
||||
docstring_options:
|
||||
ignore_init_summary: true
|
||||
merge_init_into_class: true
|
||||
show_signature_annotations: true
|
||||
signature_crossrefs: true
|
||||
show_if_no_docstring: true
|
||||
show_labels: true
|
||||
show_source: true
|
||||
show_symbol_type_heading: true
|
||||
show_symbol_type_toc: true
|
||||
show_bases: false
|
||||
heading_level: 3
|
||||
|
||||
inventories:
|
||||
- url: https://docs.python.org/3/objects.inv
|
||||
domains: [py, std]
|
||||
|
||||
nav:
|
||||
- Home: index.md
|
||||
- specklepy SDK:
|
||||
- API:
|
||||
- Client: specklepy/api/client.md
|
||||
- Credentials: specklepy/api/credentials.md
|
||||
- Operations: specklepy/api/operations.md
|
||||
- Resources:
|
||||
- ActiveUserResource: specklepy/api/resources/ActiveUserResource.md
|
||||
- FileImportResource: specklepy/api/resources/FileImportResource.md
|
||||
- ModelResource: specklepy/api/resources/ModelResource.md
|
||||
- OtherUserResource: specklepy/api/resources/OtherUserResource.md
|
||||
- ProjectInviteResource: specklepy/api/resources/ProjectInviteResource.md
|
||||
- ProjectResource: specklepy/api/resources/ProjectResource.md
|
||||
- ServerResource: specklepy/api/resources/ServerResource.md
|
||||
- SubscriptionResource: specklepy/api/resources/SubscriptionResource.md
|
||||
- VersionResource: specklepy/api/resources/VersionResource.md
|
||||
- WorkspaceResource: specklepy/api/resources/WorkspaceResource.md
|
||||
- Objects:
|
||||
- Base: specklepy/objects/base.md
|
||||
- Data Objects: specklepy/objects/data_objects.md
|
||||
- Geometry:
|
||||
- Arc: specklepy/objects/geometry/Arc.md
|
||||
- Box: specklepy/objects/geometry/Box.md
|
||||
- Circle: specklepy/objects/geometry/Circle.md
|
||||
- ControlPoint: specklepy/objects/geometry/ControlPoint.md
|
||||
- Curve: specklepy/objects/geometry/Curve.md
|
||||
- Ellipse: specklepy/objects/geometry/Ellipse.md
|
||||
- Line: specklepy/objects/geometry/Line.md
|
||||
- Mesh: specklepy/objects/geometry/Mesh.md
|
||||
- Plane: specklepy/objects/geometry/Plane.md
|
||||
- Point: specklepy/objects/geometry/Point.md
|
||||
- PointCloud: specklepy/objects/geometry/PointCloud.md
|
||||
- Polycurve: specklepy/objects/geometry/Polycurve.md
|
||||
- Polyline: specklepy/objects/geometry/Polyline.md
|
||||
- Spiral: specklepy/objects/geometry/Spiral.md
|
||||
- Surface: specklepy/objects/geometry/Surface.md
|
||||
- Vector: specklepy/objects/geometry/Vector.md
|
||||
- Primitives:
|
||||
- Interval: specklepy/objects/primitives/interval.md
|
||||
- Other:
|
||||
- RenderMaterial: specklepy/objects/other/render_material.md
|
||||
- Collection: specklepy/objects/other/collection.md
|
||||
- Proxies:
|
||||
- ColorProxy: specklepy/objects/proxies/ColorProxy.md
|
||||
- GroupProxy: specklepy/objects/proxies/GroupProxy.md
|
||||
- InstanceProxy: specklepy/objects/proxies/InstanceProxy.md
|
||||
- InstanceDefinitionProxy: specklepy/objects/proxies/InstanceDefinitionProxy.md
|
||||
- LevelProxy: specklepy/objects/proxies/LevelProxy.md
|
||||
- RenderMaterialProxy: specklepy/objects/proxies/RenderMaterialProxy.md
|
||||
- Graph Traversal: specklepy/objects/graph_traversal/traversal.md
|
||||
- Transports: specklepy/transports/transports.md
|
||||
- Serialization: specklepy/serialization/serializer.md
|
||||
- Core API:
|
||||
- Models: specklepy/core/api/models/models.md
|
||||
- Inputs: specklepy/core/api/inputs/inputs.md
|
||||
- Enums: specklepy/core/api/enums.md
|
||||
- Logging:
|
||||
- Exceptions: specklepy/logging/exceptions.md
|
||||
- Speckle Automate:
|
||||
- AutomationContext: speckle_automate/automation_context.md
|
||||
- Runner: speckle_automate/runner.md
|
||||
- Schema: speckle_automate/schema.md
|
||||
@@ -1,3 +0,0 @@
|
||||
[build]
|
||||
command = "mise run build_docs"
|
||||
publish = "site"
|
||||
+5
-9
@@ -13,6 +13,10 @@ dependencies = [
|
||||
"deprecated>=1.2.15",
|
||||
"gql[requests,websockets]>=3.5.0,<4.0.0",
|
||||
"httpx>=0.28.1",
|
||||
"mkdocs>=1.6.1",
|
||||
"mkdocs-material>=9.6.5",
|
||||
"mkdocstrings>=0.28.1",
|
||||
"mkdocstrings-python>=1.15.0",
|
||||
"pydantic>=2.10.5",
|
||||
"pydantic-settings>=2.7.1",
|
||||
"ujson>=5.10.0",
|
||||
@@ -22,7 +26,6 @@ dependencies = [
|
||||
speckleifc = ["ifcopenshell>=0.8.3.post2"]
|
||||
|
||||
[dependency-groups]
|
||||
|
||||
dev = [
|
||||
"commitizen>=4.1.0",
|
||||
"devtools>=0.12.2",
|
||||
@@ -33,18 +36,11 @@ dev = [
|
||||
"pytest-asyncio>=0.25.2",
|
||||
"pytest-cov>=6.0.0",
|
||||
"pytest-ordering>=0.6",
|
||||
"pytest_httpserver >=1.1.3",
|
||||
"ruff==0.9.2",
|
||||
"ruff>=0.9.2",
|
||||
"types-deprecated>=1.2.15.20241117",
|
||||
"types-requests>=2.32.0.20241016",
|
||||
"types-ujson>=5.10.0.20240515",
|
||||
]
|
||||
docs = [
|
||||
"mkdocs>=1.6.1",
|
||||
"mkdocs-material>=9.6.5",
|
||||
"mkdocstrings>=0.28.1",
|
||||
"mkdocstrings-python>=1.15.0",
|
||||
]
|
||||
|
||||
[project.urls]
|
||||
repository = "https://github.com/specklesystems/specklepy"
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
::: specklepy.objects.data_objects.DataObject
|
||||
@@ -0,0 +1 @@
|
||||
::: specklepy.objects.data_objects.QgisObject
|
||||
@@ -0,0 +1 @@
|
||||
::: specklepy.objects.interfaces.IBlenderObject
|
||||
@@ -0,0 +1 @@
|
||||
::: specklepy.objects.interfaces.ICurve
|
||||
@@ -0,0 +1 @@
|
||||
::: specklepy.objects.interfaces.IDataObject
|
||||
@@ -0,0 +1 @@
|
||||
::: specklepy.objects.interfaces.IDisplayValue
|
||||
@@ -0,0 +1 @@
|
||||
::: specklepy.objects.interfaces.IBlenderObject
|
||||
@@ -0,0 +1 @@
|
||||
::: specklepy.objects.interfaces.IHasArea
|
||||
@@ -0,0 +1 @@
|
||||
::: specklepy.objects.interfaces.IHasUnits
|
||||
@@ -0,0 +1 @@
|
||||
::: specklepy.objects.interfaces.IHasVolume
|
||||
@@ -0,0 +1 @@
|
||||
::: specklepy.objects.interfaces.IProperties
|
||||
@@ -0,0 +1 @@
|
||||
::: specklepy.objects.base.Base
|
||||
@@ -0,0 +1 @@
|
||||
::: specklepy.objects.geometry.arc.Arc
|
||||
@@ -0,0 +1 @@
|
||||
::: specklepy.objects.geometry.box.Box
|
||||
@@ -0,0 +1 @@
|
||||
::: specklepy.objects.geometry.circle.Circle
|
||||
@@ -0,0 +1 @@
|
||||
::: specklepy.objects.geometry.control_point.ControlPoint
|
||||
@@ -0,0 +1 @@
|
||||
::: specklepy.objects.geometry.ellipse.Ellipse
|
||||
@@ -0,0 +1 @@
|
||||
::: specklepy.objects.geometry.line.Line
|
||||
@@ -0,0 +1 @@
|
||||
::: specklepy.objects.geometry.mesh.Mesh
|
||||
@@ -0,0 +1 @@
|
||||
::: specklepy.objects.geometry.plane.Plane
|
||||
@@ -0,0 +1 @@
|
||||
::: specklepy.objects.geometry.point.Point
|
||||
@@ -0,0 +1 @@
|
||||
::: specklepy.objects.geometry.point_cloud.PointCloud
|
||||
@@ -0,0 +1 @@
|
||||
::: specklepy.objects.geometry.polycurve.Polycurve
|
||||
@@ -0,0 +1 @@
|
||||
::: specklepy.objects.geometry.polyline.Polyline
|
||||
@@ -0,0 +1 @@
|
||||
::: specklepy.objects.geometry.spiral.Spiral
|
||||
@@ -0,0 +1 @@
|
||||
::: specklepy.objects.geometry.surface.Surface
|
||||
@@ -0,0 +1 @@
|
||||
::: specklepy.objects.geometry.vector.Vector
|
||||
|
Before Width: | Height: | Size: 386 B After Width: | Height: | Size: 386 B |
@@ -0,0 +1,29 @@
|
||||
# Introduction
|
||||
|
||||
Welcome to the Specklepy Developer Docs - a single source of documentation on everything Specklepy! If you're looking for info on how to use Speckle, check our [user guide](https://speckle.guide/).
|
||||
|
||||
### Code Repository
|
||||
The Python SDK can be found in our [repository](//github.com/specklesystems/specklepy), its readme contains instructions on how to build it.
|
||||
|
||||
### Installation
|
||||
You can install it using pip
|
||||
```
|
||||
pip install specklepy
|
||||
```
|
||||
|
||||
### Key Components
|
||||
|
||||
SpecklePy has three main parts:
|
||||
|
||||
1. a `SpeckleClient` which allows you to interact with the server API
|
||||
2. `operations` and `transports` for sending and receiving large objects
|
||||
3. a `Base` object and accompaniying serializer for creating and customizing your own Speckle objects
|
||||
|
||||
|
||||
### Local Data Paths
|
||||
|
||||
It may be helpful to know where the local accounts and object cache dbs are stored. Depending on on your OS, you can find the dbs at:
|
||||
|
||||
- Windows: `APPDATA` or `<USER>\AppData\Roaming\Speckle`
|
||||
- Linux: `$XDG_DATA_HOME` or by default `~/.local/share/Speckle`
|
||||
- Mac: `~/.config/Speckle`
|
||||
@@ -0,0 +1 @@
|
||||
::: speckle_automate.automation_context.AutomationContext
|
||||
@@ -0,0 +1,64 @@
|
||||
site_name: Specklepy Docs
|
||||
theme:
|
||||
name: material
|
||||
favicon: assets/speckle_logo.png
|
||||
logo: assets/speckle_logo.png
|
||||
features:
|
||||
- navigation.tabs
|
||||
palette:
|
||||
# Palette toggle for light mode
|
||||
- scheme: default
|
||||
primary: white
|
||||
toggle:
|
||||
icon: material/weather-night
|
||||
name: Switch to dark mode
|
||||
|
||||
# Palette toggle for dark mode
|
||||
- scheme: slate
|
||||
primary: black
|
||||
logo: assets/logo_white.png
|
||||
toggle:
|
||||
icon: material/weather-sunny
|
||||
name: Switch to light mode
|
||||
|
||||
|
||||
|
||||
markdown_extensions:
|
||||
- pymdownx.highlight:
|
||||
anchor_linenums: true
|
||||
line_spans: __span
|
||||
pygments_lang_class: true
|
||||
- pymdownx.inlinehilite
|
||||
- pymdownx.snippets
|
||||
- pymdownx.superfences
|
||||
|
||||
extra_css:
|
||||
- css/mkdocstrings.css
|
||||
|
||||
plugins:
|
||||
- search
|
||||
- mkdocstrings:
|
||||
handlers:
|
||||
python:
|
||||
paths: [.]
|
||||
options:
|
||||
parameter_headings: false
|
||||
members_order: source
|
||||
separate_signature: true
|
||||
filters: ["!^_"] #Ignore _ prefixed properties
|
||||
docstring_options:
|
||||
ignore_init_summary: true
|
||||
merge_init_into_class: true
|
||||
show_signature_annotations: true
|
||||
signature_crossrefs: true
|
||||
show_if_no_docstring: true
|
||||
show_labels: true
|
||||
show_source: true
|
||||
show_symbol_type_heading: true
|
||||
show_symbol_type_toc: true
|
||||
show_bases: false
|
||||
heading_level: 3
|
||||
|
||||
inventories:
|
||||
- url: https://docs.python.org/3/objects.inv
|
||||
domains: [py, std]
|
||||
@@ -19,12 +19,8 @@ from speckle_automate.schema import (
|
||||
from specklepy.api import operations
|
||||
from specklepy.api.client import SpeckleClient
|
||||
from specklepy.core.api.inputs.model_inputs import CreateModelInput
|
||||
from specklepy.core.api.inputs.version_inputs import (
|
||||
CreateVersionInput,
|
||||
MarkReceivedVersionInput,
|
||||
)
|
||||
from specklepy.core.api.inputs.version_inputs import CreateVersionInput
|
||||
from specklepy.core.api.models.current import Model, Version
|
||||
from specklepy.logging import metrics
|
||||
from specklepy.logging.exceptions import SpeckleException
|
||||
from specklepy.objects.base import Base
|
||||
from specklepy.transports.memory import MemoryTransport
|
||||
@@ -70,7 +66,6 @@ class AutomationContext:
|
||||
if isinstance(automation_run_data, AutomationRunData)
|
||||
else AutomationRunData.model_validate_json(automation_run_data)
|
||||
)
|
||||
metrics.set_host_app("automate")
|
||||
speckle_client = SpeckleClient(
|
||||
automation_run_data.speckle_server_url,
|
||||
automation_run_data.speckle_server_url.startswith("https"),
|
||||
@@ -105,7 +100,6 @@ class AutomationContext:
|
||||
"""Receive the Speckle project version that triggered this automation run."""
|
||||
# TODO: this is a quick hack to keep implementation consistency.
|
||||
# Move to proper receive many versions
|
||||
project_id = self.automation_run_data.project_id
|
||||
version_id = self.automation_run_data.triggers[0].payload.version_id
|
||||
try:
|
||||
version = self.speckle_client.version.get(
|
||||
@@ -115,7 +109,7 @@ class AutomationContext:
|
||||
raise ValueError(
|
||||
f"""Could not receive specified version.
|
||||
Is your environment configured correctly?
|
||||
project_id: {project_id}
|
||||
project_id: {self.automation_run_data.project_id}
|
||||
model_id: {self.automation_run_data.triggers[0].payload.model_id}
|
||||
version_id: {self.automation_run_data.triggers[0].payload.version_id}
|
||||
"""
|
||||
@@ -130,13 +124,6 @@ class AutomationContext:
|
||||
base = operations.receive(
|
||||
version.referenced_object, self._server_transport, self._memory_transport
|
||||
)
|
||||
self.speckle_client.version.received(
|
||||
MarkReceivedVersionInput(
|
||||
version_id=version_id,
|
||||
project_id=project_id,
|
||||
source_application="automate_function",
|
||||
)
|
||||
)
|
||||
# self._closure_tree = base["__closure"]
|
||||
print(
|
||||
f"It took {self.elapsed():.2f} seconds to receive",
|
||||
|
||||
@@ -18,7 +18,7 @@ def cmd_line_import() -> None:
|
||||
parser.add_argument("output_path")
|
||||
parser.add_argument("project_id")
|
||||
parser.add_argument("version_message")
|
||||
parser.add_argument("model_ingestion_id")
|
||||
parser.add_argument("model_id")
|
||||
# parser.add_argument("model_name")
|
||||
# parser.add_argument("region_name")
|
||||
|
||||
@@ -32,8 +32,6 @@ def cmd_line_import() -> None:
|
||||
"ifc",
|
||||
)
|
||||
|
||||
client: SpeckleClient | None = None
|
||||
|
||||
try:
|
||||
client = SpeckleClient(SERVER_URL, use_ssl=not SERVER_URL.startswith("http://"))
|
||||
client.authenticate_with_token(TOKEN)
|
||||
@@ -43,14 +41,13 @@ def cmd_line_import() -> None:
|
||||
args.file_path,
|
||||
project,
|
||||
args.version_message,
|
||||
args.model_ingestion_id,
|
||||
args.model_id,
|
||||
client,
|
||||
)
|
||||
with open(args.output_path, "w") as f:
|
||||
json.dump({"success": True, "commitId": version.id}, f)
|
||||
except Exception as e:
|
||||
stack_trace = traceback.format_exc()
|
||||
error_msg = f"IFC Importer failed with exception:\n{stack_trace}"
|
||||
error_msg = f"IFC Importer failed with exception:\n{traceback.format_exc()}"
|
||||
print(error_msg)
|
||||
|
||||
# Write error result
|
||||
|
||||
+34
-100
@@ -1,19 +1,9 @@
|
||||
import contextlib
|
||||
import importlib.metadata
|
||||
import time
|
||||
import traceback
|
||||
from pathlib import Path
|
||||
|
||||
from speckleifc.ifc_geometry_processing import open_ifc
|
||||
from speckleifc.importer import ImportJob
|
||||
from specklepy.core.api.client import SpeckleClient
|
||||
from specklepy.core.api.inputs.model_ingestion_inputs import (
|
||||
ModelIngestionFailedInput,
|
||||
ModelIngestionStartProcessingInput,
|
||||
ModelIngestionSuccessInput,
|
||||
ModelIngestionUpdateInput,
|
||||
SourceDataInput,
|
||||
)
|
||||
from specklepy.core.api.inputs.version_inputs import CreateVersionInput
|
||||
from specklepy.core.api.models.current import Project, Version
|
||||
from specklepy.core.api.operations import send
|
||||
from specklepy.logging import metrics
|
||||
@@ -23,105 +13,49 @@ from specklepy.transports.server import ServerTransport
|
||||
def open_and_convert_file(
|
||||
file_path: str,
|
||||
project: Project,
|
||||
model_ingestion_id: str,
|
||||
version_message: str | None,
|
||||
model_id: str,
|
||||
client: SpeckleClient,
|
||||
) -> Version:
|
||||
try:
|
||||
start = time.time()
|
||||
very_start = start
|
||||
path = Path(file_path)
|
||||
start = time.time()
|
||||
very_start = start
|
||||
|
||||
specklepy_version = importlib.metadata.version("specklepy")
|
||||
client.model_ingestion.start_processing(
|
||||
ModelIngestionStartProcessingInput(
|
||||
project_id=project.id,
|
||||
ingestion_id=model_ingestion_id,
|
||||
progress_message="Importing IFC file",
|
||||
source_data=SourceDataInput(
|
||||
file_name=path.name,
|
||||
file_size_bytes=path.stat().st_size,
|
||||
source_application_slug=metrics.HOST_APP,
|
||||
source_application_version=specklepy_version,
|
||||
),
|
||||
)
|
||||
)
|
||||
account = client.account
|
||||
server_url = account.serverInfo.url
|
||||
assert server_url
|
||||
remote_transport = ServerTransport(project.id, account=account)
|
||||
|
||||
account = client.account
|
||||
server_url = account.serverInfo.url
|
||||
assert server_url
|
||||
remote_transport = ServerTransport(project.id, account=account)
|
||||
ifc_file = open_ifc(file_path) # pyright: ignore[reportUnknownVariableType]
|
||||
|
||||
ifc_file = open_ifc(file_path) # pyright: ignore[reportUnknownVariableType]
|
||||
import_job = ImportJob(ifc_file) # pyright: ignore[reportUnknownArgumentType]
|
||||
data = import_job.convert()
|
||||
|
||||
client.model_ingestion.update_progress(
|
||||
ModelIngestionUpdateInput(
|
||||
project_id=project.id,
|
||||
ingestion_id=model_ingestion_id,
|
||||
progress_message="Converting file",
|
||||
progress=None,
|
||||
)
|
||||
)
|
||||
import_job = ImportJob(ifc_file) # pyright: ignore[reportUnknownArgumentType]
|
||||
data = import_job.convert()
|
||||
print(f"File conversion complete after {(time.time() - start) * 1000}ms")
|
||||
|
||||
print(f"File conversion complete after {(time.time() - start) * 1000}ms")
|
||||
start = time.time()
|
||||
|
||||
start = time.time()
|
||||
root_id = send(data, transports=[remote_transport], use_default_cache=False)
|
||||
print(f"Sending to speckle complete after: {(time.time() - start) * 1000}ms")
|
||||
|
||||
client.model_ingestion.update_progress(
|
||||
ModelIngestionUpdateInput(
|
||||
project_id=project.id,
|
||||
ingestion_id=model_ingestion_id,
|
||||
progress_message="Uploading objects",
|
||||
progress=None,
|
||||
)
|
||||
)
|
||||
root_id = send(data, transports=[remote_transport], use_default_cache=False)
|
||||
print(f"Sending to speckle complete after: {(time.time() - start) * 1000}ms")
|
||||
start = time.time()
|
||||
|
||||
start = time.time()
|
||||
create_version = CreateVersionInput(
|
||||
object_id=root_id,
|
||||
model_id=model_id,
|
||||
project_id=project.id,
|
||||
message=version_message,
|
||||
source_application="ifc",
|
||||
)
|
||||
version = client.version.create(create_version)
|
||||
end = time.time()
|
||||
print(f"Version committed after: {(end - start) * 1000}ms")
|
||||
|
||||
version_id = client.model_ingestion.complete(
|
||||
ModelIngestionSuccessInput(
|
||||
project_id=project.id,
|
||||
ingestion_id=model_ingestion_id,
|
||||
root_object_id=root_id,
|
||||
# version_message=version_message,
|
||||
)
|
||||
)
|
||||
print(f"Total time (to commit): {(end - very_start) * 1000}ms")
|
||||
del ifc_file
|
||||
|
||||
# needed to query version until ingestion api expands to serve it
|
||||
version = client.version.get(version_id, project.id)
|
||||
custom_properties = {"ui": "dui3", "actionSource": "import"}
|
||||
if project.workspace_id:
|
||||
custom_properties["workspace_id"] = project.workspace_id
|
||||
metrics.track(metrics.SEND, account, custom_properties, send_sync=True)
|
||||
|
||||
end = time.time()
|
||||
print(f"Version committed after: {(end - start) * 1000}ms")
|
||||
|
||||
print(f"Total time (to commit): {(end - very_start) * 1000}ms")
|
||||
del ifc_file
|
||||
|
||||
custom_properties = {"ui": "dui3", "actionSource": "import"}
|
||||
if project.workspace_id:
|
||||
custom_properties["workspace_id"] = project.workspace_id
|
||||
|
||||
metrics.track(
|
||||
metrics.SEND,
|
||||
account,
|
||||
custom_properties,
|
||||
send_sync=True,
|
||||
track_email=True,
|
||||
)
|
||||
|
||||
return version
|
||||
except Exception as e:
|
||||
stack_trace = traceback.format_exc()
|
||||
with contextlib.suppress(Exception):
|
||||
# make sure to not report process kills when we're cancelling
|
||||
client.model_ingestion.fail_with_error(
|
||||
ModelIngestionFailedInput(
|
||||
project_id=project.id,
|
||||
ingestion_id=model_ingestion_id,
|
||||
error_reason=str(e),
|
||||
error_stacktrace=stack_trace,
|
||||
)
|
||||
)
|
||||
raise e
|
||||
return version
|
||||
|
||||
@@ -4,7 +4,6 @@ from specklepy.api.credentials import Account
|
||||
from specklepy.api.resources import (
|
||||
ActiveUserResource,
|
||||
FileImportResource,
|
||||
ModelIngestionResource,
|
||||
ModelResource,
|
||||
OtherUserResource,
|
||||
ProjectInviteResource,
|
||||
@@ -120,12 +119,6 @@ class SpeckleClient(CoreSpeckleClient):
|
||||
client=self.httpclient,
|
||||
server_version=server_version,
|
||||
)
|
||||
self.model_ingestion = ModelIngestionResource(
|
||||
account=self.account,
|
||||
basepath=self.url,
|
||||
client=self.httpclient,
|
||||
server_version=server_version,
|
||||
)
|
||||
self.file_import = FileImportResource(
|
||||
account=self.account,
|
||||
basepath=self.url,
|
||||
|
||||
@@ -1,8 +1,5 @@
|
||||
from specklepy.api.resources.current.active_user_resource import ActiveUserResource
|
||||
from specklepy.api.resources.current.file_import_resource import FileImportResource
|
||||
from specklepy.api.resources.current.model_ingestion_resource import (
|
||||
ModelIngestionResource,
|
||||
)
|
||||
from specklepy.api.resources.current.model_resource import ModelResource
|
||||
from specklepy.api.resources.current.other_user_resource import OtherUserResource
|
||||
from specklepy.api.resources.current.project_invite_resource import (
|
||||
@@ -25,6 +22,4 @@ __all__ = [
|
||||
"SubscriptionResource",
|
||||
"VersionResource",
|
||||
"WorkspaceResource",
|
||||
"FileImportResource",
|
||||
"ModelIngestionResource",
|
||||
]
|
||||
|
||||
@@ -15,7 +15,7 @@ from specklepy.logging import metrics
|
||||
|
||||
|
||||
class FileImportResource(CoreResource):
|
||||
"""API Access class for file imports"""
|
||||
"""API Access class for projects"""
|
||||
|
||||
def __init__(self, account, basepath, client, server_version) -> None:
|
||||
super().__init__(
|
||||
|
||||
@@ -1,53 +0,0 @@
|
||||
from specklepy.core.api.inputs.model_ingestion_inputs import (
|
||||
ModelIngestionCancelledInput,
|
||||
ModelIngestionCreateInput,
|
||||
ModelIngestionFailedInput,
|
||||
ModelIngestionRequeueInput,
|
||||
ModelIngestionStartProcessingInput,
|
||||
ModelIngestionSuccessInput,
|
||||
ModelIngestionUpdateInput,
|
||||
)
|
||||
from specklepy.core.api.models.current import (
|
||||
ModelIngestion,
|
||||
)
|
||||
from specklepy.core.api.resources import (
|
||||
ModelIngestionResource as CoreResource,
|
||||
)
|
||||
from specklepy.logging import metrics
|
||||
|
||||
|
||||
class ModelIngestionResource(CoreResource):
|
||||
"""API Access class for model ingestion"""
|
||||
|
||||
def __init__(self, account, basepath, client, server_version) -> None:
|
||||
super().__init__(account, basepath, client, server_version)
|
||||
|
||||
def create(self, input: ModelIngestionCreateInput) -> ModelIngestion:
|
||||
metrics.track(metrics.SDK, self.account, {"name": "Ingestion Create"})
|
||||
return super().create(input)
|
||||
|
||||
def update_progress(self, input: ModelIngestionUpdateInput) -> ModelIngestion:
|
||||
metrics.track(metrics.SDK, self.account, {"name": "Ingestion Update"})
|
||||
return super().update_progress(input)
|
||||
|
||||
def start_processing(
|
||||
self, input: ModelIngestionStartProcessingInput
|
||||
) -> ModelIngestion:
|
||||
metrics.track(metrics.SDK, self.account, {"name": "Ingestion Start Processing"})
|
||||
return super().start_processing(input)
|
||||
|
||||
def requeue(self, input: ModelIngestionRequeueInput) -> ModelIngestion:
|
||||
metrics.track(metrics.SDK, self.account, {"name": "Ingestion Update"})
|
||||
return super().requeue(input)
|
||||
|
||||
def complete(self, input: ModelIngestionSuccessInput) -> str:
|
||||
metrics.track(metrics.SDK, self.account, {"name": "Ingestion End"})
|
||||
return super().complete(input)
|
||||
|
||||
def fail_with_error(self, input: ModelIngestionFailedInput) -> ModelIngestion:
|
||||
metrics.track(metrics.SDK, self.account, {"name": "Ingestion Error"})
|
||||
return super().fail_with_error(input)
|
||||
|
||||
def fail_with_cancel(self, input: ModelIngestionCancelledInput) -> ModelIngestion:
|
||||
metrics.track(metrics.SDK, self.account, {"name": "Ingestion Cancel"})
|
||||
return super().fail_with_cancel(input)
|
||||
@@ -12,7 +12,6 @@ from specklepy.core.api.credentials import Account
|
||||
from specklepy.core.api.resources import (
|
||||
ActiveUserResource,
|
||||
FileImportResource,
|
||||
ModelIngestionResource,
|
||||
ModelResource,
|
||||
OtherUserResource,
|
||||
ProjectInviteResource,
|
||||
@@ -251,12 +250,6 @@ class SpeckleClient:
|
||||
client=self.httpclient,
|
||||
server_version=server_version,
|
||||
)
|
||||
self.model_ingestion = ModelIngestionResource(
|
||||
account=self.account,
|
||||
basepath=self.url,
|
||||
client=self.httpclient,
|
||||
server_version=server_version,
|
||||
)
|
||||
self.subscription = SubscriptionResource(
|
||||
account=self.account,
|
||||
basepath=self.ws_url,
|
||||
|
||||
@@ -30,18 +30,3 @@ class ProjectVersionsUpdatedMessageType(str, Enum):
|
||||
CREATED = "CREATED"
|
||||
DELETED = "DELETED"
|
||||
UPDATED = "UPDATED"
|
||||
|
||||
|
||||
class ProjectModelIngestionUpdatedMessageType(str, Enum):
|
||||
CANCELLATION_REQUESTED = "cancellationRequested"
|
||||
CREATED = "created"
|
||||
DELETED = "deleted"
|
||||
UPDATED = "updated"
|
||||
|
||||
|
||||
class ModelIngestionStatus(str, Enum):
|
||||
CANCELLED = "cancelled"
|
||||
FAILED = "failed"
|
||||
PROCESSING = "processing"
|
||||
QUEUED = "queued"
|
||||
SUCCESS = "success"
|
||||
|
||||
@@ -1,76 +0,0 @@
|
||||
from specklepy.core.api.enums import ProjectModelIngestionUpdatedMessageType
|
||||
from specklepy.core.api.models.graphql_base_model import GraphQLBaseModel
|
||||
|
||||
|
||||
class SourceDataInput(GraphQLBaseModel):
|
||||
source_application_slug: str
|
||||
source_application_version: str
|
||||
file_name: str | None
|
||||
file_size_bytes: int | None
|
||||
|
||||
|
||||
class ModelIngestionCreateInput(GraphQLBaseModel):
|
||||
model_id: str
|
||||
project_id: str
|
||||
progress_message: str
|
||||
source_data: SourceDataInput
|
||||
|
||||
|
||||
class ModelIngestionStartProcessingInput(GraphQLBaseModel):
|
||||
ingestion_id: str
|
||||
project_id: str
|
||||
progress_message: str
|
||||
source_data: SourceDataInput
|
||||
|
||||
|
||||
class ModelIngestionRequeueInput(GraphQLBaseModel):
|
||||
ingestion_id: str
|
||||
project_id: str
|
||||
progress_message: str
|
||||
|
||||
|
||||
class ModelIngestionUpdateInput(GraphQLBaseModel):
|
||||
ingestion_id: str
|
||||
project_id: str
|
||||
progress: float | None
|
||||
progress_message: str
|
||||
|
||||
|
||||
class ModelIngestionSuccessInput(GraphQLBaseModel):
|
||||
ingestion_id: str
|
||||
project_id: str
|
||||
root_object_id: str
|
||||
|
||||
|
||||
class ModelIngestionFailedInput(GraphQLBaseModel):
|
||||
ingestion_id: str
|
||||
project_id: str
|
||||
error_reason: str
|
||||
error_stacktrace: str | None
|
||||
|
||||
|
||||
class ModelIngestionCancelledInput(GraphQLBaseModel):
|
||||
ingestion_id: str
|
||||
project_id: str
|
||||
cancellation_message: str
|
||||
|
||||
|
||||
class ModelIngestionRequestCancellationInput(GraphQLBaseModel):
|
||||
ingestion_id: str
|
||||
project_id: str
|
||||
cancellation_message: str
|
||||
|
||||
|
||||
class ModelIngestionReference(GraphQLBaseModel):
|
||||
"""
|
||||
`@oneOf` i.e. server expects **either** `ingestion_id` or `model_id`, but not both.
|
||||
"""
|
||||
|
||||
ingestion_id: str | None
|
||||
model_id: str | None
|
||||
|
||||
|
||||
class ProjectModelIngestionSubscriptionInput(GraphQLBaseModel):
|
||||
project_id: str
|
||||
ingestion_reference: ModelIngestionReference
|
||||
message_type: ProjectModelIngestionUpdatedMessageType | None = None
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user