Skip to main content

Provides access to Capella MBSE projects in Python

Project description

Python-Capellambse

PyPI - Python Version Code QA License: Apache-2.0 REUSE status Code style: ruff

A Python 3 headless implementation of the Capella modeling tool

Intro

capellambse allows you reading and writing Capella models from Python without Java or the 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, and render diagrams as SVG and PNG. We made it for automation of Systems Engineering work, so it integrates nicely into most 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.

Related projects

  • capellambse-context-diagrams — A capellambse extension that visualizes the context of Capella objects, and exposes it on element attributes like .context_diagram, .tree_view, etc.

  • capella-diff-tools — A set of tools to compare Capella models.

  • capella-polarion — Synchronize information from the Capella model into a Polarion project

  • capella-ros-tools — Import and export ROS *.msg files to/from Capella models, or transform *.msg files into a declarative YAML file.

Did you make something cool that is using or extending capellambse? Tell us about it, so we can add it to this list!

Documentation and examples

The library is designed to be easy to use and discover, especially in an interactive environment such as JupyterLab. Additionally, API documentation is automatically generated and published whenever new features and bug fixes are added.

You are encouraged to explore our test models and demo notebooks. Click on the button below to launch a Jupyter notebook server on the public myBinder service, and get started in seconds:

myBinder

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!

The docs/source/examples directory contains several hands-on example notebooks that you can immediately run and start experimenting with. Below is a short summary of each notebook's goal. If you are in the JupyterLab environment, you can click the notebook names to directly open them in a new lab tab. On Github, you will be shown a statically rendered preview of the notebook.

  • 01 Introduction.ipynb provides a high-level overview of the library features. It visualizes examples like a Component - Function allocation table by leveraging Jupyter's and IPython's rich display functionality.

  • 02 Intro to Physical Architecture.ipynb explores some more advanced concepts on the example of the Physical Architecture Layer. It shows how to derive tabular data, like a Bill of Materials or a Software to Hardware allocation table, by using pandas dataframes.

  • 03 Data Values.ipynb shows how the API can be used to explore classes, class instances and other objects related to data modeling.

  • 04 Intro to Jinja templating.ipynb demonstrates how to effectively combine capellambse with the powerful Jinja templating engine. This enables the creation of all sorts of model-derived documents and artifacts, including interactive web pages, PDF documents and any other textual representations of your models.

  • 05 Introduction to Libraries.ipynb shows how to use Capella Library Projects within capellambse. In this example you'll learn how the API can be used to open a project that is based on a library and find objects in both models.

  • 06 Introduction to Requirement access and management.ipynb shows how the API can be used to work with requirements objects, introduced by the Capella Requirements Viewpoint. In this example you'll see how to find requirements in the model, see which objects requirements are linked / traced to and even export requirements to Excel or ReqIF formats.

  • 07 Code Generation.ipynb shows how to generate code from class diagrams. In particular, we focus on Interface Descriptive Languages with concrete examples for Class to ROS2 IDL and Google Protocol Buffers. We also show how simple Python stubs could be generated given a Class object.

  • 08 Property Values.ipynb shows how to access property values and property value groups, as well as the Property Value Management (PVMT) extension.

  • 09 Context Diagrams.ipynb shows the capellambse-context-diagrams extension that visualizes contexts of Capella objects. The extension is external to the capellambse library and needs to be installed separately.

  • 10 Declarative Modeling.ipynb demonstrates a basic application of the declarative approach to modeling on a coffee machine example.

  • 11 Complexity Assessment.ipynb quickly demonstrates how to use and view the model complexity badge for a Capella model.

We are constantly working on improving everything shown here, as well as adding even more useful functionality and helpful demos. If you have any new ideas that were not mentioned yet, don't hesitate to contribute!

Installation

In order to use private models that are not publicly available, please install and use capellambse in a local, trusted environment.

You can install the latest released version directly from PyPI.

pip install capellambse

On supported platforms, the downloaded wheel includes an optional native module, which provides faster implementations of some functions. Other platforms will fall back to a pure Python wheel without this speedup. To build the native module, a Rust compiler is required.

Development

For details on how to set up a local development environment, please refer to the CONTRIBUTING guide.

Current limitations

As we started in mid 2019 and there was no such thing as Python4Capella yet, we are not API compatible with that project.

The generated diagrams are currently not persisted in .aird files, and currently there is no plan to implement this. 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 our guidelines for contributors for details.

Licenses

This project is compliant with the REUSE Specification Version 3.0.

Copyright DB InfraGO AG, licensed under Apache 2.0 (see full text in LICENSES/Apache-2.0.txt)

Dot-files are licensed under CC0-1.0 (see full text in LICENSES/CC0-1.0.txt)

