Skip to main content

nskit Recipe System

Flexible, client/service architecture for managing code generation recipes with intelligent 3-way merge updates.

Architecture

nskit is organized into focused modules:

  • client/ - Recipe operations (initialization, updates, backends, diff/merge)
  • mixer/ - Core templating and component system
  • recipes/ - Pre-defined recipe implementations
  • cli/ - Command-line interface (thin wrapper over client)

Quick Start

For Recipe Users

# Install
pip install nskit

# List recipes
myrecipes list

# Initialize project (Docker mode - default)
myrecipes init --recipe python_package --input-yaml-path config.yaml

# Initialize project (local mode - development)
myrecipes init --recipe python_package --input-yaml-path config.yaml --local

# Update project
myrecipes update

For Recipe Builders

from nskit.mixer.components import Recipe, File, Folder

class MyRecipe(Recipe):
    contents = [
        File(name="README.md", content="# {{name}}\n"),
    ]

For Platform Engineers

from nskit.cli.app import create_cli
from nskit.client.backends import GitHubBackend

app = create_cli(
    recipe_entrypoint='mycompany.recipes',
    backend=GitHubBackend(org='myorg')
)

Features

  • Two Execution Modes — Docker (production, recommended) or local (recipe development)
  • Reproducible Updates — Docker mode pins each recipe version as an immutable image, enabling deterministic 3-way merges
  • Client/Service Architecture — Use programmatically, via CLI, or wrap with web API
  • Multiple Backends — Local filesystem, Docker registry, GitHub releases
  • 3-Way Merge Updates — Preserves user customisations while applying recipe updates
  • Conflict Detection — Intelligent merge with conflict reporting
  • Pluggable — Easy to extend with custom backends

Architecture

CLI Layer (Thin Wrapper)
    ↓
Client Layer (Pure Python)
    ↓
Engine Layer (Docker or Local)
    ↓
Backend Layer (Pluggable)

Documentation

Full documentation: https://docs.example.com

Installation

# Basic installation
pip install nskit

# With GitHub support
pip install nskit[github]

# With Docker support
pip install nskit[docker]

# With all extras
pip install nskit[all]

Backend Options

nskit supports multiple backends for recipe distribution:

Backend Discovery Execution Use Case Setup
LocalBackend Local files Local only Development None
GitHubBackend GitHub Releases Docker (ghcr.io) Production gh CLI + Docker
DockerBackend Docker registry Docker Custom registries Docker

Execution Modes:

  • Docker Mode (Default) — Recipes run in versioned containers. Each version is a pinned image, enabling deterministic 3-way merge updates. Recommended for production.
  • Local Mode (--local) — Recipes run from locally installed Python packages. Faster, but the output may vary across environments. Best for recipe development only.

See Architecture for the detailed design rationale and Docker vs Local Execution for the execution flow.

Custom Backends — Third-party backends are discovered via the nskit.backends entry-point group. See Platform Integration for details.

Usage Examples

Programmatic Usage

from nskit.client import RecipeClient, UpdateClient
from nskit.client.engines import LocalEngine, DockerEngine
from nskit.client.backends import GitHubBackend
from pathlib import Path

# Initialise backend
backend = GitHubBackend(org='myorg')

# Create client with Docker engine (default, recommended)
client = RecipeClient(backend)

# Or with local engine for recipe development
client = RecipeClient(backend, engine=LocalEngine())

# List recipes
recipes = client.list_recipes()

# Initialize recipe
result = client.initialize_recipe(
    recipe='python_package',
    version='v1.0.0',
    parameters={'name': 'my-project'},
    output_dir=Path('./output')
)

# Update project
update_client = UpdateClient(backend)
result = update_client.update_project(
    project_path=Path('./my-project'),
    target_version='v2.0.0'
)

CLI Usage

# Discover recipes
myrecipes discover --search python

# Initialize project
myrecipes init \
  --recipe python_package \
  --input-yaml-path input.yaml \
  --output-base-path ./output

# Check for updates
myrecipes check

# Update with dry-run
myrecipes update --dry-run

# Update to specific version
myrecipes update --target-version v2.0.0

Web API Usage

from fastapi import FastAPI
from nskit.client import RecipeClient
from nskit.client.backends import GitHubBackend

app = FastAPI()
backend = GitHubBackend(org='myorg')
client = RecipeClient(backend)

@app.get("/recipes")
def list_recipes():
    return client.list_recipes()

Backend Configuration

Local Backend

type: local
path: /path/to/recipes

Docker Backend

type: docker
registry_url: ghcr.io
image_prefix: myorg/recipes
auth_token: ${GITHUB_TOKEN}

GitHub Backend

type: github
org: myorg
repo_pattern: recipe-{recipe_name}
token: ${GITHUB_TOKEN}

Development

# Clone repository
git clone https://github.com/yourorg/nskit.git
cd nskit

# Install dependencies
pip install -e ".[dev]"

# Run tests
pytest

# Build docs
mkdocs serve

Contributing

See CONTRIBUTING.md for development guidelines.

License

MIT License - see LICENSE for details.

Support

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

nskit-1.4.0.tar.gz (196.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

nskit-1.4.0-py3-none-any.whl (161.7 kB view details)

Uploaded Python 3

File details

Details for the file nskit-1.4.0.tar.gz.

File metadata

  • Download URL: nskit-1.4.0.tar.gz
  • Upload date:
  • Size: 196.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for nskit-1.4.0.tar.gz
Algorithm Hash digest
SHA256 f07e2740ae3035d3f1c415ab42738e3eb7a92643330de5cb74dff5aef601b491
MD5 1cfbffdba601a17dd2c1133049f01eb9
BLAKE2b-256 dc9419ac983fdfc495478fd3df9b8e0a6d5bd3d79e5e582111de25d7eea475ed

See more details on using hashes here.

Provenance

The following attestation bundles were made for nskit-1.4.0.tar.gz:

Publisher: pipeline.yaml on djpugh/nskit

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file nskit-1.4.0-py3-none-any.whl.

File metadata

  • Download URL: nskit-1.4.0-py3-none-any.whl
  • Upload date:
  • Size: 161.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for nskit-1.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 f41d37896b5cb63f01d2034311efe6e9966d3f76c78e6294783b96189283d80e
MD5 955320f0da65f31444446ac019194aa5
BLAKE2b-256 fde4b754997c3815d909904243c867981728ce7ad3fee20fb05e3ae6ff0b4afb

See more details on using hashes here.

Provenance

The following attestation bundles were made for nskit-1.4.0-py3-none-any.whl:

Publisher: pipeline.yaml on djpugh/nskit

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

1.5.0

2 files

This release

1.4.0 This release

2 files

1.3.0

2 files

1.2.0

2 files

1.1.0

2 files

1.0.0

2 files

0.1.2

2 files

0.1.1

2 files

0.1.0

2 files

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page