bec-testing-plugin 0.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (44) hide show
  1. bec_testing_plugin-0.1.0/.copier-answers.yml +13 -0
  2. bec_testing_plugin-0.1.0/.git_hooks/post-commit +3 -0
  3. bec_testing_plugin-0.1.0/.git_hooks/pre-commit +3 -0
  4. bec_testing_plugin-0.1.0/.github/workflows/ci.yml +97 -0
  5. bec_testing_plugin-0.1.0/.github/workflows/semantic_release.yml +100 -0
  6. bec_testing_plugin-0.1.0/.gitignore +180 -0
  7. bec_testing_plugin-0.1.0/.gitlab-ci.yml +7 -0
  8. bec_testing_plugin-0.1.0/CHANGELOG.md +35 -0
  9. bec_testing_plugin-0.1.0/LICENSE +29 -0
  10. bec_testing_plugin-0.1.0/PKG-INFO +19 -0
  11. bec_testing_plugin-0.1.0/README.md +5 -0
  12. bec_testing_plugin-0.1.0/bec_testing_plugin/__init__.py +0 -0
  13. bec_testing_plugin-0.1.0/bec_testing_plugin/bec_ipython_client/__init__.py +0 -0
  14. bec_testing_plugin-0.1.0/bec_testing_plugin/bec_ipython_client/high_level_interface/__init__.py +0 -0
  15. bec_testing_plugin-0.1.0/bec_testing_plugin/bec_ipython_client/startup/__init__.py +0 -0
  16. bec_testing_plugin-0.1.0/bec_testing_plugin/bec_ipython_client/startup/post_startup.py +36 -0
  17. bec_testing_plugin-0.1.0/bec_testing_plugin/bec_ipython_client/startup/pre_startup.py +31 -0
  18. bec_testing_plugin-0.1.0/bec_testing_plugin/bec_widgets/__init__.py +0 -0
  19. bec_testing_plugin-0.1.0/bec_testing_plugin/bec_widgets/auto_updates/__init__.py +0 -0
  20. bec_testing_plugin-0.1.0/bec_testing_plugin/bec_widgets/widgets/ExampleWidgetPlugin/ExampleWidgetPlugin.py +23 -0
  21. bec_testing_plugin-0.1.0/bec_testing_plugin/bec_widgets/widgets/ExampleWidgetPlugin/ExampleWidgetPlugin.ui +16 -0
  22. bec_testing_plugin-0.1.0/bec_testing_plugin/bec_widgets/widgets/ExampleWidgetPlugin/ExampleWidgetPlugin_ui.py +34 -0
  23. bec_testing_plugin-0.1.0/bec_testing_plugin/bec_widgets/widgets/ExampleWidgetPlugin/__init__.py +0 -0
  24. bec_testing_plugin-0.1.0/bec_testing_plugin/bec_widgets/widgets/NoUiWidgetPlugin/NoUiWidgetPlugin.py +17 -0
  25. bec_testing_plugin-0.1.0/bec_testing_plugin/bec_widgets/widgets/NoUiWidgetPlugin/__init__.py +0 -0
  26. bec_testing_plugin-0.1.0/bec_testing_plugin/bec_widgets/widgets/__init__.py +0 -0
  27. bec_testing_plugin-0.1.0/bec_testing_plugin/bec_widgets/widgets/client.py +31 -0
  28. bec_testing_plugin-0.1.0/bec_testing_plugin/deployments/__init__.py +0 -0
  29. bec_testing_plugin-0.1.0/bec_testing_plugin/deployments/device_server/__init__.py +0 -0
  30. bec_testing_plugin-0.1.0/bec_testing_plugin/deployments/device_server/startup.py +11 -0
  31. bec_testing_plugin-0.1.0/bec_testing_plugin/device_configs/__init__.py +0 -0
  32. bec_testing_plugin-0.1.0/bec_testing_plugin/devices/__init__.py +0 -0
  33. bec_testing_plugin-0.1.0/bec_testing_plugin/file_writer/__init__.py +0 -0
  34. bec_testing_plugin-0.1.0/bec_testing_plugin/macros/README.md +6 -0
  35. bec_testing_plugin-0.1.0/bec_testing_plugin/macros/__init__.py +0 -0
  36. bec_testing_plugin-0.1.0/bec_testing_plugin/scans/__init__.py +3 -0
  37. bec_testing_plugin-0.1.0/bec_testing_plugin/scans/custom_scan.py +5 -0
  38. bec_testing_plugin-0.1.0/bec_testing_plugin/scans/metadata_schema/__init__.py +0 -0
  39. bec_testing_plugin-0.1.0/bec_testing_plugin/scans/metadata_schema/custom_test_scan_schema.py +6 -0
  40. bec_testing_plugin-0.1.0/bec_testing_plugin/scans/metadata_schema/metadata_schema_registry.py +13 -0
  41. bec_testing_plugin-0.1.0/bec_testing_plugin/scans/metadata_schema/metadata_schema_template.py +34 -0
  42. bec_testing_plugin-0.1.0/bec_testing_plugin/services/__init__.py +0 -0
  43. bec_testing_plugin-0.1.0/bin/.gitignore +1 -0
  44. bec_testing_plugin-0.1.0/pyproject.toml +120 -0
