Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
17 changes: 17 additions & 0 deletions .flake8
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
[flake8]
ignore = E203, W503, W505, F722, F811
exclude =
.git,
__pycache__,
.pytest_cache,
build,
dist,
info,
logs,
pid,
.vscode,
.venv,
.secop-ophyd,
cfg/*,
docs,
max-line-length = 88
59 changes: 17 additions & 42 deletions .github/workflows/code.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,26 +13,14 @@ env:

jobs:

lint:
name: Lint Codebase
pre-commit:
name: Static Code Checks
# pull requests are a duplicate of a branch push if within the same repo.
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name != github.repository
runs-on: ubuntu-latest

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

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

- name: Lint
run: |
tox -e pre-commit,mypy


- uses: actions/checkout@v4
- uses: pre-commit/[email protected]


test:
Expand All @@ -47,28 +35,26 @@ jobs:

steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4

- name: Install uv and set the python version
uses: astral-sh/setup-uv@v6
with:
python-version: ${{ matrix.python-version }}



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

run: uv sync --all-extras

- name: Add PATH envirnoment variable for xprocess
run: |
pip freeze
echo "PATH_VAR=$PATH" >> "$GITHUB_ENV"
- name: Run Tests

- name: Run Tests
run: |
tox -e pytest
uv run pytest tests/ -v


build:
name: Build distribution 📦
runs-on: ubuntu-latest
Expand Down Expand Up @@ -97,7 +83,7 @@ jobs:
name: >-
Publish to PyPI
if: ${{startsWith(github.ref, 'refs/tags/')}} # only publish to PyPI on tag pushes
needs: [lint,test,build]
needs: [pre-commit,test,build]
runs-on: ubuntu-latest
environment:
name: pypi
Expand All @@ -113,14 +99,3 @@ jobs:
path: dist/
- name: Publish distribution 📦 to PyPI
uses: pypa/gh-action-pypi-publish@release/v1











2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ dist
**/_version.py
pid
logs
.secop-ophyd
.secop-ophyd
3 changes: 3 additions & 0 deletions .isort.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[settings]
profile=black
line_length = 88
8 changes: 8 additions & 0 deletions .mypy.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
[mypy]
# Ignore missing stubs in imported modules
ignore_missing_imports = true
#plugins = ["numpy.typing.mypy_plugin"]
check_untyped_defs = true
exclude = [
'^cfg'
]
58 changes: 29 additions & 29 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,39 +1,39 @@
repos:

- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v5.0.0
rev: v6.0.0
hooks:
- id: check-added-large-files
- id: check-yaml
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-ast
- id: check-case-conflict
- id: check-merge-conflict

- repo: local
hooks:
- id: black
name: Run black
stages: [pre-commit]
language: system
entry: black --check --diff src tests
types: [python]
exclude: |
(?x)^(
cfg/|
frappy_modules/|
logs/|
pid/
)
- id: check-yaml
- id: debug-statements

- repo: https://github.com/pycqa/flake8
rev: '7.2.0' # You can use a more recent version if available
rev: 6.1.0
hooks:
- id: flake8
additional_dependencies: [flake8-pyproject]
args: [src, tests, docs]
exclude: |
(?x)^(
cfg/|
frappy_modules/|
logs/|
pid/
)

- repo: https://github.com/PyCQA/isort
rev: 6.0.1
hooks:
- id: isort

- repo: https://github.com/psf/black
rev: 25.1.0
hooks:
- id: black

- repo: https://github.com/kynan/nbstripout
rev: 0.5.0
hooks:
- id: nbstripout

- repo: https://github.com/pre-commit/mirrors-mypy
rev: 'v1.18.2' # Use the sha / tag you want to point at
hooks:
- id: mypy
args: [--config-file=.mypy.ini]
exclude: ^cfg/
2 changes: 1 addition & 1 deletion .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@
//"postDebugTask": "stop server"
}
]
}
}
12 changes: 6 additions & 6 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"python.testing.pytestArgs": [
"tests/."
"tests"
],
"python.testing.unittestEnabled": false,
"python.testing.pytestEnabled": true,
Expand All @@ -16,10 +16,10 @@









}




}
4 changes: 2 additions & 2 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"label": "start server",
"type": "shell",
"isBackground": true,
//"command":"pwd",
//"command":"pwd",
"command": "python",
"args": ["${workspaceFolder}/frappy/bin/frappy-server","-c","${workspaceFolder}/frappy/cfg/cryo_cfg.py","cryo"],
"presentation": { "reveal": "silent" },
Expand Down Expand Up @@ -34,4 +34,4 @@
"command": "workbench.action.tasks.terminate",
"args": "terminateAll"
}]
}
}
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ This package allows seamless itegration of hardware that provides a SECoP interf



## Getting Started
## Getting Started
A demo repository that shows the full functionality of the integration is provided here:

[secop-sim](https://codebase.helmholtz.cloud/rock-it-secop/secop-sim)
Expand Down
3 changes: 1 addition & 2 deletions cfg/cryo_cfg.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,14 @@
import sys

# Get project root from environment variable
project_root = os.environ.get('FRAPPY_PROJECT_ROOT')
project_root = os.environ.get("FRAPPY_PROJECT_ROOT")

# If project_root is provided and it's a valid directory, add it to sys.path
if project_root and os.path.isdir(project_root):
if project_root not in sys.path:
sys.path.insert(0, project_root)



Node(
"cryo_7.frappy.demo",
"short description\n\n"
Expand Down
3 changes: 1 addition & 2 deletions cfg/ophyd_secop_test_cfg.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import sys

# Get project root from environment variable
project_root = os.environ.get('FRAPPY_PROJECT_ROOT')
project_root = os.environ.get("FRAPPY_PROJECT_ROOT")

# If project_root is provided and it's a valid directory, add it to sys.path
if project_root and os.path.isdir(project_root):
Expand All @@ -28,7 +28,6 @@
"test module for reading String signals in Bluesky RE",
group="test",
value="blah",

)


Expand Down
6 changes: 3 additions & 3 deletions frappy_modules/cryo.py
Original file line number Diff line number Diff line change
Expand Up @@ -289,11 +289,11 @@ def __sim(self):
timestamp = time.time()
heater = 0
lastflow = 0
last_heaters = (0, 0)
last_heaters = (0.0, 0.0)
delta = 0
_I = _D = 0
lastD = 0
damper = 1
damper = 1.0
lastmode = self.mode
while not self._stopflag:
t = time.time()
Expand Down Expand Up @@ -393,7 +393,7 @@ def __sim(self):
else:
# self.heaterpower is set manually, not by pid
heater = self.heater
last_heaters = (0, 0)
last_heaters = (0.0, 0.0)

heater = round(heater, 1)
sample = newsample
Expand Down
Loading