Template: Update to 1.2.7 #1

Merged
perl_d merged 3 commits from update/copier_template42177c12-18cf-4289-a9db-cbbc56391fef into main 2026-02-27 15:58:14 +01:00
27 changed files with 95 additions and 35 deletions

View File

@@ -2,8 +2,8 @@
# It is needed to track the repo template version, and editing may break things.
# This file will be overwritten by copier on template updates.
_commit: v1.2.2
_commit: v1.2.8
_src_path: https://github.com/bec-project/plugin_copier_template.git
make_commit: true
project_name: pearl
project_name: pearl_bec
widget_plugins_input: []

View File

@@ -1,4 +1,4 @@
name: CI for pearl
name: CI for pearl_bec
on:
push:
pull_request:
@@ -28,7 +28,7 @@ on:
description: "Python version to use"
required: false
type: string
default: "3.11"
default: "3.12"
permissions:
pull-requests: write
@@ -44,7 +44,19 @@ jobs:
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: "${{ inputs.PYTHON_VERSION || '3.11' }}"
python-version: "${{ inputs.PYTHON_VERSION || '3.12' }}"
- name: Checkout BEC Plugin Repository
uses: actions/checkout@v4
with:
repository: bec/pearl_bec
ref: "${{ inputs.BEC_PLUGIN_REPO_BRANCH || github.head_ref || github.sha }}"
path: ./pearl_bec
- name: Lint for merge conflicts from template updates
shell: bash
# Find all Copier conflicts except this line
run: '! grep -r "<<<<<<< before updating" | grep -v "grep -r \"<<<<<<< before updating"'
- name: Checkout BEC Core
uses: actions/checkout@v4
@@ -67,13 +79,6 @@ jobs:
ref: "${{ inputs.BEC_WIDGETS_BRANCH || 'main' }}"
path: ./bec_widgets
- name: Checkout BEC Plugin Repository
uses: actions/checkout@v4
with:
repository: bec/pearl
ref: "${{ inputs.BEC_PLUGIN_REPO_BRANCH || github.head_ref || github.sha }}"
path: ./pearl
- name: Install dependencies
shell: bash
run: |
@@ -90,8 +95,8 @@ jobs:
uv pip install --system -e ./bec/bec_ipython_client
uv pip install --system -e ./bec/bec_server[dev]
uv pip install --system -e ./bec_widgets[dev,pyside6]
uv pip install --system -e ./pearl
uv pip install --system -e ./pearl_bec
- name: Run Pytest with Coverage
id: coverage
run: pytest --random-order --cov=./pearl --cov-config=./pearl/pyproject.toml --cov-branch --cov-report=xml --no-cov-on-fail ./pearl/tests/ || test $? -eq 5
run: pytest --random-order --cov=./pearl_bec --cov-config=./pearl_bec/pyproject.toml --cov-branch --cov-report=xml --no-cov-on-fail ./pearl_bec/tests/ || test $? -eq 5

View File

@@ -0,0 +1,62 @@
name: Create template upgrade PR for pearl_bec
on:
workflow_dispatch:
permissions:
pull-requests: write
jobs:
create_update_branch_and_pr:
runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: write
steps:
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: '3.12'
- name: Install tools
run: |
pip install copier PySide6
- name: Checkout
uses: actions/checkout@v4
- name: Perform update
run: |
git config --global user.email "bec_ci_staging@psi.ch"
git config --global user.name "BEC automated CI"
branch="chore/update-template-$(python -m uuid)"
echo "switching to branch $branch"
git checkout -b $branch
echo "Running copier update..."
output="$(copier update --trust --defaults --conflict inline 2>&1)"
echo "$output"
msg="$(printf '%s\n' "$output" | head -n 1)"
if ! grep -q "make_commit: true" .copier-answers.yml ; then
echo "Autocommit not made, committing..."
git add -A
git commit -a -m "$msg"
fi
if diff-index --quiet HEAD ; then
echo "No changes detected"
exit 0
fi
git push -u origin $branch
curl -X POST "https://gitea.psi.ch/api/v1/repos/${{ gitea.repository }}/pulls" \
-H "Authorization: token ${{ secrets.CI_REPO_WRITE }}" \
-H "Content-Type: application/json" \
-d "{
\"title\": \"Template: $(echo $msg)\",
\"body\": \"This PR was created by Gitea Actions\",
\"head\": \"$(echo $branch)\",
\"base\": \"main\"
}"

