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
4 changes: 2 additions & 2 deletions .github/workflows/lint_and_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@ jobs:
uses: ISISComputingGroup/reusable-workflows/.github/workflows/linters.yml@main
with:
compare-branch: origin/main
python-ver: '3.12'
python-ver: '3.14'
unit-tests:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: ["ubuntu-latest", "windows-latest"]
version: ['3.11', '3.12', '3.13']
version: ['3.12', '3.13', '3.14']
fail-fast: false
steps:
- uses: actions/checkout@v7
Expand Down
1 change: 0 additions & 1 deletion doc/conf.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
#
# genie_python documentation build configuration file, created by
# sphinx-quickstart on Tue Aug 19 08:23:25 2014.
Expand Down
11 changes: 7 additions & 4 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ name = "genie_python"
dynamic = ["version"]
description = "Instrument control & scripting for the ISIS Neutron & Muon source"
readme = "README.md"
requires-python = ">=3.11"
requires-python = ">=3.12"
license = "BSD-3-Clause"
license-files = ["LICENSE"]

Expand All @@ -22,9 +22,9 @@ maintainers = [
classifiers = [
"Development Status :: 5 - Production/Stable",
"Intended Audience :: Developers",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
"Programming Language :: Python :: 3.14",
]

dependencies = [
Expand All @@ -50,6 +50,8 @@ dependencies = [
"pyright",
# For setting windows job-object flags
"pywin32;platform_system=='Windows'",
# PVValue definition
"ibex-non-ca-helpers@git+https://github.com/ISISComputingGroup/ibex-non-ca-helpers@pvvalue",

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Needs putting back to a normal pypi release after one is made containing the relevant containing ibex-non-ca-helpers change

]

[project.optional-dependencies]
Expand Down Expand Up @@ -107,7 +109,8 @@ exclude_lines = [
directory = "coverage_html_report"

[tool.pyright]
include = ["src", "tests"]
include = ["src"]
exclude = ["src/genie_python/typings"] # Generated type-stubs
reportConstantRedefinition = true
reportDeprecated = true
reportInconsistentConstructor = true
Expand All @@ -116,7 +119,7 @@ reportMissingTypeArgument = true
reportUnnecessaryCast = true
reportUnnecessaryComparison = true
reportUnnecessaryContains = true
reportUnnecessaryIsInstance = true
reportUnnecessaryIsInstance = false # Users might pass wrong types
reportUntypedBaseClass = true
reportUntypedClassDecorator = true
reportUntypedFunctionDecorator = true
Expand Down
11 changes: 11 additions & 0 deletions ruff.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@ ignore = [
"D407", # Missing dashed underline after section ("{name}")
"N999", # Ignore this because the repo itself would need to be renamed
"ANN401", # explicit ANY type is allowed
"BLE001", # Common pattern throughout this package
"B017", # Common pattern throughout this package
"S110", # Common pattern throughout this package
]
[lint.per-file-ignores]
"tests/*" = [
Expand All @@ -34,6 +37,14 @@ ignore = [
"E501",
"ANN",
]
"*.pyi" = [ # auto-generated type-stubs, don't lint these
"ANN",
"N",
"D",
"E",
"F",
"PYI"
]

[lint.pydocstyle]
# Use Google-style docstrings.
Expand Down
2 changes: 1 addition & 1 deletion src/genie_python/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
from .genie_epics_api import BLOCK_NAMES
from .genie_epics_api import BLOCK_NAMES as BLOCK_NAMES
14 changes: 6 additions & 8 deletions src/genie_python/block_names.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import zlib
from keyword import iskeyword
from threading import RLock, Timer
from typing import TYPE_CHECKING, Optional

from ibex_non_ca_helpers.typing import PVValue

from .channel_access_exceptions import UnableToConnectToPVException
from .genie_blockserver import BLOCK_SERVER_PREFIX, PV_BLOCK_NAMES
Expand All @@ -10,9 +11,6 @@

DELAY_BEFORE_RETRYING_BLOCK_NAMES_PV_ON_FAIL = 30.0

if TYPE_CHECKING:
from genie_python.genie import PVValue


class BlockNamesManager:
"""
Expand Down Expand Up @@ -45,7 +43,7 @@ def update_prefix(self, pv_prefix: str) -> None:
"""

with self.pv_name_lock:
new_name = "{}{}{}".format(pv_prefix, BLOCK_SERVER_PREFIX, PV_BLOCK_NAMES)
new_name = f"{pv_prefix}{BLOCK_SERVER_PREFIX}{PV_BLOCK_NAMES}"
if new_name != self._pv_name:
self._pv_name = new_name
if self._timer is None:
Expand Down Expand Up @@ -84,7 +82,7 @@ def _add_monitor(self) -> None:
self._timer.daemon = True
self._timer.start()

def _update_block_names(self, value: "PVValue", _: Optional[str], _1: Optional[str]) -> None:
def _update_block_names(self, value: "PVValue", _: str | None, _1: str | None) -> None:
"""
Update the block names from a pv
Args:
Expand All @@ -105,7 +103,7 @@ def _update_block_names(self, value: "PVValue", _: Optional[str], _1: Optional[s
for name in block_names:
attribute_name = name
if iskeyword(attribute_name):
attribute_name = "{}__".format(attribute_name)
attribute_name = f"{attribute_name}__"
setattr(self._block_names, attribute_name, name)
except (zlib.error, ValueError, TypeError):
# if we can not decode the blocks then just pass
Expand All @@ -129,7 +127,7 @@ def __getattr__(self, attr: str) -> str:
# letter, e.g. ipython console calls __wrapper__ to check it is not a wrapper
if attr.startswith("_"):
raise AttributeError()
print("WARNING: Block name {} not found, it may not exist".format(attr))
print(f"WARNING: Block name {attr} not found, it may not exist")
if attr.endswith("__") and iskeyword(attr[:-2]):
return str(attr[:-2])
return attr
Loading
Loading