Hey @Speckle_Insider!
If youāre a user of pyspeckle 1.0, youāll probably be excited to hear that pyspeckle 2.0 is currently under development! It is still highly WIP and things might change at a momentās notice, but I would super appreciate it if you wanted to check it out
Itās far from complete, but there are some cool things in the works that you can have a play with. Have a look at the readme for a quick overview of whatās currently there, but hereās a little whistle stop tour:
First off, thereās the client which lets you interact with the serverās GraphQL API
from speckle.api.client import SpeckleClient
from speckle.api.credentials import get_default_account, get_local_accounts
all_accounts = get_local_accounts() # get back a list
account = get_default_account()
client = SpeckleClient(host="localhost:3000", use_ssl=False)
# client = SpeckleClient(host="yourserver.com") or whatever your host is
client.authenticate(account.token)
# create a stream
new_stream_id = client.stream.create(name="a shiny new stream")
# create a commit
commit_id = client.commit.create("stream id", "object id", "this is a commit message to describe the commit")
One key consideration with pyspeckle 2.0 is to provide many of the advanced features from Core as to not ālimitā python devs. To that end, weāve got a Base
object capable of decomposition - and a serializer to handle this! Read more about the Base
object here and the decomposition API here
detached_base = Base()
detached_base.name = "this will get detached"
base_obj = Base()
base_obj.name = "my base"
base_obj["@nested"] = detached_base
serializer = BaseObjectSerializer()
hash, obj_dict = serializer.traverse_base(base_obj)
Weāre also working on transports . Read more about transports here
transport = MemoryTransport()
# this serialises the object and sends it to the transport
hash = operations.send(base=base_obj, transports=[transport])
# if the object had detached objects, you can see these as well
saved_objects = transport.objects # a dict with the obj hash as the key
# this receives and object from the given transport, deserialises it, and recomposes it into a base object
received_base = operations.receive(obj_id=hash, remote_transport=transport)
If you have any comments, feedback, suggestion, or ideas please feel free to add them here or flag an issue in the repo! If you give it a whirl, consider joining us for the next Speckle Community Standup on Wednesday 16 Dec @ 16:30 UK time (announcement post to comeā¦) to let us know what you think / ask any questions face-to-face