View File

@@ -1,7 +0,0 @@
include:
- file: /templates/plugin-repo-template.yml
inputs:
name: pearl
target: pearl
branch: $CHILD_PIPELINE_BRANCH
project: bec/awi_utils

View File

@@ -7,7 +7,7 @@ import os
from bec_lib.service_config import ServiceConfig
import pearl
import pearl_bec
def extend_command_line_args(parser):
@@ -23,7 +23,7 @@ def get_config() -> ServiceConfig:
"""
Create and return the ServiceConfig for the plugin repository
"""
deployment_path = os.path.dirname(os.path.dirname(os.path.dirname(pearl.__file__)))
deployment_path = os.path.dirname(os.path.dirname(os.path.dirname(pearl_bec.__file__)))
files = os.listdir(deployment_path)
if "bec_config.yaml" in files:
return ServiceConfig(config_path=os.path.join(deployment_path, "bec_config.yaml"))

View File

@@ -2,5 +2,5 @@
This directory is intended to store macros which will be loaded automatically when starting BEC.
Macros are small functions to make repetitive tasks easier. Functions defined in python files in this directory will be accessible from the BEC console.
Please do not put any code outside of function definitions here. If you wish for code to be automatically run when starting BEC, see the startup script at pearl/bec_ipython_client/startup/post_startup.py
Please do not put any code outside of function definitions here. If you wish for code to be automatically run when starting BEC, see the startup script at pearl_bec/bec_ipython_client/startup/post_startup.py
For a guide on writing macros, please see: https://bec.readthedocs.io/en/latest/user/command_line_interface.html#how-to-write-a-macro

View File

@@ -3,10 +3,10 @@ requires = ["hatchling"]
build-backend = "hatchling.build"
[project]
name = "pearl"
name = "pearl_bec"
version = "0.0.0"
description = "A plugin repository for BEC"
requires-python = ">=3.10"
requires-python = ">=3.11"
classifiers = [
"Development Status :: 3 - Alpha",
"Programming Language :: Python :: 3",
@@ -28,29 +28,29 @@ dev = [
]
[project.entry-points."bec"]
plugin_bec = "pearl"
plugin_bec = "pearl_bec"
[project.entry-points."bec.deployment.device_server"]
plugin_ds_startup = "pearl.deployments.device_server.startup:run"
plugin_ds_startup = "pearl_bec.deployments.device_server.startup:run"
[project.entry-points."bec.file_writer"]
plugin_file_writer = "pearl.file_writer"
plugin_file_writer = "pearl_bec.file_writer"
[project.entry-points."bec.scans"]
plugin_scans = "pearl.scans"
plugin_scans = "pearl_bec.scans"
[project.entry-points."bec.scans.metadata_schema"]
plugin_metadata_schema = "pearl.scans.metadata_schema"
plugin_metadata_schema = "pearl_bec.scans.metadata_schema"
[project.entry-points."bec.ipython_client_startup"]
plugin_ipython_client_pre = "pearl.bec_ipython_client.startup.pre_startup"
plugin_ipython_client_post = "pearl.bec_ipython_client.startup"
plugin_ipython_client_pre = "pearl_bec.bec_ipython_client.startup.pre_startup"
plugin_ipython_client_post = "pearl_bec.bec_ipython_client.startup"
[project.entry-points."bec.widgets.auto_updates"]
plugin_widgets_update = "pearl.bec_widgets.auto_updates"
plugin_widgets_update = "pearl_bec.bec_widgets.auto_updates"
[project.entry-points."bec.widgets.user_widgets"]
plugin_widgets = "pearl.bec_widgets.widgets"
plugin_widgets = "pearl_bec.bec_widgets.widgets"
[tool.hatch.build.targets.wheel]
include = ["*"]