Skip to content
Closed
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
2 changes: 2 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
.git_archival.txt export-subst
# SCM syntax highlighting & preventing 3-way merges
pixi.lock merge=binary linguist-language=YAML linguist-generated=true -diff
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ jobs:
strategy:
fail-fast: false
matrix:
python-version: ["3.8", "3.9", "3.10", "3.11"]
python-version: ["3.10", "3.11", "3.12", "3.13"]
# runs-on: [ubuntu-latest, macos-latest, windows-latest]
runs-on: [ubuntu-latest]

Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -156,3 +156,6 @@ Thumbs.db
# Common editor files
*~
*.swp
# pixi environments
.pixi/*
!.pixi/config.toml
15 changes: 8 additions & 7 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@ ci:

repos:
- repo: https://github.com/adamchainz/blacken-docs
rev: "1.16.0"
rev: "1.20.0"
hooks:
- id: blacken-docs
additional_dependencies: [black==23.*]

- repo: https://github.com/pre-commit/pre-commit-hooks
rev: "v4.6.0"
rev: "v6.0.0"
hooks:
- id: check-added-large-files
- id: check-case-conflict
Expand Down Expand Up @@ -40,7 +40,7 @@ repos:
args: [--prose-wrap=always]

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: "v0.4.5"
rev: "v0.15.12"
hooks:
- id: ruff
args: ["--fix", "--show-fixes"]
Expand All @@ -56,12 +56,13 @@ repos:
# - pytest

- repo: https://github.com/codespell-project/codespell
rev: "v2.3.0"
rev: "v2.4.2"
hooks:
- id: codespell
exclude: pixi\.lock

- repo: https://github.com/shellcheck-py/shellcheck-py
rev: "v0.10.0.1"
rev: "v0.11.0.1"
hooks:
- id: shellcheck

Expand All @@ -74,13 +75,13 @@ repos:
exclude: .pre-commit-config.yaml

- repo: https://github.com/abravalheri/validate-pyproject
rev: "v0.18"
rev: "v0.25"
hooks:
- id: validate-pyproject
additional_dependencies: ["validate-pyproject-schema-store[all]"]

- repo: https://github.com/python-jsonschema/check-jsonschema
rev: "0.28.4"
rev: "0.37.2"
hooks:
- id: check-dependabot
- id: check-github-workflows
Expand Down
7,287 changes: 7,287 additions & 0 deletions pixi.lock

Large diffs are not rendered by default.

22 changes: 22 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -171,3 +171,25 @@ messages_control.disable = [
"missing-module-docstring",
"wrong-import-position",
]

[tool.pixi.workspace]
channels = ["conda-forge"]
platforms = ["osx-arm64", "linux-64"]

[tool.pixi.pypi-dependencies]
srx-caproto-iocs = { path = ".", editable = true }

[tool.pixi.environments]
default = { solve-group = "default" }
dev = { features = ["dev"], solve-group = "default" }
docs = { features = ["docs"], solve-group = "default" }
test = { features = ["test"], solve-group = "default" }

[tool.pixi.tasks]

[tool.pixi.feature.dev.dependencies]
pre-commit = ">=4.6.0,<5"
pytest = ">=9.0.3,<10"
python = "3.12.*"
nexpy = ">=2.0.1,<3"
epics-base = ">=7.0.9.0,<8"
6 changes: 2 additions & 4 deletions src/srx_caproto_iocs/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ def saver(request_queue, response_queue):
data = received["data"]
frame_number = received["frame_number"]
try:
save_hdf5_nd(fname=filename, data=data, mode="x", group_path="enc1")
save_hdf5_nd(fname=filename, data=data, mode="a", group_path="enc1")
print(
f"{now()}: saved {frame_number=} {data.shape} data into:\n {filename}"
)
Expand Down Expand Up @@ -272,9 +272,7 @@ def set(self, command):
def cb(value, old_value, **kwargs):
# pylint: disable=unused-argument
# print(f"{now()}: {old_value} -> {value}")
if value == expected_new_value and old_value == expected_old_value:
return True
return False
return value == expected_new_value and old_value == expected_old_value

st = SubscriptionStatus(obj, callback=cb, run=False)
# print(f"{now()}: {cmd = }")
Expand Down
4 changes: 2 additions & 2 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ def base_caproto_ioc(wait=5):
print(f"STDERR:\n{sep}\n{std_err}")


@pytest.fixture()
@pytest.fixture
def base_ophyd_device():
dev = OphydDeviceWithCaprotoIOC(
OPHYD_PV_PREFIX, name="ophyd_device_with_caproto_ioc"
Expand Down Expand Up @@ -106,7 +106,7 @@ def caproto_ioc_channel_types(wait=5):
print(f"STDERR:\n{sep}\n{std_err}")


@pytest.fixture()
@pytest.fixture
def ophyd_channel_types():
dev = OphydChannelTypes(OPHYD_PV_PREFIX, name="ophyd_channel_type")
letters = iter(string.ascii_letters)
Expand Down
8 changes: 4 additions & 4 deletions tests/test_base_ophyd.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,13 @@
from srx_caproto_iocs.utils import now


@pytest.mark.cloud_friendly()
@pytest.mark.cloud_friendly
@pytest.mark.parametrize(
"date_template", ["%Y/%m/", "%Y/%m/%d", "mydir/%Y/%m/%d", "disguised_spaces_%c"]
)
def test_base_ophyd_templates(
base_caproto_ioc, base_ophyd_device, date_template, num_frames=50, remove=False
):
def test_base_ophyd_templates(base_caproto_ioc, base_ophyd_device, date_template):
num_frames = 50
remove = False
tmpdirname = f"/tmp/srx-caproto-iocs/{str(uuid.uuid4())[:2]}"
date = now(as_object=True)
write_dir_root = Path(tmpdirname)
Expand Down
10 changes: 5 additions & 5 deletions tests/test_string_ioc.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
STRING_LONGER = string.ascii_letters


@pytest.mark.cloud_friendly()
@pytest.mark.cloud_friendly
@pytest.mark.parametrize("value", [STRING_39, STRING_LONGER])
def test_strings(
caproto_ioc_channel_types,
Expand Down Expand Up @@ -47,8 +47,8 @@ def test_strings(
ophyd_channel_types.char_type.put(value)


@pytest.mark.cloud_friendly()
@pytest.mark.needs_epics_core()
@pytest.mark.cloud_friendly
@pytest.mark.needs_epics_core
def test_cainfo(caproto_ioc_channel_types, ophyd_channel_types):
for cpt in sorted(ophyd_channel_types.component_names):
command = ["cainfo", getattr(ophyd_channel_types, cpt).pvname]
Expand All @@ -74,8 +74,8 @@ def test_cainfo(caproto_ioc_channel_types, ophyd_channel_types):
assert "Native data type: DBF_CHAR" in stdout


@pytest.mark.cloud_friendly()
@pytest.mark.needs_epics_core()
@pytest.mark.cloud_friendly
@pytest.mark.needs_epics_core
@pytest.mark.parametrize("value", [STRING_39, STRING_LONGER])
def test_caput(caproto_ioc_channel_types, ophyd_channel_types, value):
option = ""
Expand Down
Loading