Skip to main content

PySpeckle

A Python Speckle Client

Build Status

Speckle.Works

Speckle: open digital infrastructure for designing, making and operating the built environment. We reimagine the design process from the Internet up: Speckle is an open source (MIT) initiative for developing an extensible Design & AEC data communication and collaboration platform.

Installation

PySpeckle can be installed through pip: pip install speckle

Disclaimer

This code is WIP and as such should be used with caution, on non-sensitive projects.

Description

PySpeckle is a light Python wrapper / interface for the Speckle framework. It can be used independently through Python scripts, or as a base for building various plug-ins, such as SpeckleBlender.

Quick Start

Here is how you initialise a client, authenticate and start speckling:

from speckle import SpeckleApiClient

# Create a client using the appropriate server
client = SpeckleApiClient('hestia.speckle.works')

# Login with your details
client.login(
    email='test@test.com',
    password='Speckle<3Python'
)

# Stream ID to get
stream_id = 'HjenwS2s'

# Get stream data using its ID
stream = client.streams.get(stream_id)

# Print the list of placeholder objects in the stream
for object in stream.objects:
  print(object)

To get a list of all available streams and find a particular one by name:

# Fetch the list of all available streams
streams = client.streams.list()
name = "JetStream"

# Go through the list and find the stream by name
stream = None
for s in streams:
    if s.name == name:
        stream = s
        break

# If the stream is found, fetch the full stream data, using an optional query dict 
# to omit some data
if stream:
    stream_data = client.streams.get(stream.streamId, {'omit':['layers','comments']})

To get object data from a stream:

stream = client.streams.get(streamId)

# Fetch a single object using its placeholder ID
object = client.objects.get(stream.objects[0].id)

# Fetch the objects all at once using an optional query dict
objects = client.objects.get_bulk([o.id for o in stream.objects], {'omit':'base64','displayValue'})

# Print out some object info
for o in objects:
    print("Object {} is type {}".format(o.id, o.type)

To create some data and upload it to a stream:

import speckle.schemas

# Create some mesh data
vertices = [[0,0,0],[1,0,0],[1,1,0], [0,1,0]]
faces = [[0,1,2,3]]

# Create a Speckle Mesh object
sm = speckle.schemas.Mesh()

# Add vertices
for v in vertices:
    sm.vertices.extend(v)

# Add faces
for f in faces:
    if len(f) == 3: # if it is a triangle...
        sm.faces.append(0)
    elif len(f) == 4: # if it is a quad...
        sm.faces.append(1)
    sm.faces.extend(f)

# Give it a nice name
sm.name = "FancyMesh"

# Create the object on the server and receive a list of
# placeholders in return (with only one placeholder)
placeholders = client.objects.create(sm)

# Fetch the stream that we want to update
stream = client.streams.get(streamId)

# Set the stream object list to the created object or
# extend it to add the object to the existing list
stream.objects = placeholders
#stream.objects.extend(placeholders)

# Update the stream with the new data
client.streams.update(stream.streamId, stream)

Usage documentation can be found here.

Maintainers

SpeckleBlender is written and maintained by Tom Svilans (Github), Izzy Lyseggen and Antoine Dao.

Notes

Commit formatting can be found here.

Metadata

Release files for speckle 2.3.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for speckle 2.3.0
File Size Uploaded Provenance Actions
speckle-2.3.0.tar.gz 29.4 kB Without provenance Details for speckle-2.3.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for speckle 2.3.0
File Interpreter ABI Platform Actions
speckle-2.3.0-py3-none-any.whl Python 3 none any Details for speckle-2.3.0-py3-none-any.whl

Total release size: 58.8 kB

Release files / speckle-2.3.0.tar.gz

Download URL speckle-2.3.0.tar.gz
Size 29.4 kB
Tags Source
SHA-256 checksum
How to use checksums
a9f73190d6799ff918217edfd3ba7610b52a4650e5819de1b458cb875a725fb8
BLAKE2b-256 checksum
How to use checksums
cabf481be1c54bcb817cc599b2244ea7a8e4b2939b3a290b36d340c231840295
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.13.0 pkginfo/1.6.1 requests/2.22.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.54.0 CPython/3.6.7

Release files / speckle-2.3.0-py3-none-any.whl

Download URL speckle-2.3.0-py3-none-any.whl
Size 29.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
0f5660cbe3a3323ff62b7330aa4414f84590294158c59a92ca88ad54544a1e44
BLAKE2b-256 checksum
How to use checksums
8b2b5a98258849befbfdb9cca41b532ceaa8d55eafd583e90c8193f341d87b61
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.13.0 pkginfo/1.6.1 requests/2.22.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.54.0 CPython/3.6.7

Security for speckle 2.3.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page