Inmanta’s intent-based service models are composed of modules. These modules are reusable building blocks that are (up until now) distributed as Git repositories. Starting from the Inmanta Service Orchestrator 5 and
OSS 2022.1 releases, we introduce the new and improved Inmanta Modules v2 format. These v2 modules are no longer distributed as Git repositories but as native Python packages.
A native Python package enables closer integration with the Python ecosystem and ultimately unifies the distribution channels for Inmanta modules and their Python dependencies. In other words, you can:
- Distribute Inmanta modules as Python packages. A v2 module can be installed, distributed and managed using the existing tools. This means a facilitated and smoother adoption for our users.
- Load Inmanta plugin code as normal Python code. All plugin, handler, and extension code can now be loaded into Python using a simple
importstatement. This makes it easier to write test cases and share code between Inmanta plugins, test cases, and even third-party tools and projects.
Easily install, upgrade and distribute modules
The most notable change to Inmanta users is that the compiler no longer transparently downloads dependencies. When installing a project, you install dependencies using the following command:
inmanta project install
To distribute a module as a Python package, use:
inmanta module build
This works for both v1 and v2 modules! If you package a v1 module, it is first converted to v2 in the background and then converted into a Python package. In essence, you can still distribute v1 modules as Git repositories and at the same time as Python packages.
Changes in the project layout
The v2 format presents two notable changes to the module layout:
module.yamlis replaced by
pluginsfolder is replaced by the Python namespace package
We also offer an editable installation mode for v2 modules to simplify making changes without having to reinstall the modules. To install a particular v2 module in editable mode, use:
inmanta module install -e <package-name>
When a v2 module depends on another module, it must explicitly declare this in the
pyproject.toml. To add a module dependency, use the following command:
inmanta module add --v2 <dependency>
In order to fully benefit from the v2 format, you have to convert the existing v1 modules to the v2 format. We provide a conversion tool to do this automatically:
inmanta module v1tov2
Furthermore, there is one important point to consider about v2 modules: v2 modules cannot depend on v1 modules. As long as you keep this limitation in mind, v1 and v2 modules can freely coexist.
The introduction of modules v2 makes it possible to install, upgrade and distribute Inmanta modules similar to Python packages resulting in facilitated and smoother adoption for our users and customers. This ultimately makes it easier and faster to gain access to our latest features, while reducing human error and providing a more convenient testing and development experience.
For more information and further reading please visit: