Skip to main content

Reclass defines a syntax and directory structure for recursively merging YAML data sources.

Project description

reclass-rs: A Reclass implementation in Rust

Reclass is a library which defines a syntax and directory structure for recursively merging YAML data sources.

This repository contains a Rust implementation of Reclass which is based on the Reclass fork maintained by kapicorp. The Reclass implementation provided in this repository can be used both from other Rust programs and in Python programs. The reclass-rs Python module is implemented directly in Rust with PyO3.

Please note that this implementation doesn't yet support all the features and extensions which are available in Kapitan Reclass. However, for features which are implemented, we aim to be compatible with Kapitan Reclass.

The implementation currently supports the following features of Kapicorp Reclass:

  • The Reclass options nodes_path and classes_path
  • The Reclass option ignore_class_notfound
  • The Reclass option ignore_class_notfound_regexp
  • Escaped parameter references
  • Merging referenced lists and dictionaries
  • Constant parameters
  • Nested references
  • References in class names
  • Loading classes with relative names
  • Loading Reclass configuration options from reclass-config.yaml
  • The Reclass option componse_node_name
    • reclass-rs provides a non-compatible mode for compose_node_name which preserves literal dots in node names

The following Kapicorp Reclass features aren't supported:

  • Ignoring overwritten missing references
  • Inventory Queries
  • The Reclass option allow_none_override can't be set to False
  • The Reclass yaml_git and mixed storage types
  • Any Reclass option which is not mentioned explicitly here or above

Documentation for the original Reclass can be found at https://reclass.pantsfullofunix.net/. Documentation on Reclass extensions introduced in the Kapicorp Reclass fork can be found at https://github.com/kapicorp/reclass/blob/develop/README-extensions.rst.

Prerequisites

  • Python >= 3.8
  • Rust >= 1.56 (we recommend installing the latest stable toolchain with rustup)

Setup local development environment for Python bindings

  1. Create a local virtualenv for running Python tests and install maturin and pytest
python -m venv .venv
source .venv/bin/activate
pip install maturin pytest
  1. Build the reclass-rs Python library and install it in the virtualenv
maturin develop
  1. Run Python tests
pytest

Rust development

You should be able to run the Rust tests through Cargo if you have the Rust toolchain setup:

cargo test

Linting and formatting

  • Use cargo fmt to format code
  • Use cargo check for checking that the code compiles
  • Use cargo clippy to check for code issues

Benchmarks

You can run benchmarks for Reclass::render_inventory() with

cargo bench -F bench

The benchmarks are implemented with criterion.

Testing reclass-rs in Kapitan

If you're using Kapitan, you can test reclass-rs by installing reclass-rs in your Kapitan virtualenv:

  1. Install reclass-rs in your Kapitan virtualenv
KAPITAN_VENV=/path/to/your/kapitan/virtualenv
source ${KAPITAN_VENV}/bin/activate
pip install reclass-rs
  1. Patch the Kapitan package in the virtualenv with the following command
patch -p1 -d $KAPITAN_VENV < hack/kapitan_0.32_reclass_rs.patch

Please note that we've only tested the patch against the Kapitan 0.32 release as published on PyPI.

Automated package version management

We generate the package version of reclass-rs from the latest Git tag when building Python wheels. To ensure this always works, we keep the version in the committed Cargo.toml as 0.0.0.

We generate the package version from Git by calling git describe --tags --always --match=v*. This command produces something like v0.1.1-61-g531ca91. We always strip the leading v, since neither Cargo nor maturin support versions with leading v. If we're building a branch or PR, we discard the component derived from the commit hash. For the example output above, the package version for a branch or PR build will become 0.1.1.post61. For tag builds, the command ouptut will be just the tag, so the package version will match the tag.

The version is injected with cargo-edit's cargo set-version before the Python wheels are built.

See the "Python" workflow for more 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

reclass_rs-0.4.0.tar.gz (76.8 kB view hashes)

Uploaded Source

Built Distributions

reclass_rs-0.4.0-pp310-pypy310_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (2.3 MB view hashes)

Uploaded PyPy manylinux: glibc 2.17+ x86-64