@@ -0,0 +1,13 @@
1
+ # Do not edit this file!
2
+ # It is needed to track the repo template version, and editing may break things.
3
+ # This file will be overwritten by copier on template updates.
4
+
5
+ _commit: v1.2.2
6
+ _src_path: https://github.com/bec-project/plugin_copier_template.git
7
+ make_commit: true
8
+ project_name: bec_testing_plugin
9
+ widget_plugins_input:
10
+ - name: ExampleWidgetPlugin
11
+ use_ui: true
12
+ - name: NoUiWidgetPlugin
13
+ use_ui: false
@@ -0,0 +1,3 @@
1
+ SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
2
+ semantic-release changelog -D version_variable=$SCRIPT_DIR/../../semantic_release/__init__.py:__version__
3
+ semantic-release version -D version_variable=$SCRIPT_DIR/../../semantic_release/__init__.py:__version__
@@ -0,0 +1,3 @@
1
+ black --line-length=100 $(git diff --cached --name-only --diff-filter=ACM -- '*.py')
2
+ isort --line-length=100 --profile=black --multi-line=3 --trailing-comma $(git diff --cached --name-only --diff-filter=ACM -- '*.py')
3
+ git add $(git diff --cached --name-only --diff-filter=ACM -- '*.py')
@@ -0,0 +1,97 @@
1
+ name: CI for bec_testing_plugin
2
+ on:
3
+ push:
4
+ pull_request:
5
+ workflow_dispatch:
6
+ inputs:
7
+ BEC_WIDGETS_BRANCH:
8
+ description: "Branch of BEC Widgets to install"
9
+ required: false
10
+ type: string
11
+ default: "main"
12
+ BEC_CORE_BRANCH:
13
+ description: "Branch of BEC Core to install"
14
+ required: false
15
+ type: string
16
+ default: "main"
17
+ OPHYD_DEVICES_BRANCH:
18
+ description: "Branch of Ophyd Devices to install"
19
+ required: false
20
+ type: string
21
+ default: "main"
22
+ BEC_PLUGIN_REPO_BRANCH:
23
+ description: "Branch of the BEC Plugin Repository to install"
24
+ required: false
25
+ type: string
26
+ default: "main"
27
+ PYTHON_VERSION:
28
+ description: "Python version to use"
29
+ required: false
30
+ type: string
31
+ default: "3.11"
32
+
33
+ permissions:
34
+ pull-requests: write
35
+
36
+ jobs:
37
+ test:
38
+ runs-on: ubuntu-latest
39
+ env:
40
+ QTWEBENGINE_DISABLE_SANDBOX: 1
41
+ QT_QPA_PLATFORM: "offscreen"
42
+
43
+ steps:
44
+ - name: Setup Python
45
+ uses: actions/setup-python@v5
46
+ with:
47
+ python-version: "${{ inputs.PYTHON_VERSION || '3.11' }}"
48
+
49
+ - name: Checkout BEC Core
50
+ uses: actions/checkout@v4
51
+ with:
52
+ repository: bec-project/bec
53
+ ref: "${{ inputs.BEC_CORE_BRANCH || 'main' }}"
54
+ path: ./bec
55
+
56
+ - name: Checkout Ophyd Devices
57
+ uses: actions/checkout@v4
58
+ with:
59
+ repository: bec-project/ophyd_devices
60
+ ref: "${{ inputs.OPHYD_DEVICES_BRANCH || 'main' }}"
61
+ path: ./ophyd_devices
62
+
63
+ - name: Checkout BEC Widgets
64
+ uses: actions/checkout@v4
65
+ with:
66
+ repository: bec-project/bec_widgets
67
+ ref: "${{ inputs.BEC_WIDGETS_BRANCH || 'main' }}"
68
+ path: ./bec_widgets
69
+
70
+ - name: Checkout BEC Plugin Repository
71
+ uses: actions/checkout@v4
72
+ with:
73
+ repository: bec-project/bec_testing_plugin
74
+ ref: "${{ inputs.BEC_PLUGIN_REPO_BRANCH || github.head_ref || github.sha }}"
75
+ path: ./bec_testing_plugin
76
+
77
+ - name: Install dependencies
78
+ shell: bash
79
+ run: |
80
+ sudo apt-get update
81
+ sudo apt-get install -y libgl1 libegl1 x11-utils libxkbcommon-x11-0 libdbus-1-3 xvfb
82
+ sudo apt-get -y install libnss3 libxdamage1 libasound2t64 libatomic1 libxcursor1
83
+
84
+ - name: Install Python dependencies
85
+ shell: bash
86
+ run: |
87
+ pip install uv
88
+ uv pip install --system -e ./ophyd_devices
89
+ uv pip install --system -e ./bec/bec_lib[dev]
90
+ uv pip install --system -e ./bec/bec_ipython_client
91
+ uv pip install --system -e ./bec/bec_server[dev]
92
+ uv pip install --system -e ./bec_widgets[dev]
93
+ uv pip install --system -e ./bec_testing_plugin
94
+
95
+ - name: Run Pytest with Coverage
96
+ id: coverage
97
+ run: pytest --random-order --cov=./bec_testing_plugin --cov-config=./bec_testing_plugin/pyproject.toml --cov-branch --cov-report=xml --no-cov-on-fail ./bec_testing_plugin/tests/ || test $? -eq 5
@@ -0,0 +1,100 @@
1
+ name: Continuous Delivery
2
+
3
+ on:
4
+ push:
5
+ branches:
6
+ - main
7
+
8
+ # default: least privileged permissions across all jobs
9
+ permissions:
10
+ contents: read
11
+
12
+
13
+
14
+ jobs:
15
+ release:
16
+ runs-on: ubuntu-latest
17
+ concurrency:
18
+ group: ${{ github.workflow }}-release-${{ github.ref_name }}
19
+ cancel-in-progress: false
20
+
21
+ env:
22
+ PROJECT_PATH: ${{ github.repository }}
23
+ QTWEBENGINE_DISABLE_SANDBOX: 1
24
+ QT_QPA_PLATFORM: "offscreen"
25
+
26
+ permissions:
27
+ contents: write
28
+
29
+ steps:
30
+ # Note: We checkout the repository at the branch that triggered the workflow
31
+ # with the entire history to ensure to match PSR's release branch detection
32
+ # and history evaluation.
33
+ # However, we forcefully reset the branch to the workflow sha because it is
34
+ # possible that the branch was updated while the workflow was running. This
35
+ # prevents accidentally releasing un-evaluated changes.
36
+ - name: Setup | Checkout Repository on Release Branch
37
+ uses: actions/checkout@v4
38
+ with:
39
+ ref: ${{ github.ref_name }}
40
+ fetch-depth: 0
41
+ ssh-key: ${{ secrets.CI_DEPLOY_SSH_KEY }}
42
+ ssh-known-hosts: ${{ secrets.CI_DEPLOY_SSH_KNOWN_HOSTS }}
43
+
44
+ - name: Set up Python
45
+ uses: actions/setup-python@v5
46
+ with:
47
+ python-version: '3.11'
48
+
49
+ - name: Setup | Force release branch to be at workflow sha
50
+ run: |
51
+ git reset --hard ${{ github.sha }}
52
+ - name: Evaluate | Verify upstream has NOT changed
53
+ # Last chance to abort before causing an error as another PR/push was applied to
54
+ # the upstream branch while this workflow was running. This is important
55
+ # because we are committing a version change (--commit). You may omit this step
56
+ # if you have 'commit: false' in your configuration.
57
+ #
58
+ # You may consider moving this to a repo script and call it from this step instead
59
+ # of writing it in-line.
60
+ shell: bash
61
+ run: |
62
+ set +o pipefail
63
+
64
+ UPSTREAM_BRANCH_NAME="$(git status -sb | head -n 1 | cut -d' ' -f2 | grep -E '\.{3}' | cut -d'.' -f4)"
65
+ printf '%s\n' "Upstream branch name: $UPSTREAM_BRANCH_NAME"
66
+
67
+ set -o pipefail
68
+
69
+ if [ -z "$UPSTREAM_BRANCH_NAME" ]; then
70
+ printf >&2 '%s\n' "::error::Unable to determine upstream branch name!"
71
+ exit 1
72
+ fi
73
+
74
+ git fetch "${UPSTREAM_BRANCH_NAME%%/*}"
75
+
76
+ if ! UPSTREAM_SHA="$(git rev-parse "$UPSTREAM_BRANCH_NAME")"; then
77
+ printf >&2 '%s\n' "::error::Unable to determine upstream branch sha!"
78
+ exit 1
79
+ fi
80
+
81
+ HEAD_SHA="$(git rev-parse HEAD)"
82
+
83
+ if [ "$HEAD_SHA" != "$UPSTREAM_SHA" ]; then
84
+ printf >&2 '%s\n' "[HEAD SHA] $HEAD_SHA != $UPSTREAM_SHA [UPSTREAM SHA]"
85
+ printf >&2 '%s\n' "::error::Upstream has changed, aborting release..."
86
+ exit 1
87
+ fi
88
+
89
+ printf '%s\n' "Verified upstream branch has not changed, continuing with release..."
90
+
91
+ - name: Semantic Version Release
92
+ id: release
93
+ env:
94
+ GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
95
+ run: |
96
+ pip install python-semantic-release==9.* wheel build twine
97
+ semantic-release -vv version
98
+ if [ ! -d dist ]; then echo No release will be made; exit 0; fi
99
+ twine upload dist/* -u __token__ -p ${{ secrets.CI_PYPI_TOKEN }} --skip-existing
100
+ semantic-release publish
@@ -0,0 +1,180 @@
1
+ **/*_venv
2
+ **/.idea
3
+ *.log
4
+ **/__pycache__
5
+ **/.DS_Store
6
+ **/out
7
+ **/.vscode
8
+ **/.pytest_cache
9
+ **/*.egg*
10
+
11
+ # recovery_config files
12
+ recovery_config_*
13
+
14
+ # file writer data
15
+ **.h5
16
+
17
+ # Byte-compiled / optimized / DLL files
18
+ __pycache__/
19
+ *.py[cod]
20
+ *$py.class
21
+
22
+ # C extensions
23
+ *.so
24
+
25
+ # Distribution / packaging
26
+ .Python
27
+ build/
28
+ develop-eggs/
29
+ dist/
30
+ downloads/
31
+ eggs/
32
+ .eggs/
33
+ lib/
34
+ lib64/
35
+ parts/
36
+ sdist/
37
+ var/
38
+ wheels/
39
+ share/python-wheels/
40
+ *.egg-info/
41
+ .installed.cfg
42
+ *.egg
43
+ MANIFEST
44
+
45
+ # PyInstaller
46
+ # Usually these files are written by a python script from a template
47
+ # before PyInstaller builds the exe, so as to inject date/other infos into it.
48
+ *.manifest
49
+ *.spec
50
+
51
+ # Installer logs
52
+ pip-log.txt
53
+ pip-delete-this-directory.txt
54
+
55
+ # Unit test / coverage reports
56
+ htmlcov/
57
+ .tox/
58
+ .nox/
59
+ .coverage
60
+ .coverage.*
61
+ .cache
62
+ nosetests.xml
63
+ coverage.xml
64
+ *.cover
65
+ *.py,cover
66
+ .hypothesis/
67
+ .pytest_cache/
68
+ cover/
69
+
70
+ # Translations
71
+ *.mo
72
+ *.pot
73
+
74
+ # Django stuff:
75
+ *.log
76
+ local_settings.py
77
+ db.sqlite3
78
+ db.sqlite3-journal
79
+
80
+ # Flask stuff:
81
+ instance/
82
+ .webassets-cache
83
+
84
+ # Scrapy stuff:
85
+ .scrapy
86
+
87
+ # Sphinx documentation
88
+ docs/**/_build/
89
+ docs/**/autodoc/
90
+ docs/**/_autosummary/
91
+
92
+ # PyBuilder
93
+ .pybuilder/
94
+ target/
95
+
96
+ # Jupyter Notebook
97
+ .ipynb_checkpoints
98
+
99
+ # IPython
100
+ profile_default/
101
+ ipython_config.py
102
+
103
+ **.prof
104
+
105
+ # pyenv
106
+ # For a library or package, you might want to ignore these files since the code is
107
+ # intended to run in multiple environments; otherwise, check them in:
108
+ # .python-version
109
+
110
+ # pipenv
111
+ # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
112
+ # However, in case of collaboration, if having platform-specific dependencies or dependencies
113
+ # having no cross-platform support, pipenv may install dependencies that don't work, or not
114
+ # install all needed dependencies.
115
+ #Pipfile.lock
116
+
117
+ # poetry
118
+ # Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
119
+ # This is especially recommended for binary packages to ensure reproducibility, and is more
120
+ # commonly ignored for libraries.
121
+ # https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
122
+ #poetry.lock
123
+
124
+ # pdm
125
+ # Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
126
+ #pdm.lock
127
+ # pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
128
+ # in version control.
129
+ # https://pdm.fming.dev/#use-with-ide
130
+ .pdm.toml
131
+
132
+ # PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
133
+ __pypackages__/
134
+
135
+ # Celery stuff
136
+ celerybeat-schedule
137
+ celerybeat.pid
138
+
139
+ # SageMath parsed files
140
+ *.sage.py
141
+
142
+ # Environments
143
+ .env
144
+ .venv
145
+ env/
146
+ venv/
147
+ ENV/
148
+ env.bak/
149
+ venv.bak/
150
+
151
+ # Spyder project settings
152
+ .spyderproject
153
+ .spyproject
154
+
155
+ # Rope project settings
156
+ .ropeproject
157
+
158
+ # mkdocs documentation
159
+ /site
160
+
161
+ # mypy
162
+ .mypy_cache/
163
+ .dmypy.json
164
+ dmypy.json
165
+
166
+ # Pyre type checker
167
+ .pyre/
168
+
169
+ # pytype static type analyzer
170
+ .pytype/
171
+
172
+ # Cython debug symbols
173
+ cython_debug/
174
+
175
+ # PyCharm
176
+ # JetBrains specific template is maintained in a separate JetBrains.gitignore that can
177
+ # be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
178
+ # and can be added to the global gitignore or merged into this file. For a more nuclear
179
+ # option (not recommended) you can uncomment the following to ignore the entire idea folder.
180
+ #.idea/
@@ -0,0 +1,7 @@
1
+ include:
2
+ - file: /templates/plugin-repo-template.yml
3
+ inputs:
4
+ name: bec_testing_plugin
5
+ target: bec_testing_plugin
6
+ branch: $CHILD_PIPELINE_BRANCH
7
+ project: bec/awi_utils
@@ -0,0 +1,35 @@
1
+ # CHANGELOG
2
+
3
+
4
+ ## v0.1.0 (2025-12-09)
5
+
6
+ ### Bug Fixes
7
+
8
+ - Add kwargs to widget plugins
9
+ ([`66ac6c9`](https://github.com/bec-project/bec_testing_plugin/commit/66ac6c9eda5430d5e5ff96571033edd66f8172dd))
10
+
11
+ - Add release pipeline
12
+ ([`9180f34`](https://github.com/bec-project/bec_testing_plugin/commit/9180f34a7e4bdd5e24601cee224581e792294cd3))
13
+
14
+ - Resolve merge conflict
15
+ ([`2ab0c49`](https://github.com/bec-project/bec_testing_plugin/commit/2ab0c493cbf6dab42c0cd6f05f2fe7533c73fb47))
16
+
17
+ ### Chores
18
+
19
+ - Update release config in pyproject
20
+ ([`cfe657b`](https://github.com/bec-project/bec_testing_plugin/commit/cfe657b8fd16eaebba7c2c2ce980ef082433b449))
21
+
22
+ ### Continuous Integration
23
+
24
+ - Rename .gitea to .github
25
+ ([`c3f106f`](https://github.com/bec-project/bec_testing_plugin/commit/c3f106f0e88ec3f2b742078bac63d74cfeaf98df))
26
+
27
+ ### Documentation
28
+
29
+ - Add README
30
+ ([`cc3188f`](https://github.com/bec-project/bec_testing_plugin/commit/cc3188f66f5fddc830ea2f8afe62516739dbb2d9))
31
+
32
+ ### Features
33
+
34
+ - Add a custom scan and metadata schema
35
+ ([`2a95393`](https://github.com/bec-project/bec_testing_plugin/commit/2a95393b1df111fe654f61bd635011b13fba692a))
@@ -0,0 +1,29 @@
1
+
2
+ BSD 3-Clause License
3
+
4
+ Copyright (c) 2025, Paul Scherrer Institute
5
+
6
+ Redistribution and use in source and binary forms, with or without
7
+ modification, are permitted provided that the following conditions are met:
8
+
9
+ 1. Redistributions of source code must retain the above copyright notice, this
10
+ list of conditions and the following disclaimer.
11
+
12
+ 2. Redistributions in binary form must reproduce the above copyright notice,
13
+ this list of conditions and the following disclaimer in the documentation
14
+ and/or other materials provided with the distribution.
15
+
16
+ 3. Neither the name of the copyright holder nor the names of its
17
+ contributors may be used to endorse or promote products derived from
18
+ this software without specific prior written permission.
19
+
20
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
21
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
23
+ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
24
+ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25
+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
26
+ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
27
+ CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
28
+ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
@@ -0,0 +1,19 @@
1
+ Metadata-Version: 2.4
2
+ Name: bec_testing_plugin
3
+ Version: 0.1.0
4
+ Summary: A plugin repository for BEC
5
+ License-File: LICENSE
6
+ Classifier: Development Status :: 3 - Alpha
7
+ Classifier: Programming Language :: Python :: 3
8
+ Classifier: Topic :: Scientific/Engineering
9
+ Requires-Python: >=3.10
10
+ Provides-Extra: dev
11
+ Requires-Dist: bec-server; extra == 'dev'
12
+ Requires-Dist: black; extra == 'dev'
13
+ Requires-Dist: copier; extra == 'dev'
14
+ Requires-Dist: coverage; extra == 'dev'
15
+ Requires-Dist: isort; extra == 'dev'
16
+ Requires-Dist: ophyd-devices; extra == 'dev'
17
+ Requires-Dist: pylint; extra == 'dev'
18
+ Requires-Dist: pytest; extra == 'dev'
19
+ Requires-Dist: pytest-random-order; extra == 'dev'
@@ -0,0 +1,5 @@
1
+ # bec_testing_plugin
2
+
3
+ This is a plugin repository for BEC, created with the [BEC plugin copier template](https://gitea.psi.ch/bec/bec_plugin_copier_template).
4
+ It is intended to host a variety of example plugin features which can be used to develop features in the other BEC
5
+ packages, perform integration testing against, and test out plugin template upgrades.
@@ -0,0 +1,36 @@
1
+ """
2
+ Post startup script for the BEC client. This script is executed after the
3
+ IPython shell is started. It is used to load the beamline specific
4
+ information and to setup the prompts.
5
+
6
+ The script is executed in the global namespace of the IPython shell. This
7
+ means that all variables defined here are available in the shell.
8
+
9
+ While command-line arguments have to be set in the pre-startup script, the
10
+ post-startup script can be used to load beamline specific information and
11
+ to setup the prompts.
12
+
13
+ from bec_lib.logger import bec_logger
14
+
15
+ logger = bec_logger.logger
16
+
17
+ # pylint: disable=import-error
18
+ _args = _main_dict["args"]
19
+
20
+ _session_name = "cSAXS"
21
+ if _args.session.lower() == "lamni":
22
+ from csaxs_bec.bec_ipython_client.plugins.cSAXS import *
23
+ from csaxs_bec.bec_ipython_client.plugins.LamNI import *
24
+
25
+ _session_name = "LamNI"
26
+ lamni = LamNI(bec)
27
+ logger.success("LamNI session loaded.")
28
+
29
+ elif _args.session.lower() == "csaxs":
30
+ print("Loading cSAXS session")
31
+ from csaxs_bec.bec_ipython_client.plugins.cSAXS import *
32
+
33
+ logger.success("cSAXS session loaded.")
34
+ """
35
+
36
+ # pylint: disable=invalid-name, unused-import, import-error, undefined-variable, unused-variable, unused-argument, no-name-in-module
@@ -0,0 +1,31 @@
1
+ """
2
+ Pre-startup script for BEC client. This script is executed before the BEC client
3
+ is started. It can be used to add additional command line arguments.
4
+ """
5
+
6
+ import os
7
+
8
+ from bec_lib.service_config import ServiceConfig
9
+
10
+ import bec_testing_plugin
11
+
12
+
13
+ def extend_command_line_args(parser):
14
+ """
15
+ Extend the command line arguments of the BEC client.
16
+ """
17
+
18
+ # parser.add_argument("--session", help="Session name", type=str, default="cSAXS")
19
+
20
+ return parser
21
+
22
+ def get_config() -> ServiceConfig:
23
+ """
24
+ Create and return the ServiceConfig for the plugin repository
25
+ """
26
+ deployment_path = os.path.dirname(os.path.dirname(os.path.dirname(bec_testing_plugin.__file__)))
27
+ files = os.listdir(deployment_path)
28
+ if "bec_config.yaml" in files:
29
+ return ServiceConfig(config_path=os.path.join(deployment_path, "bec_config.yaml"))
30
+ else:
31
+ return ServiceConfig(redis={"host": "localhost", "port": 6379})
@@ -0,0 +1,23 @@
1
+ from bec_widgets.utils.bec_widget import BECWidget
2
+ from qtpy.QtWidgets import QWidget
3
+
4
+ from bec_testing_plugin.bec_widgets.widgets.ExampleWidgetPlugin.ExampleWidgetPlugin_ui import (
5
+ Ui_examplewidgetplugin,
6
+ )
7
+
8
+
9
+ class Examplewidgetplugin(BECWidget, QWidget, Ui_examplewidgetplugin):
10
+ def __init__(self, parent=None, **kwargs):
11
+ super().__init__(parent=parent, **kwargs)
12
+ self.setupUi(self)
13
+
14
+
15
+ if __name__ == "__main__":
16
+ import sys
17
+
18
+ from qtpy.QtWidgets import QApplication
19
+
20
+ app = QApplication(sys.argv)
21
+ widget = Examplewidgetplugin()
22
+ widget.show()
23
+ sys.exit(app.exec())
@@ -0,0 +1,16 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <ui version="4.0">
3
+ <class>examplewidgetplugin</class>
4
+ <widget class="QWidget" name="examplewidgetplugin">
5
+ <property name="geometry">
6
+ <rect>
7
+ <x>0</x>
8
+ <y>0</y>
9
+ <width>150</width>
10
+ <height>150</height>
11
+ </rect>
12
+ </property>
13
+ </widget>
14
+ <resources/>
15
+ <connections/>
16
+ </ui>
@@ -0,0 +1,34 @@
1
+ # -*- coding: utf-8 -*-
2
+
3
+ ################################################################################
4
+ ## Form generated from reading UI file 'ExampleWidgetPlugin.ui'
5
+ ##
6
+ ## Created by: Qt User Interface Compiler version 6.8.3
7
+ ##
8
+ ## WARNING! All changes made in this file will be lost when recompiling UI file!
9
+ ################################################################################
10
+
11
+ from PySide6.QtCore import (QCoreApplication, QDate, QDateTime, QLocale,
12
+ QMetaObject, QObject, QPoint, QRect,
13
+ QSize, QTime, QUrl, Qt)
14
+ from PySide6.QtGui import (QBrush, QColor, QConicalGradient, QCursor,
15
+ QFont, QFontDatabase, QGradient, QIcon,
16
+ QImage, QKeySequence, QLinearGradient, QPainter,
17
+ QPalette, QPixmap, QRadialGradient, QTransform)
18
+ from PySide6.QtWidgets import (QApplication, QSizePolicy, QWidget)
19
+
20
+ class Ui_examplewidgetplugin(object):
21
+ def setupUi(self, examplewidgetplugin):
22
+ if not examplewidgetplugin.objectName():
23
+ examplewidgetplugin.setObjectName(u"examplewidgetplugin")
24
+ examplewidgetplugin.resize(150, 150)
25
+
26
+ self.retranslateUi(examplewidgetplugin)
27
+
28
+ QMetaObject.connectSlotsByName(examplewidgetplugin)
29
+ # setupUi
30
+
31
+ def retranslateUi(self, examplewidgetplugin):
32
+ pass
33
+ # retranslateUi
34
+
@@ -0,0 +1,17 @@
1
+ from bec_widgets.utils.bec_widget import BECWidget
2
+ from qtpy.QtWidgets import QWidget
3
+
4
+
5
+ class Nouiwidgetplugin(BECWidget, QWidget):
6
+ def __init__(self, parent=None, **kwargs):
7
+ super().__init__(parent=parent, **kwargs)
8
+
9
+ if __name__ == "__main__":
10
+ import sys
11
+
12
+ from qtpy.QtWidgets import QApplication
13
+
14
+ app = QApplication(sys.argv)
15
+ widget = Nouiwidgetplugin()
16
+ widget.show()
17
+ sys.exit(app.exec())
@@ -0,0 +1,31 @@
1
+ # This file was automatically generated by generate_cli.py
2
+ # type: ignore
3
+
4
+ from __future__ import annotations
5
+
6
+ from bec_lib.logger import bec_logger
7
+
8
+ from bec_widgets.cli.rpc.rpc_base import RPCBase, rpc_call
9
+
10
+ logger = bec_logger.logger
11
+
12
+ # pylint: skip-file
13
+
14
+
15
+ _Widgets = {}
16
+
17
+
18
+ class Examplewidgetplugin(RPCBase):
19
+ @rpc_call
20
+ def remove(self):
21
+ """
22
+ Cleanup the BECConnector
23
+ """
24
+
25
+
26
+ class Nouiwidgetplugin(RPCBase):
27
+ @rpc_call
28
+ def remove(self):
29
+ """
30
+ Cleanup the BECConnector
31
+ """
@@ -0,0 +1,11 @@
1
+ import os
2
+
3
+
4
+ def setup_epics_ca():
5
+ # os.environ["EPICS_CA_AUTO_ADDR_LIST"] = "NO"
6
+ # os.environ["EPICS_CA_ADDR_LIST"] = "129.129.122.255 sls-x12sa-cagw.psi.ch:5836"
7
+ os.environ["PYTHONIOENCODING"] = "latin1"
8
+
9
+
10
+ def run():
11
+ setup_epics_ca()
@@ -0,0 +1,6 @@
1
+ # Macros
2
+
3
+ This directory is intended to store macros which will be loaded automatically when starting BEC.
4
+ Macros are small functions to make repetitive tasks easier. Functions defined in python files in this directory will be accessible from the BEC console.
5
+ 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 bec_testing_plugin/bec_ipython_client/startup/post_startup.py
6
+ For a guide on writing macros, please see: https://bec.readthedocs.io/en/latest/user/command_line_interface.html#how-to-write-a-macro
@@ -0,0 +1,3 @@
1
+ from .custom_scan import CustomTestingScan
2
+
3
+ __all__ = ["CustomTestingScan"]
@@ -0,0 +1,5 @@
1
+ from bec_server.scan_server.scans import LineScan
2
+
3
+
4
+ class CustomTestingScan(LineScan):
5
+ scan_name = "custom_testing_scan"
@@ -0,0 +1,6 @@
1
+ from bec_lib.metadata_schema import BasicScanMetadata
2
+
3
+
4
+ class CustomScanSchema(BasicScanMetadata):
5
+ treatment_description: str
6
+ treatment_temperature_k: int
@@ -0,0 +1,13 @@
1
+ # from .metadata_schema_template import ExampleSchema
2
+ from .custom_test_scan_schema import CustomScanSchema
3
+
4
+ METADATA_SCHEMA_REGISTRY = {
5
+ # Add models which should be used to validate scan metadata here.
6
+ # Make a model according to the template, and import it as above
7
+ # Then associate it with a scan like so:
8
+ "custom_testing_scan": CustomScanSchema
9
+ }
10
+
11
+ # Define a default schema type which should be used as the fallback for everything:
12
+
13
+ DEFAULT_SCHEMA = None
@@ -0,0 +1,34 @@
1
+ # # By inheriting from BasicScanMetadata you can define a schema by which metadata
2
+ # # supplied to a scan must be validated.
3
+ # # This schema is a Pydantic model: https://docs.pydantic.dev/latest/concepts/models/
4
+ # # but by default it will still allow you to add any arbitrary information to it.
5
+ # # That is to say, when you run a scan with which such a model has been associated in the
6
+ # # metadata_schema_registry, you can supply any python dictionary with strings as keys
7
+ # # and built-in python types (strings, integers, floats) as values, and these will be
8
+ # # added to the experiment metadata, but it *must* contain the keys and values of the
9
+ # # types defined in the schema class.
10
+ # #
11
+ # #
12
+ # # For example, say that you would like to enforce recording information about sample
13
+ # # pretreatment, you could define the following:
14
+ # #
15
+ #
16
+ # from bec_lib.metadata_schema import BasicScanMetadata
17
+ #
18
+ #
19
+ # class ExampleSchema(BasicScanMetadata):
20
+ # treatment_description: str
21
+ # treatment_temperature_k: int
22
+ #
23
+ #
24
+ # # If this was used according to the example in metadata_schema_registry.py,
25
+ # # then when calling the scan, the user would need to write something like:
26
+ # >>> scans.example_scan(
27
+ # >>> motor,
28
+ # >>> 1,
29
+ # >>> 2,
30
+ # >>> 3,
31
+ # >>> metadata={"treatment_description": "oven overnight", "treatment_temperature_k": 575},
32
+ # >>> )
33
+ #
34
+ # # And the additional metadata would be saved in the HDF5 file created for the scan.
@@ -0,0 +1 @@
1
+ # Add anything you don't want to check in to git, e.g. very large files
@@ -0,0 +1,120 @@
1
+ [build-system]
2
+ requires = ["hatchling"]
3
+ build-backend = "hatchling.build"
4
+
5
+ [project]
6
+ name = "bec_testing_plugin"
7
+ version = "0.1.0"
8
+ description = "A plugin repository for BEC"
9
+ requires-python = ">=3.10"
10
+ classifiers = [
11
+ "Development Status :: 3 - Alpha",
12
+ "Programming Language :: Python :: 3",
13
+ "Topic :: Scientific/Engineering",
14
+ ]
15
+ dependencies = []
16
+
17
+ [project.optional-dependencies]
18
+ dev = [
19
+ "black",
20
+ "copier",
21
+ "isort",
22
+ "coverage",
23
+ "pylint",
24
+ "pytest",
25
+ "pytest-random-order",
26
+ "ophyd_devices",
27
+ "bec_server",
28
+ ]
29
+
30
+ [project.entry-points."bec"]
31
+ plugin_bec = "bec_testing_plugin"
32
+
33
+ [project.entry-points."bec.deployment.device_server"]
34
+ plugin_ds_startup = "bec_testing_plugin.deployments.device_server.startup:run"
35
+
36
+ [project.entry-points."bec.file_writer"]
37
+ plugin_file_writer = "bec_testing_plugin.file_writer"
38
+
39
+ [project.entry-points."bec.scans"]
40
+ plugin_scans = "bec_testing_plugin.scans"
41
+
42
+ [project.entry-points."bec.scans.metadata_schema"]
43
+ plugin_metadata_schema = "bec_testing_plugin.scans.metadata_schema"
44
+
45
+ [project.entry-points."bec.ipython_client_startup"]
46
+ plugin_ipython_client_pre = "bec_testing_plugin.bec_ipython_client.startup.pre_startup"
47
+ plugin_ipython_client_post = "bec_testing_plugin.bec_ipython_client.startup"
48
+
49
+ [project.entry-points."bec.widgets.auto_updates"]
50
+ plugin_widgets_update = "bec_testing_plugin.bec_widgets.auto_updates"
51
+
52
+ [project.entry-points."bec.widgets.user_widgets"]
53
+ plugin_widgets = "bec_testing_plugin.bec_widgets.widgets"
54
+
55
+ [tool.isort]
56
+ profile = "black"
57
+ line_length = 100
58
+ multi_line_output = 3
59
+ include_trailing_comma = true
60
+
61
+ [tool.black]
62
+ line-length = 100
63
+ skip-magic-trailing-comma = true
64
+
65
+ [tool.pylint.basic]
66
+ # Good variable names regexes, separated by a comma. If names match any regex,
67
+ # they will always be accepted
68
+ good-names-rgxs = [
69
+ ".*scanID.*",
70
+ ".*RID.*",
71
+ ".*pointID.*",
72
+ ".*ID.*",
73
+ ".*_2D.*",
74
+ ".*_1D.*",
75
+ ]
76
+
77
+ [tool.hatch.build.targets.wheel]
78
+ include = ["*"]
79
+ exclude = ["docs/**", "tests/**"]
80
+
81
+ [tool.hatch.build.targets.sdist]
82
+ include = ["*"]
83
+ exclude = ["docs/**", "tests/**"]
84
+
85
+ [tool.semantic_release]
86
+ build_command = "pip install build wheel && python -m build"
87
+ version_toml = ["pyproject.toml:project.version"]
88
+
89
+ [tool.semantic_release.commit_author]
90
+ env = "GIT_COMMIT_AUTHOR"
91
+ default = "semantic-release <semantic-release>"
92
+
93
+ [tool.semantic_release.commit_parser_options]
94
+ allowed_tags = [
95
+ "build",
96
+ "chore",
97
+ "ci",
98
+ "docs",
99
+ "feat",
100
+ "fix",
101
+ "perf",
102
+ "style",
103
+ "refactor",
104
+ "test",
105
+ ]
106
+ minor_tags = ["feat"]
107
+ patch_tags = ["fix", "perf"]
108
+ default_bump_level = 0
109
+
110
+ [tool.semantic_release.remote]
111
+ name = "origin"
112
+ type = "github"
113
+ ignore_token_for_push = true
114
+
115
+ [tool.semantic_release.remote.token]
116
+ env = "GH_TOKEN"
117
+
118
+ [tool.semantic_release.publish]
119
+ dist_glob_patterns = ["dist/*"]
120
+ upload_to_vcs_release = true