Infraclass
Infraclass is a lightweight, zero-dependency, and highly secure hierarchical inventory compiler for Python automation engines (like ansible and pyinfra). It allows you to build inventories using a top-down class inheritance layout, natively supporting encrypted secrets using age.
Project Directory Structure
Infraclass separates the core execution configuration from your static data inventory. Rename your data directory to infraclass/ to align with the framework:
pyinfra/ ├── inventory.py # Calls infraclass to generate the pyinfra inventory ├── deploy.py # Your execution playbooks └── infraclass/ # Your hierarchical data directory ├── classes/ # Reusable configuration blueprints │ ├── components/ │ ├── platform/ │ │ └── init.yml # Standard shared properties & secrets │ └── roles/ └── nodes/ # Machine-specific inventory targets └── example.com.yml
To make the infraclass binary globally active and accessible to your local pyinfra execution pass:
Install the Package: Install infraclass cleanly using uv (or pip):
uv tool install infraclass --with PyYAML
Verify Default Path Alignment: By default, infraclass checks for an encrypted key at /.age/identity.age. Ensure your encrypted private key file sits exactly at that path.
Optional Environment Overrides: If you need to map to a different key file variant, export the override directly in your shell profile (/.zshrc):
export INFRACLASS_AGE_KEY_FILE="$HOME/.age/identity.age"
"Out of the Box" Verification Tests Once these parameters are lined up, you have two native testing options to confirm the engine is happy:
Test 1: Standard Standalone CLI Output infraclass example.com Success Criteria: Full flat hierarchical YAML prints straight to stdout, with all custom !secret blocks transformed into decrypted, human-readable strings.
Test 2: In-Memory Python Engine Integration from infraclass.compiler import compile_node_data
node_data = compile_node_data("netsys-dev-smc2.lancs.ac.uk")
Read variable directly out of compiled parameters mapping tree secret_pass = node_data["parameters"]["platform"]["psql"]["database-name"]["password"] print(f"Decrypted password token: {secret_pass}")
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file infraclass-1.0.1.tar.gz.
File metadata
- Download URL: infraclass-1.0.1.tar.gz
- Upload date:
- Size: 8.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via:
uv/0.11.32 {"installer":{"name":"uv","version":"0.11.32","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2a61705c86e2ee04b0fd394abd8937c6106113070f86d227134ac43bdeedd555
|
|
| MD5 |
2f5fc67bbaa5726edab0110921da2127
|
|
| BLAKE2b-256 |
9f6d5a05781ebdf23ebde8039f3fed320497fca0dc509193b1f7047b44923111
|
File details
Details for the file infraclass-1.0.1-py3-none-any.whl.
File metadata
- Download URL: infraclass-1.0.1-py3-none-any.whl
- Upload date:
- Size: 8.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via:
uv/0.11.32 {"installer":{"name":"uv","version":"0.11.32","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5cdf224349f25dc1d0cca7c5305474c50f367cacacbdbe16bb11f60d4b1d8f6d
|
|
| MD5 |
40ca9016fa9484643b50cb8ecbfcf96d
|
|
| BLAKE2b-256 |
6702cf51138d4888e43a572e9ead9f53ec33670a73aadaf310f26fd68aa5daea
|