Skip to main content

A high-performance Minecraft schematic parser and utility library

Project description

🧬 Nucleation

Nucleation is a high-performance Minecraft schematic engine written in Rust — with full support for Rust, WebAssembly/JavaScript, Python, and FFI-based integrations like PHP and C.

Built for performance, portability, and parity across ecosystems.


Crates.io npm PyPI CI/CD


✨ Features

  • Multi-format support: .schematic, .litematic, .nbt, etc.
  • 🧠 Memory-safe Rust core with zero-copy deserialization
  • 🌐 WASM module for browser + Node.js with TypeScript support
  • 🐍 Native Python bindings (pip install nucleation)
  • ⚙️ C-compatible FFI for PHP, C, Go, etc.
  • 🎨 Blockpedia integration for color analysis and block transformations (native targets)
  • 🔄 Feature parity across all interfaces via single API definition
  • 📦 Binary builds for Linux, macOS, Windows (x86_64 + ARM64)
  • 🚀 Automatic binding generation from centralized API definitions
  • 🧪 Comprehensive test suite with CI/CD pipeline

📦 Installation

🔧 Rust

cargo add nucleation

🌐 JavaScript / TypeScript (WASM)

npm install nucleation

🐍 Python

pip install nucleation

🧩 C / PHP / FFI

Download prebuilt .so / .dylib / .dll from Releases or build locally using:

./build-ffi.sh

🚀 Quick Examples

Rust

use nucleation::UniversalSchematic;

let bytes = std::fs::read("example.litematic")?;
let mut schematic = UniversalSchematic::new("my_schematic");
schematic.load_from_data(&bytes)?;
println!("{:?}", schematic.get_info());

📖 → Documentation | Complete Code Example


JavaScript (WASM)

import { SchematicParser } from "nucleation";

const bytes = await fetch("example.litematic").then(r => r.arrayBuffer());
const parser = new SchematicParser();
await parser.fromData(new Uint8Array(bytes));

console.log(parser.getDimensions());

📖 → Documentation | Complete Code Example


Python

from nucleation import Schematic

with open("example.litematic", "rb") as f:
    data = f.read()

schem = Schematic("my_schematic")
schem.load_from_bytes(data)

print(schem.get_info())

📖 → Documentation | Complete Code Example


FFI (PHP/C)

#include "nucleation.h"

SchematicHandle* handle = schematic_new("MySchem");
schematic_load_data(handle, data_ptr, data_len);

CSchematicInfo info;
schematic_get_info(handle, &info);
printf("Size: %dx%dx%d\n", info.width, info.height, info.depth);

schematic_free(handle);

📖 → Documentation | Complete Code Example


🔧 Development

Building

# Build the Rust core
cargo build --release

# Build WASM module with target support
cargo build --target wasm32-unknown-unknown --features wasm
./build-wasm.sh

# Build Python bindings locally
maturin develop --features python

# Build FFI libs
./build-ffi.sh

🤖 Automated Binding Generation

Nucleation uses a single source of truth approach for all bindings. The API is defined once in src/api_definition.rs and automatically translated to all supported languages:

# Generate all binding files from API definition
cargo run --bin generate-bindings

# Check if bindings are up to date
cargo run --bin generate-bindings check

# Generate API documentation report
cargo run --bin generate-bindings report

This generates:

  • WASM: TypeScript definitions and JavaScript bindings
  • Python: PyO3 bindings and .pyi type stubs
  • FFI: C header files and Rust FFI implementations

🧪 Testing

# Run all tests
cargo test

# Test specific targets
cargo test --features wasm --test wasm_tests        # WASM tests
cargo test --test python_tests                      # Python tests
cargo test --test blockpedia_integration_test       # Blockpedia tests (non-WASM only)

# Test WASM build specifically
cargo build --target wasm32-unknown-unknown --features wasm

Note: WASM builds exclude blockpedia features for compatibility. Color analysis and block transformations are available only on native targets.

Version Management

Versions are centrally managed in version.toml. Use the Makefile commands:

# Check version consistency across all files
make version-check

# Bump versions automatically
make version-bump-patch    # 0.1.0 → 0.1.1
make version-bump-minor    # 0.1.0 → 0.2.0  
make version-bump-major    # 0.1.0 → 1.0.0

# Update all files from version.toml
make version-update

📖 → Full Version Management Guide


📚 Submodules & Bindings

📄 Documentation & Examples

Each binding includes comprehensive documentation and working code examples:

Language API Documentation Working Example Type Definitions
Rust examples/rust.md examples/rust_example.rs Native Rust docs
JavaScript/WASM examples/wasm.md examples/wasm_example.js pkg/nucleation.d.ts
Python examples/python.md examples/python_example.py python-stubs/nucleation.pyi
C/FFI examples/ffi.md examples/ffi_example.c include/nucleation.h

⚖️ License

Licensed under the GNU AGPL-3.0-only. See LICENSE for full terms.

Made by @Nano112 with ❤️

Project details


Release history Release notifications | RSS feed

Download files

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

Source Distribution

nucleation-0.1.58.tar.gz (6.1 MB view details)

Uploaded Source

Built Distribution

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

nucleation-0.1.58-cp312-cp312-manylinux_2_34_x86_64.whl (514.6 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.34+ x86-64

File details

Details for the file nucleation-0.1.58.tar.gz.

File metadata

  • Download URL: nucleation-0.1.58.tar.gz
  • Upload date:
  • Size: 6.1 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: maturin/1.9.0

File hashes

Hashes for nucleation-0.1.58.tar.gz
Algorithm Hash digest
SHA256 3d8856ae0f54f611ad14d9a9d7e90d69ce007caca5308491e3f1e64e94f305f0
MD5 5642e2e189d76782dcec0fd2e11e7316
BLAKE2b-256 a3e3f8e1d8f97373c1818c0f27f750b91a809de438544216e1538efddf6d7919

See more details on using hashes here.

File details

Details for the file nucleation-0.1.58-cp312-cp312-manylinux_2_34_x86_64.whl.

File metadata

File hashes

Hashes for nucleation-0.1.58-cp312-cp312-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 e07a03a5c4ea784c1f827a9cf6d2f29ef551c734601fbf5a290678148d690c01
MD5 e7f4ac682b1d5cfd2b86be3e8e137f11
BLAKE2b-256 b2095ec51d6add1cf638007410a8e7e71adf78efd8e3fad48326b9b8c65b5beb

See more details on using hashes here.

Supported by

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