Skip to main content

GitOps module

pypi version build status

This package is an integration module that is meant to be used with the inmanta orchestrator: https://docs.inmanta.com

It allows you to easily parametrize a model by defining slices, and then instantiating as many slices as you need to by simply creating json or yaml files in the project repository. This module aims at enabling its users to manage an infra in a "Git-Ops" fashion. Key ideas are:

  1. Declarative Configuration: The desired state of your infrastructure and applications is described in a declarative format (json/yaml files) within a Git repository.
  2. Version Control: Git serves as the central source of truth, meaning all changes are committed to the repository, providing a complete history of the system's evolution.
  3. Automated Synchronization: The orchestrator continuously monitors the Git repository and pulls in new updates.
  4. Pull Requests for Changes: When you want to make a change, you create a pull request to modify the Git repository.
  5. Deployment & Reconciliation: Once the pull request is approved and merged, the orchestrator automatically pulls the changes and deploys them to the live environment, ensuring the actual system state matches the desired state in Git.

All of this is already natively supported by the orchestrator by modifying the main.cf file of a project. This works but scales poorly and it is not possible to track deleted items, this modules aims at addressing these limitations.

More details about the design in the docs folder.

Packaged modules

The inmanta-module-git-ops python package ships three top-level modules:

  • inmanta_plugins.git_ops: the inmanta module itself, containing the plugins, slice/store primitives and processors used by the model. This is the public API to import from other inmanta modules building on top of git_ops.
  • pytest_inmanta_git_ops: a pytest plugin exposing the git_ops_project fixture and the GitOpsProject helper class to write tests for modules using git_ops. This is the public API to import from the test suite of other inmanta modules.
  • inmanta_git_ops: holds code that must live outside of inmanta_plugins (constants, the git-ops CLI, the project generator). The inmanta_plugins namespace can be reloaded by various code paths (notably the clean_reset fixture from inmanta-core), so anything that needs stable module-level state (e.g. constants used as monkeypatch targets) is extracted here. This module is not meant to be imported from other inmanta modules.

Cli

This module also provides a cli interface, to facilitate the creation of a module based on git_ops and the management of a project using git_ops.

If the module is installed in your venv, just run the git-ops command.

$ git-ops --help
Usage: git-ops [OPTIONS] COMMAND [ARGS]...

  Inmanta module git_ops CLI tool.

Options:
  --log-level [DEBUG|INFO|WARNING|ERROR]
  --help                          Show this message and exit.

Commands:
  module   Commands to manage the module containing slice definitions.
  project  Commands to manage the current Inmanta project.

Testing modules built on git_ops

The pytest_inmanta_git_ops plugin provides a git_ops_project fixture that wraps the pytest-inmanta project fixture and lets you drive update/sync/export/prune compiles on a model, write/remove slices, and assert on the resulting instances.

from inmanta_plugins.example.slices import fs
from pytest_inmanta_git_ops.project import GitOpsProject


def test_fs(git_ops_project: GitOpsProject) -> None:
    git_ops_project.load_stores("import example::slices::fs::unroll")

    slice1 = git_ops_project.test_slice(
        fs.RootFolder(root="/tmp/", name="test"),
        store_name=fs.STORE.name,
    )

    # Write the slice to disk and trigger an update + sync compile
    assert git_ops_project.write_slice(slice1).version == 1
    assert len(git_ops_project.get_instance(slice1).directories) == 0

    # Mutate the slice, write again, and check the new version
    slice1.slice.directories = [fs.Folder(name="a"), fs.Folder(name="b")]
    assert git_ops_project.write_slice(slice1).version == 2

    # Remove the slice
    git_ops_project.remove_slice(slice1)
    git_ops_project.prune()

A more complete example lives in docs/example, including the matching slice definitions and the full test suite under docs/example/tests.

Running tests

  1. Set up a new virtual environment, then install the module in it. The first line assumes you have virtualenvwrapper installed. If you don't, you can replace it with python3 -m venv .env && source .env/bin/activate.
mkvirtualenv inmanta-test -p python3 -a .
pip install -e . -c requirements.txt -r requirements.dev.txt
  1. Run tests
pytest tests

Metadata

Release files for inmanta-module-git-ops 0.7.2

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

Source distribution (sdist)

Source distribution for inmanta-module-git-ops 0.7.2
File Size Uploaded
inmanta_module_git_ops-0.7.2.tar.gz 68.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for inmanta-module-git-ops 0.7.2
File Interpreter ABI Platform
inmanta_module_git_ops-0.7.2-py3-none-any.whl Python 3 none any Details

Total release size: 123.7 kB

Release files / inmanta_module_git_ops-0.7.2.tar.gz

Download URL inmanta_module_git_ops-0.7.2.tar.gz
Size 68.8 kB
Tags Source
SHA-256 checksum
How to use checksums
4e3fc1b514a4c540cfd8bac03c49a1417e069ddd11e9a45697a1f9d9bae13fe5
BLAKE2b-256 checksum
How to use checksums
84f18c6babda98a8588c311beb5dceba4eb7361beefcf5d411b87c77d90e65e0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 28, 2026.

Transparency log

Release files / inmanta_module_git_ops-0.7.2-py3-none-any.whl

Download URL inmanta_module_git_ops-0.7.2-py3-none-any.whl
Size 54.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
c794646298b055db115a183a053c9ec70ae7785835f94ab21e13071e3f108a3f
BLAKE2b-256 checksum
How to use checksums
4f3af1cb0d79aacd2376a368164d6ce943fa8664432573ea53538350d7492e2b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 28, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.7.2 This release

2 release files

0.7.1

2 release files

0.7.0

2 release files

0.6.0

2 release files

0.5.1

2 release files

0.5.0

2 release files

0.4.0

2 release files

0.3.1

2 release files

0.3.0

2 release files

0.2.0

2 release files

0.1.5

2 release files

0.1.4

2 release files

0.1.3

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

2 release files

0.0.1

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