Labbench

Latest version: v0.42.0

Safety actively analyzes 681866 Python packages for vulnerabilities to keep your Python projects secure.

Scan your dependencies

Page 2 of 7

0.35.1

Added
- Paramattr now supports a new boolean keyword argument, `inherit`, which takes
defaults for the other paramattr keyword arguments from the paramattr in the parent
of the owning class. This is meant to replace the role of `labbench.paramattr.adjusted`,
which did not update the type hints properly for default values of Device constructors.
- `lb.shell_options_from_keyed_values` has been separated from its private implementation in
`lb.ShellBackend`, and given options to better generalize its applicability. It generates
lists of command line option strings based on descriptors defined with `key`.

Changed
- Corrected bugs in the simplified display of tracebacks
- Fixed a bug in network address string validation
- Reduced module import time through better use of lazy loading
- Fixed an argument passing bug in `labbench.VISADevice.query_ascii_values`
- The default VISA resource manager is now 'ivi' if an underlying library is available
- `labbench.ShellBackend` no longer supports dict arguments. Instead, use `lb.shell_options_from_keyed_values`
to generate a list of strings.
- `labbench.ShellBackend` no longer has a `binary_path` configuration value. Users of `labbench.ShellBackend` should
now explicitly pass the binary name (either path or object in the system PATH) to `labbench.ShellBackend.run()`.
- The existence of the `resource` value descriptor has been removed from `labbench.Device`, and is now only
included explicitly in subclasses that require connection information
- All `labbench.paramattr.value` descriptors now support the `kw_only` argument. For descriptors that are annotated
in owning classes for use as constructor argument, this determines whether the argument should be treated as
keyword-only (as opposed to "keyword or positional" that allows positional arguments).
- multiple inheritance is now supported for paramattr descriptors in `labbench.Device` and `labbench.paramattr.HasParamAttrs`

Deprecated
- `labbench.paramattr.adjusted`, due to type hinting bugs

Removed
- `labbench.HDFLogger`, which was not used and which was unable to pass tests or store metadata in a portable way
- `labbench.util.LabbenchDeprecationWarning`, an unused stub

0.34.0

Changed
- In order to better align `labbench.paramattr.property` and `labbench.paramattr.method` with each other and the rest of the ecosystem,
decorator implementation for these attributes now follows [python's built-in syntax for properties](https://docs.python.org/3/library/functions.html#property). For example, to implement getters and setters for a property named `number` or a method named `flag`:
python
import labbench as lb
from labbench import paramattr as attr

class MyDevice(lb.Device):
attr.property.float(min=0)
def number(self) -> float:
...

number.setter
def _(self, new_value: float):
...

attr.method.bool()
def flag(self):
...

flag.setter
def _(self, new_value: bool):
...

- Fixed bounds-checking bugs in calibration-corrected parameter attributes
- Because notifications are required to properly implement calibration corrections, the `notify` constructor argument of paramattr has been replaced with `log`. The scope of that behavior now limited to (and implemented by) the loggers.
- `labbench.paramattr.kwarg` is now `labbench.paramattr.method_kwarg`, in order to clarify the intent when decorating a device class
- Switched to hatch for project management, integrating testing across python versions

Removed
- `labbench.paramattr.register_key_argument` was removed in favor of directly decorating Device classes with `labbench.paramattr.method_kwarg`

0.33.0

This is a significant API change.

Added
- `labbench.Win32ComDevice.concurrency` (bool value), which controls whether to allow multi-threaded access to the COM library

Changed
- The various types of descriptors supported by Device objects are now known as parameter attributes.
Before, they were called traits. They are encapsulated within the `labbench.paramattr` module.
The definition syntax for existing is otherwise similar:

python
import labbench as lb
from labbench import paramattr as attr

class MyDevice(lb.Device):
frequency: float = attr.value.float(5e9, min=10e6, max=6e9)


Note that the annotation is now required in order to set the parameter on instantiation

- Two new types of `paramattr` descriptors are now available: `method` and `kwarg`. Methods
correspond with callable methods in the owning class. Like `labbench.paramattr.property`
descriptors, `method` descriptors support keyed auto-generation using the `key` argument.
- Fix an exception handling bug in `lb.sequentially`
- Dependency on `coloredlogs` has been removed
- Documentation text and layout improvements
- Tests are now implemented with `pytest` instead of `unittest`, and include coverage analysis.
A runner is available through `pdm tests`, and a badge is linked to in `README.md`.
- `labbench.VISADevice` now supports shortcut connection specifications in addition to standard VISA resource names:
1. Serial number strings
2. Empty resource strings for subclasses that specify `make` and `model`
- python 3.12 installation is now enabled
- `paramattr.method` and `paramattr.property` now support a new keyword argument, `get_on_set`, which triggers
a get operation in the owner device immediately after each set
- `paramattr` descriptors now support a new keyword argument, `notify`, which allows notifications to be disabled

Removed
- `labbench.Device.concurrency`, which was only used by `labbench.Win32ComDevice` (and where it has been added)

0.32

Changed
- Device properties ("private properties") with leading underscore names are no longer automatically
included in output tables. They can still be logged by manually specifying them for logging, for example
`.observe(always=["_property_name"])`.
- `VISADevice.query` now supports a `remap` argument to apply the return value remap as specified by `property.visa_keying`
- Add a boolean `recheck` argument for property declarations that triggers an immediate `get` after each `set`.
This accommodates instruments which perform adjustments of values on the fly.
- Fixes for uncommon multithreading import bugs related to lazy loading

0.31

Changed
- By default, the string mapping for `labbench.VISADevice` boolean properties is now "ON" and "OFF" based on the majority of cases in `ssmdevices`

0.30

Added

Changed
- The instrument drivers in the documentation guide are now self-contained by use of `pyvisa-sim`` backends
- `VISABackend._rm` is now a simple class attribute rather than a trait, so that changes to it propagate to subclasses
- `pyvisa-sim` is now a dependency for development (but not a requirement when installing labbench as a package)
- Cleanups in `VISABackend` and trait debug messages
- Corrected a bug where context entry into a Rack objects missed entry Device objects that had the same name in different Rack children
- Corrected a bug where Rack the full ownership wasn't being properly indicated in log messages
- Removed "options" from `VISABackend`, leaving it to be implemented per-instrument
- Removed unecessary extra writes to output table in `CSVLogger`
- Switched to lazy loading for expensive imports (instead of imports within function namespaces)

Removed
- `SimulatedVISABackend` - instead, use `VISABackend` after calling `visa_default_resource_manager('my-file.ymlsim')`
- `ConfigStore` - this never found traction after 3 years

Page 2 of 7

© 2024 Safety CLI Cybersecurity Inc. All Rights Reserved.