To provide the same look and feel across platforms, we distribute our library bundled with the OpenSans font (capellambse/OpenSans-Regular.ttf). The OpenSans font is Copyright 2020 The Open Sans Project Authors, licensed under OFL-1.1 (see full text in LICENSES/OFL-1.1.txt).

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.7.3.tar.gz (5.5 MB view details)

Uploaded Source

Built Distributions

capellambse-0.7.3-py3-none-any.whl (426.8 kB view details)

Uploaded Python 3

capellambse-0.7.3-cp310-abi3-win_amd64.whl (564.8 kB view details)

Uploaded CPython 3.10+Windows x86-64

capellambse-0.7.3-cp310-abi3-win32.whl (559.4 kB view details)

Uploaded CPython 3.10+Windows x86

capellambse-0.7.3-cp310-abi3-musllinux_1_2_x86_64.whl (780.9 kB view details)

Uploaded CPython 3.10+musllinux: musl 1.2+ x86-64

capellambse-0.7.3-cp310-abi3-musllinux_1_2_aarch64.whl (765.2 kB view details)

Uploaded CPython 3.10+musllinux: musl 1.2+ ARM64

capellambse-0.7.3-cp310-abi3-manylinux_2_28_x86_64.whl (702.8 kB view details)

Uploaded CPython 3.10+manylinux: glibc 2.28+ x86-64

capellambse-0.7.3-cp310-abi3-manylinux_2_28_aarch64.whl (701.4 kB view details)

Uploaded CPython 3.10+manylinux: glibc 2.28+ ARM64

capellambse-0.7.3-cp310-abi3-macosx_11_0_arm64.whl (670.1 kB view details)

Uploaded CPython 3.10+macOS 11.0+ ARM64

capellambse-0.7.3-cp310-abi3-macosx_10_13_x86_64.whl (677.1 kB view details)

Uploaded CPython 3.10+macOS 10.13+ x86-64

File details

Details for the file capellambse-0.7.3.tar.gz.

File metadata

  • Download URL: capellambse-0.7.3.tar.gz
  • Upload date:
  • Size: 5.5 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for capellambse-0.7.3.tar.gz
Algorithm Hash digest
SHA256 bb3920a888dec027eeff3c380c78ae3d045c96c459b84b99fa5b643d80870bbf
MD5 a81a6b858338783d228924c521d49347
BLAKE2b-256 3683727ff95abc7c55c0510d8bd2e56958a073aefd132b890c4eb7a5321adeac

See more details on using hashes here.

Provenance

The following attestation bundles were made for capellambse-0.7.3.tar.gz:

Publisher: code-qa.yml on DSD-DBS/py-capellambse

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file capellambse-0.7.3-py3-none-any.whl.

File metadata

  • Download URL: capellambse-0.7.3-py3-none-any.whl
  • Upload date:
  • Size: 426.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for capellambse-0.7.3-py3-none-any.whl
Algorithm Hash digest
SHA256 e4aad50fd607f75dadb372ca6934d7f6b97512a9ecf29b00254252ddae2e833f
MD5 885182f05891370428b5e61be3e82ba7
BLAKE2b-256 7fbc73cf77ff5748eed0e48abf13b0ee0c1732ed0562a60c0be8966570465e3c

See more details on using hashes here.

Provenance

The following attestation bundles were made for capellambse-0.7.3-py3-none-any.whl:

Publisher: code-qa.yml on DSD-DBS/py-capellambse

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file capellambse-0.7.3-cp310-abi3-win_amd64.whl.

File metadata

  • Download URL: capellambse-0.7.3-cp310-abi3-win_amd64.whl
  • Upload date:
  • Size: 564.8 kB
  • Tags: CPython 3.10+, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for capellambse-0.7.3-cp310-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 8d09aa635dd8819fa127769ead8aa72f65f58df3001f9069900d4703af5a0abb
MD5 063dc528a86353c154ac3e1d1b3cbcf0
BLAKE2b-256 a756f0de8c5883da66e4990c87657a499176e1f9009d0cae19d6351defd4c8bf

See more details on using hashes here.

Provenance

The following attestation bundles were made for capellambse-0.7.3-cp310-abi3-win_amd64.whl:

Publisher: code-qa.yml on DSD-DBS/py-capellambse

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file capellambse-0.7.3-cp310-abi3-win32.whl.

File metadata

  • Download URL: capellambse-0.7.3-cp310-abi3-win32.whl
  • Upload date:
  • Size: 559.4 kB
  • Tags: CPython 3.10+, Windows x86
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for capellambse-0.7.3-cp310-abi3-win32.whl
Algorithm Hash digest
SHA256 b1a9ce4aa4e89fbd4a8874d12b3b3967c55bddb735ed7e7479061c82d65de5e1
MD5 c4d6c37ab16d88c6e8f9ded4e2faf69c
BLAKE2b-256 19a3444eaf255c00a8c3cb02c28bf5fb45e7e88ac06fd4995f67ac0329a9f60c