reclass_rs-0.4.0-pp310-pypy310_pp73-manylinux_2_17_s390x.manylinux2014_s390x.whl (2.6 MB view hashes)

Uploaded PyPy manylinux: glibc 2.17+ s390x

reclass_rs-0.4.0-pp310-pypy310_pp73-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl (2.5 MB view hashes)

Uploaded PyPy manylinux: glibc 2.17+ ppc64le

reclass_rs-0.4.0-pp310-pypy310_pp73-manylinux_2_17_armv7l.manylinux2014_armv7l.whl (2.2 MB view hashes)

Uploaded PyPy manylinux: glibc 2.17+ ARMv7l

reclass_rs-0.4.0-pp310-pypy310_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (2.3 MB view hashes)

Uploaded PyPy manylinux: glibc 2.17+ ARM64

reclass_rs-0.4.0-pp310-pypy310_pp73-manylinux_2_12_i686.manylinux2010_i686.whl (2.3 MB view hashes)

Uploaded PyPy manylinux: glibc 2.12+ i686

reclass_rs-0.4.0-pp39-pypy39_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (2.3 MB view hashes)

Uploaded PyPy manylinux: glibc 2.17+ x86-64

reclass_rs-0.4.0-pp39-pypy39_pp73-manylinux_2_17_s390x.manylinux2014_s390x.whl (2.6 MB view hashes)

Uploaded PyPy manylinux: glibc 2.17+ s390x

reclass_rs-0.4.0-pp39-pypy39_pp73-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl (2.5 MB view hashes)

Uploaded PyPy manylinux: glibc 2.17+ ppc64le

reclass_rs-0.4.0-pp39-pypy39_pp73-manylinux_2_17_armv7l.manylinux2014_armv7l.whl (2.2 MB view hashes)

Uploaded PyPy manylinux: glibc 2.17+ ARMv7l

reclass_rs-0.4.0-pp39-pypy39_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (2.3 MB view hashes)

Uploaded PyPy manylinux: glibc 2.17+ ARM64

reclass_rs-0.4.0-pp39-pypy39_pp73-manylinux_2_12_i686.manylinux2010_i686.whl (2.3 MB view hashes)

Uploaded PyPy manylinux: glibc 2.12+ i686

reclass_rs-0.4.0-pp38-pypy38_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (2.3 MB view hashes)

Uploaded PyPy manylinux: glibc 2.17+ x86-64

reclass_rs-0.4.0-pp38-pypy38_pp73-manylinux_2_17_s390x.manylinux2014_s390x.whl (2.6 MB view hashes)

Uploaded PyPy manylinux: glibc 2.17+ s390x

reclass_rs-0.4.0-pp38-pypy38_pp73-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl (2.5 MB view hashes)

Uploaded PyPy manylinux: glibc 2.17+ ppc64le

reclass_rs-0.4.0-pp38-pypy38_pp73-manylinux_2_17_armv7l.manylinux2014_armv7l.whl (2.2 MB view hashes)

Uploaded PyPy manylinux: glibc 2.17+ ARMv7l

reclass_rs-0.4.0-pp38-pypy38_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (2.3 MB view hashes)

Uploaded PyPy manylinux: glibc 2.17+ ARM64

reclass_rs-0.4.0-pp38-pypy38_pp73-manylinux_2_12_i686.manylinux2010_i686.whl (2.3 MB view hashes)

Uploaded PyPy manylinux: glibc 2.12+ i686

reclass_rs-0.4.0-cp313-cp313-manylinux_2_17_s390x.manylinux2014_s390x.whl (2.6 MB view hashes)

Uploaded CPython 3.13 manylinux: glibc 2.17+ s390x

reclass_rs-0.4.0-cp313-cp313-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl (2.5 MB view hashes)

Uploaded CPython 3.13 manylinux: glibc 2.17+ ppc64le

reclass_rs-0.4.0-cp313-cp313-manylinux_2_17_armv7l.manylinux2014_armv7l.whl (2.2 MB view hashes)

Uploaded CPython 3.13 manylinux: glibc 2.17+ ARMv7l

reclass_rs-0.4.0-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (2.3 MB view hashes)

Uploaded CPython 3.13 manylinux: glibc 2.17+ ARM64

