Package: hpl-rv
HPL Runtime VerificationThis project provides tools from which you can build and manage runtime monitors based onHPL properties.InstallationUsageGitHub FeaturesToolingInstallationInstall this package withpip install hpl-rvUsageCode GenerationThis package provides a command line interface from which you can generate runtime monitors with a simple command.# generating monitors from a specification filehpl-rvgen-fmy_spec.hpl# generating monitors directly from propertieshpl-rvgen"globally: no /a"# redirecting the output to a filehpl-rvgen-o./code.py"globally: some /b within 100ms"When used as a library, you can generate Python code for a runtime monitor class with a few simple steps.
For example:fromhplrv.genimportlib_from_propertieshpl_properties=['globally: no (/a or /b)']code:str=lib_from_properties(hpl_properties)print(code)Monitoring DashboardThis package also includes a web-based dashboard that enables live feedback from runtime monitors in a human-friendly format.To execute the web server for this dashboard, run theguicommand:hpl-rvgui--host"127.0.0.1"--port8080Then, open the dashboard client with a web browser (e.g., onhttp://localhost:8080).Through the dashboard, you can connect to runtime monitors to get live feedback.
To enable this feature, though, your runtime monitors should first start the feedback server.For example, for code generated withlib_from_properties(), the main script where these monitors are included should follow roughly the following guidelines.fromthreadingimportThreadfrom.generated_monitorsimportHplMonitorManagerman=HplMonitorManager()man.live_server.host='127.0.0.1'man.live_server.port=4242thread:Thread=man.live_server.start_thread()now:float=0.0man.launch(now)try:# sleep or feed messages to the monitors; example:whileTrue:sleep(1.0)now+=1.0man.on_timer(now)exceptKeyboardInterrupt:passman.shutdown(now)thread.join(10.0)The call tolive_server.start_thread()is what enables the dashboard to get live feedback.GitHub FeaturesThe.githubdirectory comes with a number of files to configure certain GitHub features.Various Issue templates can be found underISSUE_TEMPLATE.A Pull Request template can be found atPULL_REQUEST_TEMPLATE.md.Automatically mark issues as stale after a period of inactivity. The configuration file can be found at.stale.yml.Keep package dependencies up to date with Dependabot. The configuration file can be found atdependabot.yml.Keep Release Drafts automatically up to date with Pull Requests, using theRelease Drafter GitHub Action. The configuration file can be found atrelease-drafter.ymland the workflow atworkflows/release-drafter.yml.Automatic package building and publishing when pushing a new version tag tomain. The workflow can be found atworkflows/publish-package.yml.ToolingThis package sets up varioustoxenvironments for static checks, testing, building and publishing.
It is also configured withpre-commithooks to perform static checks and automatic formatting.If you do not usetox, you can build the package withbuildand install a development version withpip.Assumecdinto the repository's root.To install thepre-commithooks:pre-commitinstallTo run type checking:tox-etypecheckTo run linting tools:tox-elintTo run automatic formatting:tox-eformatTo run tests:toxTo build the package:tox-ebuildTo build the package (withbuild):python-mbuildTo clean the previous build files:tox-ecleanTo test package publication (publish toTest PyPI):tox-epublishTo publish the package to PyPI:tox-epublish----repositorypypiTo install an editable version:pipinstall-e.