Skip to main content

Incant — an Incus frontend for declarative development environments

Project description

Incant

PyPI version

Incant is a frontend for Incus that provides a declarative way to define and manage development environments. It simplifies the creation, configuration, and provisioning of Incus instances using YAML-based configuration files.

Features

  • Declarative Configuration: Define your development environments using simple YAML files.
  • Shared Folder Support: Mount the current working directory into the instance.
  • Provisioning Support: Declare and run provisioning scripts automatically, copy files to the instance, and set up an SSH server automatically.

Installation

Ensure you have Python installed and incus available on your system.

You can install Incant from PyPI:

pipx install incus-incant

Or install directly from Git:

pipx install git+https://github.com/lnussbaum/incant.git

Usage

Configure Incant

Incant looks for a configuration file named incant.yaml, incant.yaml.j2, or incant.yaml.mako in the current directory. Here is an example:

instances:
  my-instance:
    image: images:debian/12
    vm: false # use a container, not a KVM virtual machine
    provision:
      - echo "Hello, World!"
      - apt-get update && apt-get install -y curl

You can also ask Incant to create an example in the current directory:

$ incant init

Initialize and Start an Instance

$ incant up

or for a specific instance:

$ incant up my-instance

Provision again an Instance that was already started previously

$ incant provision

or for a specific instance:

$ incant provision my-instance

Use your Instances

Use Incus commands to interact with your instances:

$ incus exec ubuntu-container -- apt-get update
$ incus shell my-instance
$ incus console my-instance
$ incus file edit my-container/etc/hosts
$ incus file delete <instance_name>/<path_to_file>

Your instance's services are directly reachable on the network. They should be discoverable in DNS if the instance supports LLMNR or mDNS.

Destroy an Instance

$ incant destroy

or for a specific instance:

$ incant destroy my-instance

View Configuration (especially useful if you use Mako or Jinja2 templates)

$ incant dump

Incant compared to Vagrant

Incant is inspired by Vagrant, and intended as an Incus-based replacement for Vagrant.

The main differences between Incant and Vagrant are:

  • Incant is Free Software (licensed under the Apache 2.0 license). Vagrant is licensed under the non-Open-Source Business Source License.
  • Incant is only a frontend for Incus, which supports containers (LXC-based) and virtual machines (KVM-based) on Linux. It will not attempt to be a more generic frontend for other virtualization providers. Thus, Incant only works on Linux.

Some technical differences are useful to keep in mind when migrating from Vagrant to Incant.

  • Incant is intended as a thin layer on top of Incus, and focuses on provisioning. Once the provisioning has been performed by Incant, you need to use Incus commands such as incus shell to work with your instances.
  • Incant shares the current directory as /incant inside the instance (compared to Vagrant's sharing of /vagrant). Incant tries to share the current directory read-write (using Incus' shift=true) but this fails in some cases, such as restricted containers. So there are chances that the directory will only be shared read-only.
  • Incant does not create a user account inside the instance -- you need to use the root account, or create a user account during provisioning (for example, with adduser --disabled-password --gecos "" incant)
  • Incant uses a YAML-based description format for instances. Mako or Jinja2 templates can be used to those YAML configuration files if you need more complex processing, similar to what is available in Vagrantfiles (see the examples/ directory).

Incant compared to other projects

There are several other projects addressing similar problem spaces. They are shortly described here so that you can determine if Incant is the right tool for you.

  • lxops and blincus manage the provisioning of Incus instances using a declarative configuration format, but the provisioning actions are described using cloud-init configuration files. lxops uses cloudconfig to apply them, while blincus requires cloud instances that include cloud-init. In contrast, using Incant does not require knowing about cloud-init or fitting into cloud-init's formalism.
  • terraform-provider-incus is a Terraform or OpenTofu provider for Incus. Incant uses a more basic scheme for provisioning, and does not require knowing about Terraform or fitting into Terraform's formalism.
  • cluster-api-provider-lxc (CAPL) is an infrastructure provider for Kubernetes' Cluster API, which enables deploying Kubernetes clusters on Incus. Incant focuses on the more general use case of provisioning system containers or virtual machines outside of the Kubernetes world.
  • devenv is a Nix-based development environment manager. It also uses a declarative file format. It goes further than Incant by including the definition of development tasks. It also covers defining services that run inside the environment, and generating OCI containers to deploy the environment to production. Incant focuses on providing the environment based on classical Linux distributions and tools.

License

This project is licensed under the Apache 2.0 License. See the LICENSE file for details.

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

incus_incant-0.2.tar.gz (22.7 kB view details)

Uploaded Source

Built Distribution

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

incus_incant-0.2-py3-none-any.whl (24.5 kB view details)

Uploaded Python 3

File details

Details for the file incus_incant-0.2.tar.gz.

File metadata

  • Download URL: incus_incant-0.2.tar.gz
  • Upload date:
  • Size: 22.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.1.2 CPython/3.13.5 Linux/6.12.35+deb13-amd64

File hashes

Hashes for incus_incant-0.2.tar.gz
Algorithm Hash digest
SHA256 c6b4d5a1d94250299bb791b1ff381992093caea3e1dc8adee2cc5581763f7271
MD5 e1519ab050c1cd22dc7c890dbe3ce700
BLAKE2b-256 4f8e20daebfa1f287c5f95527efb16bdc66fe4cd972759b40fc0da0f3fb6bed6

See more details on using hashes here.

File details

Details for the file incus_incant-0.2-py3-none-any.whl.

File metadata

  • Download URL: incus_incant-0.2-py3-none-any.whl
  • Upload date:
  • Size: 24.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.1.2 CPython/3.13.5 Linux/6.12.35+deb13-amd64

File hashes

Hashes for incus_incant-0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 f7a44259e5e2dd3e77caa07a3686c22d0b613d16c5d207e31af4c8beb4710b07
MD5 f1850db8091685bb6bb06c5211ff2ef4
BLAKE2b-256 291d6d878ca5d87b21e18c21b321aa11d9e41df442208863c60833d1d1c585cc

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