Skip to main content

A DSL to define and enforce governance policies

This repository contains the definition of a domain-specific language (DSL) for governance policies (the engine for the enforcement of the policies is available here). We provide details below for the contents of this repository. The DSL provides a form-based editor, available here.

Contents

The repository structure is divided in five folders:

  • governancedsl/grammar/: This folder contains the definition of the grammar, or concrete syntax, of our DSL. We used ANTLR to define our concrete syntax, see govdsl.g4 for the implementation.
  • governancedsl/metamodel/: This folder contains the metamodel of the abstract syntax of our DSL:
    • metamodel.py: The implementation of the abstract syntax metamodel as Python classes.
    • ocl_constraints.ocl: Set of OCL constraints applied to the metamodel (OCL constraints are also included in the BESSER diagrams).
    • Since the metamodel has been created using the BESSER Web Modeling Editor we provide several files under metamodel/besser_models/ folder:
      • .json files: The JSON representation that can be used to open the metamodel in the editor.
      • .svg and .png files: The SVG and PNG representation for visual purposes.
      • .drawio.png files: We also provide the metamodel embedded in a PNG file that can be opened in the draw.io editor.
  • governancedsl/utils/: This folder contains additional support for the definitions of exceptions, extensions of our metamodel (e.g., code-hosting platform extension), and data structure support for the parser.
  • UI/: This folder contains a Gradio-based form editor for creating governance policies interactively:
    • See UI/README.md for detailed information.
    • The form-based editor is available here.
  • tests/: This folder contains the tests. There are three subfolders inside the test_cases/ for the examples:
    • invalid_examples/: Here we define with our DSL different invalid policies (e.g., the required number of votes is negative).
    • NL_examples: Here we define the examples in natural language, which can come from existing repositories (NL_examples/real-world/ folder) or created from us (NL_examples/artifical/).
    • valid_examples: Here we define with our DSL different valid policies, which can also come from NL_examples/.

Tests

When contributing to incorporate new tests in natural language (NL_examples/) we recommend using the following template:

Original repo: URL (or we can also report "owner/name" if repository is from GitHub)
Access date: Date you accessed the repository
Reporter: -
Policy: If multiple, enter a new line for each.

Prerequisite

  • Python 3.11
  • Recommended: Create a virtual environment (e.g. venv, conda)
  • Clone this repository
  • Install the dependencies by referencing to the requirements files:
pip install -r requirements.txt

Run Tests

From the project root directory, run all tests with:

python -m unittest tests.test_policy_creation -v

Or run a specific test:

python -m unittest tests.test_policy_creation.testPolicyCreation.test_majority_policy_creation -v

Note: Make sure you're in the project root directory when running the tests to ensure proper module imports.

Metadata

Release files for governancedsl 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for governancedsl 0.1.1
File Size Uploaded
governancedsl-0.1.1.tar.gz 63.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for governancedsl 0.1.1
File Interpreter ABI Platform
governancedsl-0.1.1-py3-none-any.whl Python 3 none any Details

Total release size: 120.6 kB

Release files / governancedsl-0.1.1.tar.gz

Download URL governancedsl-0.1.1.tar.gz
Size 63.5 kB
Tags Source
SHA-256 checksum
How to use checksums
9187d4fae1511b992bfb6bf004f134b385c061ff6e0d603bc36916feaa9e7dfa
BLAKE2b-256 checksum
How to use checksums
ff60deae10c25a4ff9e0ea1a38f4424381c4e17fa21ca1cca7d708b5c34715b8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.13

Release files / governancedsl-0.1.1-py3-none-any.whl

Download URL governancedsl-0.1.1-py3-none-any.whl
Size 57.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
5af29aa97efb6e6bc2a855a9f6defbc144f679df21d02d1aeb05c5172c4026dc
BLAKE2b-256 checksum
How to use checksums
d97def26471651159911a28607ac9c52c4ba2ce227ce96d2eee1b036e6c8a7d1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.13

Release history Release notifications | RSS feed

0.1.2

2 release files

This release

0.1.1 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page