9 Commits

Author SHA1 Message Date
dependabot[bot] b8e18ea051 chore(deps): bump actions/checkout from 4.1.1 to 4.1.6 (#21)
build and deploy Speckle functions / publish-automate-function-version (push) Has been cancelled
Bumps [actions/checkout](https://github.com/actions/checkout) from 4.1.1 to 4.1.6.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](https://github.com/actions/checkout/compare/v4.1.1...v4.1.6)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-06-04 11:15:02 +02:00
Gergő Jedlicska bb66e62724 fix: template string needs an f 2024-06-04 11:14:37 +02:00
Gergő Jedlicska 67cb33373b feat: update to new specklepy
build and deploy Speckle functions / publish-automate-function-version (push) Has been cancelled
2024-06-03 16:19:09 +02:00
Gergő Jedlicska 2eec40a4be feat: update to new automate (#22)
build and deploy Speckle functions / publish-automate-function-version (push) Has been cancelled
2024-05-17 14:59:27 +02:00
Jonathon Broughton c0fecb160b Enhance robustness of the basic flatten command (#20)
Older connector versions and still some edge cases in the current set refer to elements with the @ decorator  (Groups in Revit for example)
2024-05-16 18:45:32 +02:00
s 4b9d6b051d added NoneType check (#16) 2024-03-14 12:19:41 +01:00
dependabot[bot] 35ca711c5f chore(deps): bump specklesystems/speckle-automate-github-composite-action (#14)
Bumps [specklesystems/speckle-automate-github-composite-action](https://github.com/specklesystems/speckle-automate-github-composite-action) from 0.8.0 to 0.8.1.
- [Release notes](https://github.com/specklesystems/speckle-automate-github-composite-action/releases)
- [Commits](https://github.com/specklesystems/speckle-automate-github-composite-action/compare/0.8.0...0.8.1)

---
updated-dependencies:
- dependency-name: specklesystems/speckle-automate-github-composite-action
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-03-12 08:42:59 +00:00
Gergő Jedlicska 811bc7f95b fix: update local testing setup (#13) 2024-02-09 11:36:03 +01:00
Gergő Jedlicska 5c0ac4e8e8 feat: bump specklepy version 2024-01-19 19:36:56 +01:00
8 changed files with 509 additions and 471 deletions
+2 -2
View File
@@ -11,7 +11,7 @@ jobs:
FUNCTION_SCHEMA_FILE_NAME: functionSchema.json
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4.1.1
- uses: actions/checkout@v4.1.6
- uses: actions/setup-python@v5
with:
python-version: '3.11'
@@ -29,7 +29,7 @@ jobs:
run: |
python main.py generate_schema ${HOME}/${{ env.FUNCTION_SCHEMA_FILE_NAME }}
- name: Speckle Automate Function - Build and Publish
uses: specklesystems/speckle-automate-github-composite-action@0.8.0
uses: specklesystems/speckle-automate-github-composite-action@0.8.1
with:
speckle_automate_url: ${{ env.SPECKLE_AUTOMATE_URL || 'https://automate.speckle.dev' }}
speckle_token: ${{ secrets.SPECKLE_FUNCTION_TOKEN }}
+1 -1
View File
@@ -6,7 +6,7 @@
"configurations": [
{
"name": "Speckle Automate function",
"type": "python",
"type": "debugpy",
"request": "launch",
"program": "main.py",
"console": "integratedTerminal",
+8 -8
View File
@@ -2,19 +2,19 @@
"speckleToken": "YOUR SPEKCLE TOKEN",
"functionInputs": {
"whisperMessage": "you are doing something weird",
"forbiddenSpeckleType": ""
"forbiddenSpeckleType": "wall"
},
"automationRunData": {
"project_id": "project id",
"model_id": "model id",
"branch_name": "branch name",
"version_id": "version id",
"speckle_server_url": "https://latest.speckle.systems",
"automation_id": "automation id",
"automation_revision_id": "automation revision id",
"automation_run_id": "automation run id",
"function_id": "function id",
"function_name": "function name",
"function_logo": null
"function_run_id": "function run id",
"triggers": [
{
"payload": { "modelId": "model id", "versionId": "version id" },
"triggerType": "versionCreation"
}
]
}
}
+17 -3
View File
@@ -6,8 +6,22 @@ from specklepy.objects import Base
def flatten_base(base: Base) -> Iterable[Base]:
"""Take a base and flatten it to an iterable of bases."""
if hasattr(base, "elements"):
for element in base["elements"]:
"""Flatten a base object into an iterable of bases.
This function recursively traverses the `elements` or `@elements` attribute of the
base object, yielding each nested base object.
Args:
base (Base): The base object to flatten.
Yields:
Base: Each nested base object in the hierarchy.
"""
# Attempt to get the elements attribute, fallback to @elements if necessary
elements = getattr(base, "elements", getattr(base, "@elements", None))
if elements is not None:
for element in elements:
yield from flatten_base(element)
yield base
+1 -1
View File
@@ -59,7 +59,7 @@ def automate_function(
# this is how a run is marked with a failure cause
automate_context.attach_error_to_objects(
category="Forbidden speckle_type"
" ({function_inputs.forbidden_speckle_type})",
f" ({function_inputs.forbidden_speckle_type})",
object_ids=[o.id for o in objects_with_forbidden_speckle_type if o.id],
message="This project should not contain the type: "
f"{function_inputs.forbidden_speckle_type}",
Generated
+458 -450
View File
File diff suppressed because it is too large Load Diff
+1 -1
View File
@@ -7,7 +7,7 @@ readme = "README.md"
[tool.poetry.dependencies]
python = "^3.11"
specklepy = "2.17.16"
specklepy = "^2.19.2"
[tool.poetry.group.dev.dependencies]
black = "^23.3.0"
+21 -5
View File
@@ -1,11 +1,16 @@
"""Run integration tests with a speckle server."""
import os
import secrets
import string
from pydantic import SecretStr
from specklepy.logging.exceptions import SpeckleException
import pytest
from gql import gql
from speckle_automate import (
AutomationContext,
AutomationRunData,
AutomationStatus,
run_function,
@@ -115,6 +120,8 @@ def automation_run_data(
test_object, [ServerTransport(project_id, test_client)]
)
version_id = test_client.commit.create(project_id, root_obj_id)
if isinstance(version_id, SpeckleException):
raise version_id
automation_name = crypto_random_string(10)
automation_id = crypto_random_string(10)
@@ -131,7 +138,7 @@ def automation_run_data(
automation_run_id = crypto_random_string(10)
function_id = crypto_random_string(10)
function_revision = crypto_random_string(10)
return AutomationRunData(
project_id=project_id,
model_id=model_id,
@@ -142,17 +149,26 @@ def automation_run_data(
automation_revision_id=automation_revision_id,
automation_run_id=automation_run_id,
function_id=function_id,
function_revision=function_revision,
function_name=crypto_random_string(10),
function_logo=None,
)
@pytest.makr.skip(
"For now the new automate experience doesn't have an easy testing mechanism"
)
def test_function_run(automation_run_data: AutomationRunData, speckle_token: str):
"""Run an integration test for the automate function."""
automation_context = AutomationContext.initialize(
automation_run_data, speckle_token
)
automate_sdk = run_function(
automation_context,
automate_function,
automation_run_data,
speckle_token,
FunctionInputs(forbidden_speckle_type="Base"),
FunctionInputs(
forbidden_speckle_type="Base",
whisper_message=SecretStr("testing automatically"),
),
)
assert automate_sdk.run_status == AutomationStatus.FAILED