Skip to content
Merged
Show file tree
Hide file tree
Changes from 11 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 0 additions & 25 deletions .bumpversion.cfg

This file was deleted.

59 changes: 59 additions & 0 deletions .github/workflows/yak_publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
name: publish_yak

on:
workflow_dispatch:
inputs:
environment:
description: "Choose deployment environment"
required: true
type: choice
options:
- test
- prod

jobs:

publish_test_yak:
runs-on: windows-latest

steps:

- name: Set test flag based on input
shell: pwsh
run: |
if ("${{ github.event.inputs.environment }}" -eq "test") {
echo "TEST_FLAG=--test-server" | Out-File -FilePath $env:GITHUB_ENV -Append
}
else {
echo "TEST_FLAG=" | Out-File -FilePath $env:GITHUB_ENV -Append
}

- name: Checkout repo
uses: actions/checkout@v4

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -e .[dev]

- name: Create CPython Grasshopper user objects
run: |
invoke build-cpython-ghuser-components

- name: Create Rhino8 Yak package
shell: pwsh
run: |
invoke yakerize -m $Env:YAK_TEMPLATE\manifest.yml -l $Env:YAK_TEMPLATE\icon.png -g $Env:USER_OBJECTS -t rh8
env:
USER_OBJECTS: src\compas_eve\ghpython\components\ghuser
YAK_TEMPLATE: src\compas_eve\ghpython\yak_template

- name: Publish to Yak server (Rhino 8)
shell: pwsh
run: |
$test_flag = if ($Env:TEST_FLAG) { $Env:TEST_FLAG } else { "" }
$file = Get-ChildItem -Path dist\yak_package\*rh8*.yak -File | Select-Object -ExpandProperty Name
$command = "invoke publish-yak -y dist\yak_package\$file $test_flag".Trim()
Invoke-Expression $command
env:
YAK_TOKEN: ${{ secrets.YAK_DF_TOKEN }}
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Removed

* Removed Rhino7 Grasshopper components and replaces them with Rhino8 ones.

## [2.0.0] 2025-10-30

Expand Down
41 changes: 38 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ requires = ["setuptools>=66.0"]
build-backend = "setuptools.build_meta"

# ============================================================================
# project info
# Project info
# ============================================================================

[project]
Expand Down Expand Up @@ -33,6 +33,11 @@ classifiers = [
"Programming Language :: Python :: 3.14",
]

[tool.setuptools.dynamic]
version = { attr = "compas_eve.__version__" }
dependencies = { file = "requirements.txt" }
optional-dependencies = { dev = { file = "requirements-dev.txt" } }

[project.entry-points.'compas_pb.plugins']
serializers = 'compas_eve.codecs.conversions'

Expand All @@ -46,7 +51,7 @@ Forum = "https://forum.compas-framework.org/"


# ============================================================================
# setuptools config
# Linting and formatting
# ============================================================================

[tool.ruff]
Expand Down Expand Up @@ -99,4 +104,34 @@ max-doc-length = 179

[tool.ruff.format]
docstring-code-format = true
docstring-code-line-length = "dynamic"
docstring-code-line-length = "dynamic"

# ============================================================================
# Release automation
# ============================================================================

[tool.bumpversion]
current_version = "2.0.0"
message = "Bump version to {new_version}"
commit = true
tag = true

[[tool.bumpversion.files]]
filename = "src/compas_eve/__init__.py"
search = "{current_version}"
replace = "{new_version}"

[[tool.bumpversion.files]]
filename = "docs/installation.rst"
search = "{current_version}"
replace = "{new_version}"

[[tool.bumpversion.files]]
glob = "src/compas_eve/ghpython/components/**/code.py"
search = "# r: compas_eve>={current_version}"
replace = "# r: compas_eve>={new_version}"

[[tool.bumpversion.files]]
filename = "CHANGELOG.md"
search = "Unreleased"
replace = "[{new_version}] {now:%Y-%m-%d}"
3 changes: 2 additions & 1 deletion requirements-dev.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,5 @@ pytest-mock
ruff
sphinx_compas2_theme
twine
wheel
wheel
pythonnet
76 changes: 0 additions & 76 deletions setup.py

