Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
c65e62b
Submodules: created branch with required submodules to match gui_map.…
adedamola-sode Feb 7, 2025
c483466
Submodules: created branch with required submodules to match gui_map.…
adedamola-sode Feb 7, 2025
203ade7
Fix versioning and tox env (#12)
OCopping Feb 7, 2025
0a2734c
Bump the actions group with 2 updates (#11)
dependabot[bot] Feb 7, 2025
2dc95a2
Add intial tests; Make changes to project files to allow for testing
OCopping Feb 11, 2025
4194cd4
Add ruff configuration to vscode settings
OCopping Feb 11, 2025
4c5b146
Add missing -y to apt update in Dockerfile; Fix typo
OCopping Feb 13, 2025
0e1aafc
Update poetry.lock
OCopping Feb 13, 2025
c4b7cdd
Add missing __init__.py from tests/
OCopping Feb 13, 2025
08ef575
Various updates to try and get ci to pass with a more consistent env …
OCopping Feb 14, 2025
9ccaa55
Converted to use PDM over poetry and nicer to configure
OCopping Feb 17, 2025
90bdd68
Move env build to Dockerfile; Remove now unnecessary actions steps
OCopping Feb 17, 2025
a034096
Create devcontainer venv with post-install.sh script
OCopping Feb 21, 2025
b9aa43b
Seperated dataclasses in datatypes from guibuilder
adedamola-sode Feb 7, 2025
3bb50a3
guibuilder.py: create_gui to create_gui_yaml, removed __main__, linti…
adedamola-sode Feb 20, 2025
cd08017
Added git pull to guibuilder, and test
adedamola-sode Feb 26, 2025
e04cb73
Added submodules to gitignore, added git submodule add, added tests
adedamola-sode Feb 26, 2025
9c82477
Changed ssh git pull into https git pull
adedamola-sode Feb 26, 2025
2763b6e
Removed recursive submodules
adedamola-sode Feb 26, 2025
4295f67
Fixed issues with git urls
adedamola-sode Feb 26, 2025
07be562
Merge branch 'main' into submodules
adedamola-sode Feb 26, 2025
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
1 change: 1 addition & 0 deletions .github/workflows/_container.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ jobs:
uses: actions/checkout@v4
with:
# Need this to get version number from last tag
submodules: recursive
fetch-depth: 0

- name: Set up Docker Buildx
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/_tox.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,15 @@ on:
description: What to run under tox
required: true


jobs:
run:
runs-on: "ubuntu-latest"

steps:
- name: Checkout
uses: actions/checkout@v4
with:
submodules: recursive

- name: Install python packages
uses: ./.github/actions/install_requirements
Expand Down
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -69,3 +69,7 @@ lockfiles/

# ruff cache
.ruff_cache/

# submodules
./techui-support/
./*-services/
1 change: 1 addition & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

1 change: 1 addition & 0 deletions .pdm-python
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/workspaces/phoebus-guibuilder/.venv/bin/python
1 change: 1 addition & 0 deletions .python-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
3.12
5 changes: 4 additions & 1 deletion src/phoebus_guibuilder/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@
Version number as calculated by poetry-dynamic-versioning
"""

from phoebus_guibuilder.datatypes import Beamline, Component, Entry
from phoebus_guibuilder.guibuilder import Guibuilder

from ._version import __version__

__all__ = ["__version__"]
__all__ = ["__version__", "Beamline", "Component", "Entry", "Guibuilder"]
9 changes: 6 additions & 3 deletions src/phoebus_guibuilder/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,10 @@
from argparse import ArgumentParser
from collections.abc import Sequence

from . import __version__, guibuilder

from . import __version__
from .guibuilder import Guibuilder


__all__ = ["main"]

Expand All @@ -19,8 +22,8 @@
version=__version__,
)
_args = parser.parse_args(args)

guibuilder.main(_args.filename)
gb = Guibuilder(_args.filename)
gb.extract_from_create_gui()

Check warning on line 26 in src/phoebus_guibuilder/__main__.py

View check run for this annotation

Codecov / codecov/patch

src/phoebus_guibuilder/__main__.py#L25-L26

Added lines #L25 - L26 were not covered by tests


if __name__ == "__main__":
Expand Down
67 changes: 67 additions & 0 deletions src/phoebus_guibuilder/datatypes.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
import re
from dataclasses import dataclass


@dataclass
class Beamline:
dom: str
desc: str


@dataclass
class Entry:
type: str
DESC: str | None
P: str
M: str | None
R: str | None


@dataclass
class Component:
name: str
desc: str
prefix: str
filename: str | None = None

def __post_init__(self):
self._extract_p_and_r()

def __repr__(self) -> str:
return f"Component(name={self.name}, desc={self.desc}, \
prefix={self.P}, suffix={self.R}, filename={self.filename})"

def _extract_p_and_r(self):
pattern = re.compile(
r"""
^ # start of string
(?= # lookahead to ensure the following pattern matches
[A-Za-z0-9-]{14,16} # match 14 to 16 alphanumeric characters or hyphens
[:A-Za-z0-9]* # match zero or more colons or alphanumeric characters
[.A-Za-z0-9] # match a dot or alphanumeric character
)
(?!.*--) # negative lookahead to ensure no double hyphens
(?!.*:\..) # negative lookahead to ensure no colon followed by a dot
( # start of capture group 1
(?:[A-Za-z0-9]{2,5}-){3} # match 2 to 5 alphanumeric characters followed
# by a hyphen, repeated 3 times
[\d]* # match zero or more digits
[^:]? # match zero or one non-colon character
)
(?::([a-zA-Z0-9:]*))? # match zero or one colon followed by zero or more
# alphanumeric characters or colons (capture group 2)
(?:\.([a-zA-Z0-9]+))? # match zero or one dot followed by one or more
# alphanumeric characters (capture group 3)
$ # end of string
""",
re.VERBOSE,
)

match = re.match(pattern, self.prefix)
if match:
self.P: str = match.group(1)
self.R: str = match.group(2)
# TODO: Is this needed?
self.attribute: str | None = match.group(3)
else:
raise AttributeError(f"No valid PV prefix found for {self.name}.")
Loading
Loading