Skip to main content

Provides access to Capella MBSE projects in Python

Project description

capellambse

A Python 3 headless implementation of the Capella modeling tool

CI build CI lint

Intro

Copyright 2021 DB Netz AG, licensed under Apache 2.0 (see full text in LICENSE)

capellambse allows you reading and writing Capella models from python without Java or Capella tool on any (reasonable) platform. We wanted to "talk" to Capella models from Python but without any Java on the way. We thought this project will help individuals and organisations getting through the MBSE adoption journey with Capella faster and so we made it public and open-source.

With capellambse you can access all (or almost all) Capella model elements, render diagrams (as SVG and PNG). We made it for automation of Systems Engineering work so it integrates nicely into most of CI/CD toolchains. We also found it at the core of our artifact generation pipelines (model to documents, model to SW interfaces).

The library works with PVMT and Requirements extensions without any additional efforts.

It started as a basic library somewhere mid 2019. Since then it was re-architected a few times and now has a full read/write capability for most of the present Capella ontology. We are continuously improving the API (introducing shortcuts), increasing the meta-model coverage and have more engineering automations and improvements in the pipeline to share.

Getting started

Click on this button to launch a Binder instance and start exploring our test models within seconds:

Binder

Warning: Do not enter confidential information, such as passwords for non-public models, into a notebook hosted on myBinder. If you want to try out capellambse with those models, please install and run it in a local, trusted environment (see below)!

Alternatively, to start using the project on your local machine, follow these steps:

  1. Clone the repository.

    git clone https://github.com/DSD-DBS/py-capellambse.git
    cd py-capellambse
    
  2. Create a virtual environment.

    python3 -m venv .venv
    
    # on Linux or Mac:
    source .venv/bin/activate
    
    # on Windows using cmd.exe:
    .venv\Scripts\activate.bat
    
    # on Windows using PowerShell:
    .venv/Scripts/activate.ps1
    
  3. Install capellambse and Jupyter.

    pip install -e .
    pip install jupyter
    
  4. Open the example notebooks.

    cd examples
    jupyter-notebook
    

The above code should clone the library and install it and all of its dependencies in a fresh virtual environment. Then, it should have started a jupyter-notebook server right in the examples folder. If your browser did not open automatically, follow the instructions in the terminal to start it manually.

Once in the browser, simply click on the 01_Introduction.ipynb notebook to start!

Documentation and examples

We designed the library API such that it is easy to use and discover, however there is also documentation available here. Additionally, the practical examples folder provides a collection of Jupyter notebooks with practical examples (like getting traceability matrices, change assessments, BoMs, etc).

Dependencies on 3rd party components and re-distributions

To provide same look and feel across platforms our diagraming engine uses OpenSans font. And to simplify the library installation and usage we redistribute it in accordance with SIL Open Font License 1.1 that it has at the moment: The bundled OpenSans font (capellambse/OpenSans-Regular.ttf) is Copyright 2020 The Open Sans Project Authors, the copy of License text can be seen in LICENSE-OpenSans.txt.

Current limitations

We are continuously improving coverage of Capella onthology with our high-level API (the current coverage map is available here), however it is still incomplete. It covers most of the commonly used paths but when you need to get to an ontology element that isnt covered yet you may do so by using the low-level API.

Also, as we started in mid 2019 and there was no such thing as Python4Capella yet, we are not API compatible with that project. However, we intend to add API compatibility with Python4Capella in later releases.

The generated diagrams are currently not persisted in .aird files and we are not sure yet if we need this feature. If there is a genuine usecase for that we may re-consider it - feel free to create an issue or add comments to an existing one.

Contributing

We'd love to see your bug reports and improvement suggestions! Please take a look at guidelines for contributors.

Project details


Release history Release notifications | RSS feed

Download files

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

Source Distribution

capellambse-0.4.3.tar.gz (246.9 kB view hashes)

Uploaded Source

Built Distribution

capellambse-0.4.3-py3-none-any.whl (275.1 kB view hashes)

Uploaded Python 3

Supported by

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