Skip to main content

Variability resolution engine for UVL models and text-based implementation artifacts.

Project description

Table of Contents

UVengine

Universal Variability resolution engine for UVL models and text-based artifacts with Jinja templates.

Official website

Description

UVengine is a variability resolution engine for UVL models and text-based artifacts with Jinja templates.

Its main features are:

  • A variability resolution engine for UVL models.
  • Support all language level extensions of UVL.
  • Feature traceability between UVL models and implementation artifacts.
  • Language independence for any text-based artifacts using Jinja templates.
  • Composition and annotation-based mechanisms to implement variability at different degrees of granularity.
  • Easy integration with existing tools of the UVL ecosystem such as UVLS and flamapy.

How to use it

The tool is currently deployed and available online in the following link so that you don't need to install any stuff:

https://uvengine.github.io/

The main use case of the tool is uploading the files and it automatically resolves the variability.

  • Inputs:
    • The feature model (.uvl).
    • A configuration of the feature model (.json).
    • The templates artifacts (.jinja)
    • A mapping model (optional) to relate the features in the feature model within the variation points in the artifacts.
  • Outputs:
    • The artifacts with their variability resolved.

Video demo

Watch the video demo

Using the library

In case you want to use UVengine programatically as a library or using CLI.

Requirements

Download and install

  1. Install Python 3.9+

  2. Clone this repository and enter into the main directory:

    git clone https://github.com/UVengine/uvengine

    cd uvengine

  3. Create a virtual environment:

    python -m venv env

  4. Activate the environment:

    In Linux: source env/bin/activate

    In Windows: .\env\Scripts\Activate

  5. Install the dependencies:

    pip install -r requirements.txt

Usage

The derivation_engine.py script illustrate how to use UVengine programatically.

Basically:

# Import the UVengine 
from uvengine import UVEngine

# Instantiate the engine
uvengine = UVEngine(feature_model_path=<<path_to_your_feature_model>>,
                    configs_path=<<list_of_paths_to_your_configs_files>>,
                    templates_paths=<<list_of_paths_to_your_template_files>>,
                    mapping_model_filepath=<<path_to_your_mapping_model_files>>)
# Resolve the variability                    
resolved_templates = uvengine.resolve_variability()

# Save the resolved templates to file and print the content to the standard output
for template_path, content in resolved_templates.items():
    # Rename output file for avoiding overriding original templates and remove .jinja extension
    output_file = pathlib.Path(template_path).with_name(pathlib.Path(template_path).stem + '_resolved' + ''.join(pathlib.Path(template_path).suffixes).replace('.jinja', ''))  
    with open(output_file, 'w', encoding='utf-8') as file:
      file.write(content)
    print(content)

Execution

The derivation_engine.py script is also the entry point interface to resolve the variability from the given inputs.

To resolve the variability over any input, execute:

python derivation_engine.py -fm FEATURE_MODEL -c CONFIGS [CONFIGS ...] -t TEMPLATES [TEMPLATES ...] [-m MAPPING_FILE]

where:

-fm FEATURE_MODEL: Feature model in UVL (.uvl).

-c CONFIGS [CONFIGS ...]: Configuration files (.json) or directy with configurations (in case of a single configuration split in multiple files).

-t TEMPLATES [TEMPLATES ...]: Template files (.jinja) or directory with templates over which the variability is resolved.

[-m MAPPING_FILE]: Optional file with the mapping between the features in the feature model and the variation points and variants in the templates (.csv).

Example:

python derivation_engine.py -fm case_studies/icecream/feature_model/icecream.uvl -c case_studies/icecream/configurations/cone.json -t case_studies/icecream/templates/main.txt.jinja -m case_studies/icecream/mapping_model/icecream.csv

As result, the final product (i.e., the templates with the variability resolved) are generated in the same template folder provided with the suffixes _resolved.

Executing the Case Studies

To facilitate the execution of the different case studies, we have prepared a Python script for each case study:

  • Ice cream: python cs1_icecream.py

  • Docker: python cs2_docker.py

Generate Pypi package

  1. Install needed tools: pip install --upgrade build twine
  2. Build the package: python -m build
  3. Upload the package to TestPypI: python -m twine upload --repository testpypi dist/*
  4. Upload the package to PypI: python -m twine upload dist/*

References and third-party software

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

uvengine-1.0.3.tar.gz (8.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

uvengine-1.0.3-py3-none-any.whl (7.6 kB view details)

Uploaded Python 3

File details

Details for the file uvengine-1.0.3.tar.gz.

File metadata

  • Download URL: uvengine-1.0.3.tar.gz
  • Upload date:
  • Size: 8.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.3

File hashes

Hashes for uvengine-1.0.3.tar.gz
Algorithm Hash digest
SHA256 ad32abe347062cd83836ec53466d046ec1e0bb2921a17d37598184d861a71e39
MD5 14054d01dea82df9dcd81bd2a2c44257
BLAKE2b-256 337440e1f1ee382bac1d64ea69a7a3b05b5375104b2ec5262beb60f33afd3e0e

See more details on using hashes here.

File details

Details for the file uvengine-1.0.3-py3-none-any.whl.

File metadata

  • Download URL: uvengine-1.0.3-py3-none-any.whl
  • Upload date:
  • Size: 7.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.3

File hashes

Hashes for uvengine-1.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 96e2868ba015a06bfed4414c86a47a9668f3ef6bd3b04fe43bad0de3bd7ad96e
MD5 a8cbe78011bc85af11ecd478150ed6d6
BLAKE2b-256 9eccd1d1be3ef655889928de4f54e327f88498054de04a4998b547f8d7b50b30

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page