Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adapt backend to custom zhinst.comms package #63

Merged
merged 1 commit into from
Jun 13, 2024
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
2 changes: 1 addition & 1 deletion .github/workflows/code_quality.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
strategy:
fail-fast: false
matrix:
python-version: ["3.8", "3.9", "3.10", "3.11"]
python-version: ["3.9", "3.10", "3.11", "3.12"]
steps:
- uses: actions/checkout@v2
- name: Setup Python ${{ matrix.python-version }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
- name: "Setup Python"
uses: "actions/setup-python@v3"
with:
python-version: "3.9"
python-version: "3.11"

- name: "Install build dependencies"
run: |
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,15 @@ jobs:
fail-fast: false
matrix:
include:
- name: py38
python-version: 3.8
- name: py39
python-version: 3.9
- name: py310
python-version: "3.10"
- name: py311
python-version: "3.11"
coverage: true
- name: py312
python-version: "3.12"
steps:
- uses: actions/checkout@v2
- name: Setup Python ${{ matrix.python-version }}
Expand Down
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Labone Python API Changelog

## Version 2.0.0

* Switch to the custom capnp backend `zhinst.comms`. This fixes the stability issues.

## Version 1.1.0

* Introduce `labone.server` which allows spawning capnp servers based on the
Expand Down
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,11 @@ The `labone` package provides a plain asynchronous Python API for [LabOne](https
> Since `labone` is not intended for direct usage, we do not offer any support
> or external documentation. Please contact [Zurich Instruments](mailto:[email protected]) if you have any questions.

## Internal Documentation

The internal documentation can be found [here](http://qt-developer-manual-docs-ed588a9f2798190163c2ddd236b7c23ed753a0.pages.zhinst.com/labone_python/index.html).
Due to the early stage there is not public documentation.

## Contributing

See [Contributing](CONTRIBUTING.md)
42 changes: 21 additions & 21 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ dynamic = ["version"]
description = "Python API for Zurich Instruments LabOne software."
readme = "README.md"
license = { text = "Apache 2.0" }
requires-python = ">=3.8"
requires-python = ">=3.9"
authors = [
{ name = "Zurich Instruments Development Team", email = "[email protected]" },
]
Expand All @@ -19,7 +19,6 @@ classifiers = [
"Intended Audience :: Science/Research",
"License :: OSI Approved :: Apache Software License",
"Operating System :: OS Independent",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
Expand All @@ -29,9 +28,7 @@ classifiers = [
dependencies = [
"typing_extensions>=4.8.0",
"numpy>=1.20",
"pycapnp~=2.0.0b2",
"asyncio-atexit==1.0.1",
"deprecation>=2.1.0",
"zhinst-comms~=0.0.1",
]

[project.urls]
Expand All @@ -53,10 +50,16 @@ exclude = ["/.github", "/docs"]
packages = ["src/labone"]

[[tool.hatch.envs.test.matrix]]
python = ["3.8", "3.9", "3.10", "3.11", "3.12"]
python = ["3.9", "3.10", "3.11", "3.12"]

[tool.hatch.envs.test]
dependencies = ["coverage[toml]>=6.5", "pytest", "hypothesis", "pytest-asyncio"]
dependencies = [
"coverage[toml]>=6.5",
"pytest",
"hypothesis",
"pytest-asyncio",
"munch==4.0.0",
]

[tool.pytest.ini_options]
markers = [
Expand All @@ -77,21 +80,21 @@ cov-report = [
cov = ["test-cov", "cov-report"]

[[tool.hatch.envs.lint.matrix]]
python = ["3.8", "3.9", "3.10", "3.11", "3.12"]
python = ["3.9", "3.10", "3.11", "3.12"]

[tool.hatch.envs.lint]
dependencies = [
"black>=23.1.0",
"mypy>=1.0.0",
"ruff>=0.4.0",
"numpy>=1.20",
"asyncio-atexit==1.0.1",
"zhinst-comms~=0.0.1",
]

[tool.hatch.envs.lint.scripts]
typing = "mypy --install-types --non-interactive {args:src/labone}"
style = ["ruff {args:.}", "black --check --diff {args:.}"]
fmt = ["black {args:.}", "ruff --fix {args:.}", "style"]
style = ["ruff check {args:.}", "black --check --diff {args:.}"]
fmt = ["black {args:.}", "ruff check --fix {args:.}", "style"]
all = ["style", "typing"]

[tool.black]
Expand Down Expand Up @@ -132,9 +135,6 @@ convention = "google"
# Flag errors (`C901`) whenever the complexity level exceeds 15.
max-complexity = 15

[tool.ruff.lint.isort]
known-third-party = ["capnp"]

[tool.ruff.lint.flake8-tidy-imports]
ban-relative-imports = "all"

Expand Down Expand Up @@ -169,11 +169,11 @@ exclude_lines = [
"\\.\\.\\.",
]

[[tool.mypy.overrides]]
module = "capnp.*"
ignore_missing_imports = true
follow_imports = "skip"
# [[tool.mypy.overrides]]
# module = "zhinst.*"
# ignore_missing_imports = true
# follow_imports = "skip"

[[tool.mypy.overrides]]
module = "deprecation"
ignore_missing_imports = true
# [[tool.mypy.overrides]]
# module = "deprecation"
# ignore_missing_imports = true
2 changes: 0 additions & 2 deletions src/labone/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,10 @@
from labone.core import ListNodesFlags
from labone.dataserver import DataServer
from labone.instrument import Instrument
from labone.server.session import SessionFunctionality

__all__ = [
"__version__",
"Instrument",
"DataServer",
"ListNodesFlags",
"SessionFunctionality",
]
26 changes: 17 additions & 9 deletions src/labone/core/__init__.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,21 @@
"""Subpackage for the core functionality of the LabOne API.

This subpackage manages the communication with the LabOne data server through
capnp. It encapsulates the low level logic of the capnp protocol and provides
This subpackage manages the communication with the LabOne data server.
It encapsulates the low level logic of the underlying protocol and provides
a python only interface to the rest of the API.
"""

from labone.core.connection_layer import DeviceKernelInfo, ServerInfo, ZIKernelInfo
from labone.core.kernel_session import KernelSession
from labone.core.session import ListNodesFlags, ListNodesInfoFlags, Session
from labone.core.helper import ZIContext
from labone.core.kernel_session import (
KernelInfo,
KernelSession,
ServerInfo,
)
from labone.core.session import (
ListNodesFlags,
ListNodesInfoFlags,
Session,
)
from labone.core.subscription import (
CircularDataQueue,
DataQueue,
Expand All @@ -17,14 +25,14 @@

__all__ = [
"AnnotatedValue",
"ListNodesFlags",
"ListNodesInfoFlags",
"DataQueue",
"CircularDataQueue",
"DistinctConsecutiveDataQueue",
"Session",
"KernelSession",
"ListNodesFlags",
"ListNodesInfoFlags",
"ZIKernelInfo",
"DeviceKernelInfo",
"ServerInfo",
"KernelInfo",
"ZIContext",
]
Loading
Loading