Skip to main content

Distribution oriented templating system

Copr package Fedora package Coverage Status Documentation Status

The problem this project tries to mitigate is "portable" scripting for variety of operating systems (currently Linux distributions only) in the wild. While writing an "universal" script, one needs to take into account small or bigger differences among operating systems (like package installation tools, versions of utilities, expected directories for binaries, libraries, etc.).

The distgen project is thus something like database of OS differences together with convenience tool-set that allows you to instantiate valid script for particular distribution. The concept is to have template file (mostly raw jinja2 template) together with "declarative" spec file (YAML file) that fulfils the needs of particular template.

You can find distgen documentation at http://distgen.readthedocs.io.

Download/Installation

Stable releases of distgen are available as RPMs in Fedora and EPEL repositories, and in pypi:

$ sudo dnf install distgen

$ pip install distgen

Development (git snapshot) RPMs are automatically built in Fedora Copr.

You can also run development version directly from git, simply use the dg shell wrapper available in this git root directory.

Example with Dockerfile

Typical example is the need to instantiate working FOO package oriented Dockerfiles for all supported Fedora/RHEL versions.

To achieve that goal with distgen, you need to write something like docker.tpl template and FOO.yaml spec file. If the system-default docker.tpl template is good enough, its enough to write proper spec file:

  1. create FOO.yaml spec:

    $ cat FOO.yaml
    maintainer: John Doe <jdoe@example.com>
    parts:
      pkginstall:
        data:
          - type: pkg
            action: install
            packages:
              - vim
      footer:
        cmd: ["vim"]
    
  2. Run dg tool to generate Fedora 22 Dockerfile:

    $ dg --template docker.tpl \
         --spec FOO.yaml \
         --distro fedora-22-x86_64.yaml \
    > Dockerfile
    $ cat Dockerfile
    FROM index.docker.io/fedora:22
    MAINTAINER John Doe <jdoe@example.com>
    
    ENV container="docker"
    
    RUN dnf -y --setopt=tsflags=nodocs install vim \
        && dnf -y --setopt=tsflags=nodocs clean all --enablerepo='*'
    
    CMD ["vim"]
    
  3. Run dg tool again to generate RHEL 7 dockerfile:

    $ dg --template docker.tpl \
         --spec FOO.yaml \
         --distro rhel-7-x86_64.yaml \
    > Dockerfile
    $ cat Dockerfile
    FROM registry.access.redhat.com/rhel7
    MAINTAINER John Doe <jdoe@example.com>
    
    ENV container="docker"
    
    RUN yum -y --setopt=tsflags=nodocs install vim \
        && yum -y --setopt=tsflags=nodocs clean all --enablerepo='*'
    
    CMD ["vim"]
    

Release files for distgen 2.4

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

Source distribution (sdist)

Source distribution for distgen 2.4
File Size Uploaded
distgen-2.4.tar.gz 85.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for distgen 2.4
File Interpreter ABI Platform
distgen-2.4-py3-none-any.whl Python 3 none any Details

Total release size: 140.1 kB

Release files / distgen-2.4.tar.gz

Download URL distgen-2.4.tar.gz
Size 85.9 kB
Tags Source
SHA-256 checksum
How to use checksums
e176991785a61a1a06810dca96080858b1c0ca965803c42990dec044c8a3a0fb
BLAKE2b-256 checksum
How to use checksums
b8bea9330e92b8955cd9de81a61947a470262f1385033e5e8393e8dfad1c7a35
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

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 Jul 14, 2026.

Transparency log

Release files / distgen-2.4-py3-none-any.whl

Download URL distgen-2.4-py3-none-any.whl
Size 54.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ff503aac8944d3408c68a0ed2a5a3b2715ec70d586f5e895d3ad47bec490ad2a
BLAKE2b-256 checksum
How to use checksums
59670661f298172026235a32fa9a648a027c3b9b51d3c8d2de19ad68078faed6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

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 Jul 14, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

2.4 This release

2 release files

2.3

2 release files

2.2

2 release files

2.1

2 release files

2.0

2 release files

1.19

1 release file

1.18

1 release file

1.17

1 release file

1.16

1 release file

1.15

1 release file

1.14

1 release file

1.13

1 release file

1.12

1 release file

1.11

1 release file

1.10

1 release file

1.9

1 release file

1.8

1 release file

1.7

1 release file

1.6

1 release file

1.5

1 release file

1.4

1 release file

1.3

1 release file

1.2

1 release file

1.1

1 release file

1.0

1 release file

0.20

1 release file

0.19

1 release file

0.18

1 release file

0.17

1 release file

0.16

1 release file

0.15

1 release file

0.14

1 release file

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