RASCSI/python/common/src
dependabot[bot] 52e4a92aec
Bump black from 22.8.0 to 24.3.0 in /python/web (#1444)
* Bump black from 22.8.0 to 24.3.0 in /python/web

Bumps [black](https://github.com/psf/black) from 22.8.0 to 24.3.0.
- [Release notes](https://github.com/psf/black/releases)
- [Changelog](https://github.com/psf/black/blob/main/CHANGES.md)
- [Commits](https://github.com/psf/black/compare/22.8.0...24.3.0)

---
updated-dependencies:
- dependency-name: black
  dependency-type: direct:development
...

Signed-off-by: dependabot[bot] <support@github.com>

* Github CI: Backend web test runner use python 3.9.19

* Reformat python sources with black

* Docker: Bump to python 3.9-slim image for pytest

* Bump pytest version to 8.1.1

* Bump more library versions, and freeze them

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Daniel Markstedt <daniel@mindani.net>
2024-03-22 00:19:13 -07:00
..
piscsi Bump black from 22.8.0 to 24.3.0 in /python/web (#1444) 2024-03-22 00:19:13 -07:00
util Auto-format Python sources with black, fix all issues reported by flake8 (#1010) 2022-11-30 05:19:17 +00:00
README.md Rebrand project to PiSCSI (#1016) 2022-12-05 09:58:23 -08:00
__init__.py restructuring towards python client library #455 (#613) 2022-01-21 15:08:29 -08:00

README.md

PiSCSI Common Python Module

The common module contains python modules that are shared among multiple Python applications such as the OLED or the Web application. It contains shared functionality. For example, the piscsi python module provides functionality for accessing piscsi through its protobuf interface and provides convenient classes for that purpose.

Usage

To make use of the piscsi python module, it needs to be found by the Python scripts using it. This can be achieved in multiple ways. One way is to simply adapt the PYTHONPATH environment variable to include the common/src directory:

PYTHON_COMMON_PATH=${path_to_common_directory}/common/src
export PYTHONPATH=$PWD:${PYTHON_COMMON_PATH}
python3 myapp.py

The most interesting functions are likely found in the classes PiscsiCmds and FileCmds. Classes can be instantiated, for example, as follows (assuming that piscsi host, piscsi port and token are somehow retrieved from a command line argument):

sock_cmd = SocketCmds(host=args.piscsi_host, port=args.piscsi_port)
piscsi_cmd = PiscsiCmds(sock_cmd=sock_cmd, token=args.token)

Usage examples can be found in the existing PiSCSI Python applications.