reclass_rs-0.4.0-cp312-none-win_amd64.whl (1.1 MB view hashes)

Uploaded CPython 3.12 Windows x86-64

reclass_rs-0.4.0-cp312-none-win32.whl (1.1 MB view hashes)

Uploaded CPython 3.12 Windows x86

reclass_rs-0.4.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (2.3 MB view hashes)

Uploaded CPython 3.12 manylinux: glibc 2.17+ x86-64

reclass_rs-0.4.0-cp312-cp312-manylinux_2_17_s390x.manylinux2014_s390x.whl (2.6 MB view hashes)

Uploaded CPython 3.12 manylinux: glibc 2.17+ s390x

reclass_rs-0.4.0-cp312-cp312-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl (2.5 MB view hashes)

Uploaded CPython 3.12 manylinux: glibc 2.17+ ppc64le

reclass_rs-0.4.0-cp312-cp312-manylinux_2_17_armv7l.manylinux2014_armv7l.whl (2.2 MB view hashes)

Uploaded CPython 3.12 manylinux: glibc 2.17+ ARMv7l

reclass_rs-0.4.0-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (2.3 MB view hashes)

Uploaded CPython 3.12 manylinux: glibc 2.17+ ARM64

reclass_rs-0.4.0-cp312-cp312-manylinux_2_12_i686.manylinux2010_i686.whl (2.3 MB view hashes)

Uploaded CPython 3.12 manylinux: glibc 2.12+ i686

reclass_rs-0.4.0-cp312-cp312-macosx_11_0_arm64.whl (1.3 MB view hashes)

Uploaded CPython 3.12 macOS 11.0+ ARM64

reclass_rs-0.4.0-cp312-cp312-macosx_10_12_x86_64.whl (1.4 MB view hashes)

Uploaded CPython 3.12 macOS 10.12+ x86-64

reclass_rs-0.4.0-cp311-none-win_amd64.whl (1.1 MB view hashes)

Uploaded CPython 3.11 Windows x86-64

reclass_rs-0.4.0-cp311-none-win32.whl (1.1 MB view hashes)

Uploaded CPython 3.11 Windows x86

reclass_rs-0.4.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (2.3 MB view hashes)

Uploaded CPython 3.11 manylinux: glibc 2.17+ x86-64

reclass_rs-0.4.0-cp311-cp311-manylinux_2_17_s390x.manylinux2014_s390x.whl (2.6 MB view hashes)

Uploaded CPython 3.11 manylinux: glibc 2.17+ s390x

reclass_rs-0.4.0-cp311-cp311-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl (2.5 MB view hashes)

Uploaded CPython 3.11 manylinux: glibc 2.17+ ppc64le

reclass_rs-0.4.0-cp311-cp311-manylinux_2_17_armv7l.manylinux2014_armv7l.whl (2.2 MB view hashes)

Uploaded CPython 3.11 manylinux: glibc 2.17+ ARMv7l

reclass_rs-0.4.0-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (2.3 MB view hashes)

Uploaded CPython 3.11 manylinux: glibc 2.17+ ARM64

reclass_rs-0.4.0-cp311-cp311-manylinux_2_12_i686.manylinux2010_i686.whl (2.3 MB view hashes)

Uploaded CPython 3.11 manylinux: glibc 2.12+ i686

reclass_rs-0.4.0-cp311-cp311-macosx_11_0_arm64.whl (1.3 MB view hashes)

Uploaded CPython 3.11 macOS 11.0+ ARM64

reclass_rs-0.4.0-cp311-cp311-macosx_10_12_x86_64.whl (1.4 MB view hashes)

Uploaded CPython 3.11 macOS 10.12+ x86-64

reclass_rs-0.4.0-cp310-none-win_amd64.whl (1.1 MB view hashes)

Uploaded CPython 3.10 Windows x86-64

reclass_rs-0.4.0-cp310-none-win32.whl (1.1 MB view hashes)

Uploaded CPython 3.10 Windows x86

reclass_rs-0.4.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (2.3 MB view hashes)

Uploaded CPython 3.10 manylinux: glibc 2.17+ x86-64

reclass_rs-0.4.0-cp310-cp310-manylinux_2_17_s390x.manylinux2014_s390x.whl (2.6 MB view hashes)

