This is a template repository for a Speckle Automate functions written in python using the specklepy SDK to interact with Speckle data.
This template contains the full scaffolding required to publish a function to the automate environment. Also has some sane defaults for a development environment setups.
- Use this template repository to create a new repository in your own / organization's profile.
Register the function
To add new python package dependencies to the project, use:
$ poetry add pandas
describe how the launch.json should be edited
create new repo from template, and use the create new code
This is a simple example of how to use the Speckle Automate Python package to automate the creation of a Speckle stream.
- Create a new Speckle Automation.
- Select your Speckle Project and Speckle Model.
- Select the existing Speckle Function named
Random comment on IFC beam. - Enter a phrase to use in the comment.
- Click
Create Automation.
- Fork this repository.
- Clone your forked repository to your development environment, or use GitHub CodeSpaces.
- Register your Function with Speckle Automate.
- After completing the registration of the Function you will be shown a Function Publish Token and a Function ID. You will need these later.
- Save your Function Publish Token as a GitHub Action Secret named
SPECKLE_AUTOMATE_FUNCTION_PUBLISH_TOKEN. - Save your Function ID as a GitHub Action Secret named
SPECKLE_AUTOMATE_FUNCTION_ID. - Make changes to your Function in
main.py. See below for the Developer Requirements, and instructions on how to test. - Every commit to
mainbranch will create a new version of your Speckle Function.
- Install the following:
- Run
poetry shell && poetry installto install the required Python packages.
The code can be tested locally by running poetry run pytest.
The code should also be packaged into the format required by Speckle Automate, a Docker Container Image, and that should also be tested.
- Learn more about SpecklePy, and interacting with Speckle from Python.