#name #options

optify

Simplifies getting the right configuration options for a process using pre-loaded configurations from files (JSON, YAML, etc.) to manage options for experiments or flights. This library is mainly made to support building implementations for other languages such as Node.js, Python, and Ruby. It is not meant to be consumed directly yet.

19 releases (10 breaking)

new 0.20.5 Dec 10, 2025
0.20.3 Oct 26, 2025
0.10.0 Jun 11, 2025
0.6.0 Mar 9, 2025

#365 in Configuration

MIT license

110KB
2.5K SLoC

Optify in Rust

Crates.io docs.rs

The core implementation of Optify in Rust. Simplifies getting the right configuration options for a process using pre-loaded configurations from files (JSON, YAML, etc.) to manage options for experiments or flights.

See tests for examples and tests for different implementations of this format for managing options.

See the root README.md for more information and examples.

⚠️ Development in progress ⚠️
APIs are not final and may change, for example, names may change. This is just meant to be minimal to get started and help build Python and Ruby libraries.

How It Works

The config crate (library) is used to help load configuration files. This allows us to load many different types of files, including JSON, JSON5, YAML, and more. We no longer use the config crate to combine configuration files because it was slower to merge them and deserialize the result than our custom merging logic since we know that we want to use serde_json::Values.

We merge configurations starting with the first one given and thus the final feature overrides the previous ones. We may try to optimize further in the future, but this is fine now when there are just a few features or imports and when keys are mostly unique.

Optionally, when working locally, there is support to watch for changes to the configuration files and folders using the notify-debouncer-full crate (library).

Testing

Run:

cargo test

Formatting

To automatically change code, run:

cargo fmt && cargo clippy --fix --allow-dirty --allow-staged

Benchmarking

Run:

cargo build --release
cargo bench

# Run one specific benchmark, example:
cargo bench --bench get_options_benchmark

# Open one of the reports
open target/criterion/*/report/index.html 

Publishing

cargo login
cargo publish

Dependencies

~16–30MB
~443K SLoC