Keyboard shortcuts

Press ← or β†’ to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Migration from Python

This guide helps you migrate from the Python version of nyl to the Rust version.

Compatibility Status

Phase 1: βœ… Compatible

The Rust version in Phase 1 is compatible with existing Python nyl projects for:

  • Configuration loading (YAML/JSON)
  • Project structure
  • Component creation
  • Configuration validation

Phase 2+: 🚧 In Progress

Full compatibility for template rendering, Helm integration, and Kubernetes operations will be available in later phases.

Installation

Uninstall Python nyl (Optional)

pip uninstall nyl

Install Rust nyl

cd nyl-rs
cargo install --path .

Or use the pre-built binary from releases.

Configuration

No Changes Needed

Your existing nyl-project.yaml files work as-is:

settings:
  generate_applysets: false
  on_lookup_failure: Error
  components_path: components
  search_path:
    - .
    - lib

TOML Support

TOML support (nyl-project.toml) is planned for Phase 2 or later. For now, use YAML or JSON.

Unknown Fields

The Rust version will warn about unknown fields in the configuration but will not fail. This provides forward compatibility.

Commands

Phase 1 Commands

CommandPythonRustStatus
new projectβœ…βœ…Compatible
new componentβœ…βœ…Compatible
validateβœ…βœ…Compatible

Phase 2+ Commands

CommandPythonRustStatus
renderβœ…πŸš§Phase 3
diffβœ…πŸš§Phase 4
applyβœ…πŸš§Phase 4

Validation

Run validation to ensure compatibility:

nyl validate

If validation passes, your project is compatible with nyl-rs.

Behavior Differences

Path Resolution

Both versions resolve relative paths the same way:

  • Relative to the configuration file’s parent directory
  • Absolute paths remain unchanged

Error Messages

Error messages in Rust nyl may be more concise but provide the same information.

Performance

The Rust version is significantly faster:

  • Configuration loading: ~5-10x faster
  • File operations: ~2-3x faster
  • Overall: ~5-10x faster (goal)

Migration Checklist

  • Install Rust nyl
  • Run nyl validate on existing projects
  • Test nyl new component for creating new components
  • Verify configuration loading works
  • Update CI/CD pipelines to use new binary
  • Wait for Phase 2+ for full feature parity

Feature Comparison

Phase 1 Features

FeaturePythonRust
YAML configβœ…βœ…
JSON configβœ…βœ…
TOML configβœ…πŸš§ Phase 2
Config validationβœ…βœ…
Project scaffoldingβœ…βœ…
Component scaffoldingβœ…βœ…
File discoveryβœ…βœ…
Verbose loggingβœ…βœ…

Phase 2+ Features

FeaturePythonRust
Component discoveryβœ…πŸš§ Phase 2
Helm integrationβœ…πŸš§ Phase 2
Template renderingβœ…πŸš§ Phase 3
Profile supportβœ…πŸš§ Phase 2
Secret providersβœ…πŸš§ Phase 2
Kubernetes applyβœ…πŸš§ Phase 4
Diff commandβœ…πŸš§ Phase 4

Breaking Changes

None in Phase 1

Phase 1 maintains full backward compatibility with Python nyl.

Future Phases

Breaking changes (if any) will be documented when they are introduced. The goal is to maintain compatibility wherever possible.

Getting Help

If you encounter issues during migration:

  1. Run nyl validate --strict to identify problems
  2. Check the Configuration documentation
  3. Review command documentation for syntax changes
  4. File an issue on GitHub

Performance Comparison

Benchmarks show significant performance improvements:

OperationPythonRustImprovement
Config load5ms0.5ms10x
Validation10ms1ms10x
Project creation50ms5ms10x

Binary size: 2.0MB (Rust) vs ~50MB (Python with dependencies)

Rollback Plan

If you need to rollback to Python nyl:

# Uninstall Rust nyl
cargo uninstall nyl

# Reinstall Python nyl
pip install nyl

Your project files remain unchanged and will work with either version.