Uploaded CPython 3.10 manylinux: glibc 2.17+ s390x

reclass_rs-0.4.0-cp310-cp310-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl (2.5 MB view hashes)

Uploaded CPython 3.10 manylinux: glibc 2.17+ ppc64le

reclass_rs-0.4.0-cp310-cp310-manylinux_2_17_armv7l.manylinux2014_armv7l.whl (2.2 MB view hashes)

Uploaded CPython 3.10 manylinux: glibc 2.17+ ARMv7l

reclass_rs-0.4.0-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (2.3 MB view hashes)

Uploaded CPython 3.10 manylinux: glibc 2.17+ ARM64

reclass_rs-0.4.0-cp310-cp310-manylinux_2_12_i686.manylinux2010_i686.whl (2.3 MB view hashes)

Uploaded CPython 3.10 manylinux: glibc 2.12+ i686

reclass_rs-0.4.0-cp310-cp310-macosx_11_0_arm64.whl (1.3 MB view hashes)

Uploaded CPython 3.10 macOS 11.0+ ARM64

reclass_rs-0.4.0-cp310-cp310-macosx_10_12_x86_64.whl (1.4 MB view hashes)

Uploaded CPython 3.10 macOS 10.12+ x86-64

reclass_rs-0.4.0-cp39-none-win_amd64.whl (1.1 MB view hashes)

Uploaded CPython 3.9 Windows x86-64

reclass_rs-0.4.0-cp39-none-win32.whl (1.1 MB view hashes)

Uploaded CPython 3.9 Windows x86

reclass_rs-0.4.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (2.3 MB view hashes)

Uploaded CPython 3.9 manylinux: glibc 2.17+ x86-64

reclass_rs-0.4.0-cp39-cp39-manylinux_2_17_s390x.manylinux2014_s390x.whl (2.6 MB view hashes)

Uploaded CPython 3.9 manylinux: glibc 2.17+ s390x

reclass_rs-0.4.0-cp39-cp39-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl (2.5 MB view hashes)

Uploaded CPython 3.9 manylinux: glibc 2.17+ ppc64le

reclass_rs-0.4.0-cp39-cp39-manylinux_2_17_armv7l.manylinux2014_armv7l.whl (2.2 MB view hashes)

Uploaded CPython 3.9 manylinux: glibc 2.17+ ARMv7l

reclass_rs-0.4.0-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (2.3 MB view hashes)

Uploaded CPython 3.9 manylinux: glibc 2.17+ ARM64

reclass_rs-0.4.0-cp39-cp39-manylinux_2_12_i686.manylinux2010_i686.whl (2.3 MB view hashes)

Uploaded CPython 3.9 manylinux: glibc 2.12+ i686

reclass_rs-0.4.0-cp38-none-win_amd64.whl (1.1 MB view hashes)

Uploaded CPython 3.8 Windows x86-64

reclass_rs-0.4.0-cp38-none-win32.whl (1.1 MB view hashes)

Uploaded CPython 3.8 Windows x86

reclass_rs-0.4.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (2.3 MB view hashes)

Uploaded CPython 3.8 manylinux: glibc 2.17+ x86-64

reclass_rs-0.4.0-cp38-cp38-manylinux_2_17_s390x.manylinux2014_s390x.whl (2.6 MB view hashes)

Uploaded CPython 3.8 manylinux: glibc 2.17+ s390x

reclass_rs-0.4.0-cp38-cp38-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl (2.5 MB view hashes)

Uploaded CPython 3.8 manylinux: glibc 2.17+ ppc64le

reclass_rs-0.4.0-cp38-cp38-manylinux_2_17_armv7l.manylinux2014_armv7l.whl (2.2 MB view hashes)

Uploaded CPython 3.8 manylinux: glibc 2.17+ ARMv7l

reclass_rs-0.4.0-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (2.3 MB view hashes)

Uploaded CPython 3.8 manylinux: glibc 2.17+ ARM64

reclass_rs-0.4.0-cp38-cp38-manylinux_2_12_i686.manylinux2010_i686.whl (2.3 MB view hashes)

Uploaded CPython 3.8 manylinux: glibc 2.12+ i686

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page