Metadata-Version: 2.4
Name: async-gpib
Version: 3.2.0
Summary: Python3 AsyncIO Linux GPIB wrapper
Author-email: Patrick Baus <patrick.baus@physik.tu-darmstadt.de>
License-Expression: GPL-3.0-only
Project-URL: Homepage, https://github.com/PatrickBaus/pyAsyncGpib
Project-URL: Bug Tracker, https://github.com/PatrickBaus/pyAsyncGpib/issues
Project-URL: Download, https://github.com/PatrickBaus/pyAsyncGpib/releases
Keywords: linux-gpib,GPIB,API
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: 3.14
Classifier: Programming Language :: Python :: 3.15
Classifier: Development Status :: 5 - Production/Stable
Classifier: Operating System :: OS Independent
Classifier: Intended Audience :: Developers
Classifier: Intended Audience :: Science/Research
Classifier: Natural Language :: English
Classifier: Topic :: Home Automation
Classifier: Topic :: Scientific/Engineering
Classifier: Typing :: Typed
Requires-Python: >=3.12
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: gpib-ctypes~=0.3.0
Provides-Extra: test
Requires-Dist: pytest; extra == "test"
Requires-Dist: pytest-cov; extra == "test"
Provides-Extra: lint
Requires-Dist: async-gpib[test]; extra == "lint"
Requires-Dist: black; extra == "lint"
Requires-Dist: isort; extra == "lint"
Requires-Dist: mypy; extra == "lint"
Requires-Dist: pre-commit; extra == "lint"
Requires-Dist: pylint; extra == "lint"
Requires-Dist: setuptools; extra == "lint"
Provides-Extra: build
Requires-Dist: build; extra == "build"
Requires-Dist: twine; extra == "build"
Provides-Extra: dev
Requires-Dist: async-gpib[build,lint,test]; extra == "dev"
Dynamic: license-file

[![pylint](https://github.com/PatrickBaus/pyAsyncGpib/actions/workflows/pylint.yml/badge.svg)](https://github.com/PatrickBaus/pyAsyncGpib/actions/workflows/pylint.yml)
[![Coverage](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/PatrickBaus/pyAsyncGpib/python-coverage-comment-action-data/endpoint.json)](https://github.com/PatrickBaus/pyAsyncGpib/tree/python-coverage-comment-action-data)
[![PyPI](https://img.shields.io/pypi/v/async-gpib)](https://pypi.org/project/async-gpib/)
![PyPI - Python Version](https://img.shields.io/pypi/pyversions/async-gpib)
![PyPI - Status](https://img.shields.io/pypi/status/async-gpib)
[![License: GPL v3](https://img.shields.io/badge/License-GPL%20v3-blue.svg)](LICENSE)
[![code style](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)
# async_gpib
Python3 asyncio [Linux GPIB Wrapper](https://linux-gpib.sourceforge.io/). The library requires Python 3.12 or newer
and uses [asyncio](https://docs.python.org/3/library/asyncio.html). It is a thin wrapper for the threaded Linux GPIB
Wrapper library.

The library is fully type-hinted.

## Supported Devices

### Instruments
|Device|Supported|Tested|Comments|
|--|--|--|--|
|[Fluke 5440B](https://github.com/PatrickBaus/pyAsyncFluke5440B)|:heavy_check_mark:|:heavy_check_mark:|  |
|[HP 3478A](https://github.com/PatrickBaus/pyAsyncHP3478A)|:heavy_check_mark:|:heavy_check_mark:|  |

## Setup
There are currently no packages for Linux GPIB available on all platforms. To install the library it is required to
install Linux GPIB.

### Linux GPIB:
These instructions are for Ubuntu:
```bash
sudo apt install subversion build-essential autoconf libtool flex bison python3-dev
svn checkout svn://svn.code.sf.net/p/linux-gpib/code/trunk linux-gpib-code
cd ~/linux-gpib-code/linux-gpib-kernel
make
sudo make install  # ignore the signing errors
sudo groupadd gpib  # seems not to be installed
sudo modprobe ni_usb_gpib
cd ~/linux-gpib-code/linux-gpib-user
./bootstrap
./configure --sysconfdir=/etc
make
sudo make install
sudo ldconfig
```

### Linux GPIB Python module:
Once Linux GPIB is installed, you can either install the python package or use the `gpib-ctypes` package.
```bash
python3 -m venv env  # virtual environment, optional
source env/bin/activate
pip install -e ~/linux-gpib-code/linux-gpib-user/language/python/
```

### async_gpib Python module
The package can be directly installed via Pypi:
```bash
python3 -m venv env  # virtual environment, optional
source env/bin/activate
pip install async-gpib
```

## Usage
Initialize the GPIB adapter
```python
from async_gpib import AsyncGpib

# Create a controller and talk to device address 22
async with AsyncGpib(name=0, pad=22) as gpib_device:
    # Add your code here
    ...
```
Errors reported by the GPIB library are raised as `async_gpib.GpibError`, timeouts as `TimeoutError` and calls on a
closed connection as `ConnectionError`.

See [examples/](examples/) for more working examples.

## Support for Multiple Devices
> :warning: **Concurrency with multiple devices**: Note, that when using a single adapter to control multiple devices,
> there is no concurrency on the GPIB bus. This means, there is **no** speed increase, when making asynchronous reads
> from multiple devices on the bus regarding the transfer time.

## Versioning
I use [SemVer](http://semver.org/) for versioning. For the versions available, see the
[tags on this repository](../../tags).

## Documentation
I use the [Numpydoc](https://numpydoc.readthedocs.io/en/latest/format.html) style for documentation.

## Authors
* **Patrick Baus** - *Initial work* - [PatrickBaus](https://github.com/PatrickBaus)

## License
This project is licensed under the GPL v3 license - see the [LICENSE](LICENSE) file for details