See more details on using hashes here.

Provenance

The following attestation bundles were made for capellambse-0.7.3-cp310-abi3-win32.whl:

Publisher: code-qa.yml on DSD-DBS/py-capellambse

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file capellambse-0.7.3-cp310-abi3-musllinux_1_2_x86_64.whl.

File metadata

File hashes

Hashes for capellambse-0.7.3-cp310-abi3-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 13debc4f8809cbe0377f85ea653eb9f334cc87cdaf1ef15436bfca92175be856
MD5 386f86704b516ea10ea34b270ccfd475
BLAKE2b-256 e4b814ca113dc45e9836462e5b4a047eb8a297a707eeeb0a38c00c0687765ead

See more details on using hashes here.

Provenance

The following attestation bundles were made for capellambse-0.7.3-cp310-abi3-musllinux_1_2_x86_64.whl:

Publisher: code-qa.yml on DSD-DBS/py-capellambse

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file capellambse-0.7.3-cp310-abi3-musllinux_1_2_aarch64.whl.

File metadata

File hashes

Hashes for capellambse-0.7.3-cp310-abi3-musllinux_1_2_aarch64.whl
Algorithm Hash digest
SHA256 6b596c5b162b8444681d002dddbe3ea8e45c35a78f9d7e2dfa9308d1cf4f7878
MD5 a56e8afe7f28c2b67ef4ba2b1df86194
BLAKE2b-256 951c12a4d26231464757b5f61814cd66e9ccc98195fa45e75637287f861eb068

See more details on using hashes here.

Provenance

The following attestation bundles were made for capellambse-0.7.3-cp310-abi3-musllinux_1_2_aarch64.whl:

Publisher: code-qa.yml on DSD-DBS/py-capellambse

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file capellambse-0.7.3-cp310-abi3-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for capellambse-0.7.3-cp310-abi3-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 a7b7c0e1dadbc3950d2d68ee8865e9c63b9e67369c3480396efc88d4e9df9069
MD5 bc9c02f4c171f57a6d9ebd3480bea73a
BLAKE2b-256 d801fa30c5527229635230c2143287cada2a249cc92e501baee5a3f1ca7ed6df

See more details on using hashes here.

Provenance

The following attestation bundles were made for capellambse-0.7.3-cp310-abi3-manylinux_2_28_x86_64.whl:

Publisher: code-qa.yml on DSD-DBS/py-capellambse

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file capellambse-0.7.3-cp310-abi3-manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for capellambse-0.7.3-cp310-abi3-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 ca6acaedb229c2edfe212d4a083725e38933373c6db6ea46ffa2103c5a2737ee
MD5 b16f52928ceb9fe596d009cdf12b5a09
BLAKE2b-256 7b5d063364a7efbfc2cff34f34254c0026aa8afe3827b269560e346b5199616a

See more details on using hashes here.

Provenance

The following attestation bundles were made for capellambse-0.7.3-cp310-abi3-manylinux_2_28_aarch64.whl:

Publisher: code-qa.yml on DSD-DBS/py-capellambse

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file capellambse-0.7.3-cp310-abi3-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for capellambse-0.7.3-cp310-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 3288c90fe9d22c21894ea2c44824da870fcb3e2aa8859ac498ec1b89a9f3041a
MD5 8d867536ceccbe856c3fba2466408bb0
BLAKE2b-256 c7d9f81bcec4cafec8dc85312ebc1cfeebf4e2434e328229910d73af8e91c1d7

See more details on using hashes here.

Provenance

The following attestation bundles were made for capellambse-0.7.3-cp310-abi3-macosx_11_0_arm64.whl:

Publisher: code-qa.yml on DSD-DBS/py-capellambse

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file capellambse-0.7.3-cp310-abi3-macosx_10_13_x86_64.whl.

File metadata

File hashes

Hashes for capellambse-0.7.3-cp310-abi3-macosx_10_13_x86_64.whl
Algorithm Hash digest
SHA256 ce9ab1f61d9263e864c08d3d527ec4cef51912e4d00f3a91be38819936a46f8f
MD5 0e912378de4eecfbbd93f503d97aa08c
BLAKE2b-256 e6f764e48ea770373aa5dad58ba9a506f50590f6240c35b6505b2deb9b7cd622

See more details on using hashes here.

Provenance

The following attestation bundles were made for capellambse-0.7.3-cp310-abi3-macosx_10_13_x86_64.whl:

Publisher: code-qa.yml on DSD-DBS/py-capellambse

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

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