This file was deleted.

2 changes: 1 addition & 1 deletion src/compas_eve/codecs/conversions.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
from compas_pb.registry import pb_deserializer
from compas_pb.registry import pb_serializer

from compas_eve.proto import message_pb2
from compas_eve import Message
from compas_eve.proto import message_pb2


@pb_serializer(Message)
Expand Down
65 changes: 64 additions & 1 deletion src/compas_eve/ghpython/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,72 @@
:nosignatures:
BackgroundWorker
warning
error
remark
message
"""

try:
import Grasshopper # type: ignore
except (ImportError, SyntaxError):
Copy link

Copilot AI Nov 4, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

'except' clause does nothing but pass and there is no explanatory comment.

Suggested change
except (ImportError, SyntaxError):
except (ImportError, SyntaxError):
# Grasshopper is only available in Rhino/Grasshopper environments.
# Ignore import errors to allow this module to be imported elsewhere.

Copilot uses AI. Check for mistakes.
pass


from .background import BackgroundWorker

__all__ = ["BackgroundWorker"]

def warning(component, message):
"""Add a warning message to the component.
Parameters
----------
component : Grasshopper.Kernel.IGH_Component
The component instance. Pre-Rhino8 use `self`. Post-Rhino8 use `ghenv.Component`.
message : str
The message to display.
"""
component.AddRuntimeMessage(Grasshopper.Kernel.GH_RuntimeMessageLevel.Warning, message)


def error(component, message):
"""Add an error message to the component.
Parameters
----------
component : Grasshopper.Kernel.IGH_Component
The component instance. Pre-Rhino8 use `self`. Post-Rhino8 use `ghenv.Component`.
message : str
The message to display.
"""
component.AddRuntimeMessage(Grasshopper.Kernel.GH_RuntimeMessageLevel.Error, message)


def remark(component, message):
"""Add a remark message to the component.
Parameters
----------
component : Grasshopper.Kernel.IGH_Component
The component instance. Pre-Rhino8 use `self`. Post-Rhino8 use `ghenv.Component`.
message : str
The message to display.
"""
component.AddRuntimeMessage(Grasshopper.Kernel.GH_RuntimeMessageLevel.Remark, message)


def message(component, message):
"""Add a text that will appear under the component.
Parameters
----------
component : Grasshopper.Kernel.IGH_Component
The component instance. Pre-Rhino8 use `self`. Post-Rhino8 use `ghenv.Component`.
message : str
The message to display.
"""
component.Message = message


__all__ = ["BackgroundWorker", "warning", "error", "remark", "message"]
7 changes: 4 additions & 3 deletions src/compas_eve/ghpython/components/Ce_BackgroundTask/code.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# r: compas_eve>=2.0.0
"""
Background Task component.

Expand All @@ -7,16 +8,16 @@
"""

import threading

import Grasshopper
import scriptcontext as sc

from compas_eve.ghpython import BackgroundWorker
from ghpythonlib.componentbase import executingcomponent as component


DEBUG = False


class BackgroundTaskComponent(component):
class BackgroundTaskComponent(Grasshopper.Kernel.GH_ScriptInstance):
def RunScript(self, task, reset, on):
if not on:
BackgroundWorker.stop_instance_by_component(ghenv) # noqa: F821
Expand Down
10 changes: 4 additions & 6 deletions src/compas_eve/ghpython/components/Ce_Message/code.py
Original file line number Diff line number Diff line change
@@ -1,18 +1,16 @@
# r: compas_eve>=2.0.0
"""
Create a message.

COMPAS EVE v2.0.0
"""

import System

import Rhino.Geometry as rg
import rhinoscriptsyntax as rs

import System
from compas.geometry import Brep
from compas_eve import Message
from compas_rhino import conversions

from compas_eve import Message

component = ghenv.Component # noqa: F821

local_values = locals()
Expand Down
Loading