Package: jaws-libp
jaws-libpReusable Python classes forJAWSplus admin scripts to setup and manage a deployment.Quick Start with ComposeInstallAPIConfigureBuildDevelopTestReleaseSee AlsoQuick Start with ComposeGrab projectgit clone https://github.com/JeffersonLab/jaws-libp
cd jaws-libpLaunchComposedocker compose upMonitor active alarmsdocker exec -it jaws list_activations --monitorTrip an alarmdocker exec jaws set_activation alarm1Note: The docker-compose services require significant system resources - tested with 4 CPUs and 4GB memory.See:Docker Compose StrategyInstallRequiresPython 3.9+pip install jaws-libpNote: Using newer versions of Python may be problematic because the dependencyconfluent-kafkauses librdkafka, which often does not have a wheel file prepared for later versions of Python, meaning setuptools will attempt to compile it for you, and that often doesn't work (especially on Windows).   Python 3.9 does have a wheel file for confluent-kafka so that's your safest bet.  Wheel files also generally only are prepared for Windows, MacOS, and Linux.  Plus only for architectures x86_64 and arm64, also only for glibc.  If you use with musl libc or linux-aarch64 then you'll likely have to compile librdkafka yourself from source.APISphinx DocsConfigureEnvironment variables are used to configure jaws-libp:NameDescriptionBOOTSTRAP_SERVERHost and port pair pointing to a Kafka server to bootstrap the client connection to a Kafka Cluster; example:kafka:9092SCHEMA_REGISTRYURL to Confluent Schema Registry; example:http://registry:8081The Docker container can optionally handle the following environment variables as well:NameDescriptionALARM_LOCATIONSPath to an alarm locations file to import (example file), else an https URL to a file, else a comma separated list of location definitions with fields separated by the pipe symbol.  Example Inline CSV:name|parentALARM_CATEGORIESPath to an alarm categories file to import (example file), else an https URL to a file, else a comma separated list of catgory definitions with fields.  Example Inline CSV:nameALARM_CLASSESPath to an alarm classes file to import (example file), else an https URL to a file, else a comma separated list of class definitions with fields separated by the pipe symbol.  Example Inline CSV:name|category|priority|rationale|correctiveaction|pointofcontactusername|latching|filterable|ondelayseconds|offdelaysecondsALARM_INSTANCESPath to an alarm instances file to import (example file), else an https URL to a file, else a comma separated list of instance definitions with fields separated by the pipe symbol.  Leave epicspv field empty for SimpleProducer. Example Inline CSV:name|class|epicspv|location|maskedby|screencommandALARM_INSTANCES_URL_CSVIf provided, is a comma separated list of file names to append to ALARM_INSTANCES; ignored if ALARM_INSTANCES doesn't start withhttps;Example.ALARM_OVERRIDESPath to an alarm overrides file to import (example file), else an https URL to a file.BuildThisPython 3.9+project is built withsetuptoolsand may be run using the Pythonvirtual environmentfeature to isolate dependencies.   Thepiptool can be used to download dependencies.git clone https://github.com/JeffersonLab/jaws-libp
cd jaws-libp
python -m venv .venv_dev --upgrade-depsActivate the virtual env using yourshell specific command, then install in editable mode with dev deps and run build:# Windows
.venv_dev\Scripts\activate.bat
# Linux (SH Shell)
source .venv_dev/bin/activate
#MacOS (CSH Shell)
source .venv_dev/bin/activate.csh


pip install -e .[dev]
python -m build
pylint src/jaws_libpNote for JLab On-Site Users: Jefferson Lab has an interceptingproxySee:Python Development NotesDevelopSet up the build environment following theBuildinstructions.In order to iterate rapidly when making changes it's often useful to run the Python scripts directly on the local workstation, perhaps leveraging an IDE.  In this scenario run the service dependencies with Docker Compose:docker compose -f deps.yml upNote: The environment variable defaults work in this scenario and are defined as:BOOTSTRAP_SERVERS=localhost:9094andSCHEMA_REGISTRY=http://localhost:8081TestThe integration tests depend on a running Kafka instance, generally in Docker.  The tests run automatically via theCIGitHub Action on every commit (unless[no ci]is included in the commit message).  The tests can be run locally during development.  Set up the development environment following theDevelopinstructions.  Then with thedeps.ymlDocker containers running and the build virtual environment activated run:pytestReleaseBump the version number in pyproject.toml and commit and push to GitHub (usingSemantic Versioning).Create a new release on the GitHubReleasespage corresponding to same version in pyproject.toml (Enumerate changes and link issues).Publish to PyPiGitHub Action should run automatically.Publish to gh-pagesGitHub Action should run automatically.Publish to DockerHubGitHub Action should run automatically.Bump and commit quick startimage versionafter confirming new image worksSee Alsojaws-libj (Java)Developer Notes