Registry / ai-ml / portalis

portalis

JSON →
library0.1.6jsnpmunverified

Portalis is a production-ready platform (v0.1.6) that translates Python codebases into Rust and compiles them to WebAssembly, featuring CPU SIMD optimization (AVX2, SSE4.2, NEON) and optional GPU acceleration via CUDA. Built on the Wassette runtime, it delivers up to 7.8× speedup through arena allocation, string interning, and object pooling. Supports Python 3.11+, Rust 1.75+, and outputs WASM, native binaries, or libraries. Released as an npm package (Node >=14.0.0) and cargo crate. Differentiators over similar tools include multi-tier acceleration, enterprise features (RBAC, SSO), and a complete pipeline with agent swarm architecture. Currently in active development with 137 tests and 35k+ LOC.

npm install portalis
INSTALL
IMPORT
SIG · PORTALIS
P
portalis
ai-mljavascriptv0.1.6
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

portalis
import portalis from 'portalis'
const portalis = require('portalis')
Portalis is an ESM-only package; require() will fail. Use ES module import.
translate
import { translate } from 'portalis'
import translate from 'portalis'
Named export 'translate' is the main function; default export is the module namespace.
WassetteRuntime
import { WassetteRuntime } from 'portalis/runtime'
import { WassetteRuntime } from 'portalis'
WassetteRuntime is exported from a subpath 'portalis/runtime' to avoid heavy dependencies in the main entry.

Demonstrates Python-to-WASM pipeline: translate Python factorial function to Rust, compile to WASM with SIMD, and execute using WassetteRuntime.

import { translate, compile } from 'portalis'; async function main() { // Translate Python code to Rust source const rustCode = await translate(` def factorial(n): if n <= 1: return 1 return n * factorial(n-1) `, { target: 'wasm' }); console.log('Generated Rust:', rustCode); // Compile to WebAssembly binary const wasmBuffer = await compile(rustCode, { optimization: 'speed', simd: true, gpu: false }); console.log('WASM binary size:', wasmBuffer.length, 'bytes'); // Execute in Wassette runtime const { WassetteRuntime } = await import('portalis/runtime'); const runtime = new WassetteRuntime(); const instance = await runtime.load(wasmBuffer); const result = instance.exports.factorial(10); console.log('factorial(10):', result); } main().catch(console.error);
portalis --version
Debug
Known issues
gotchaPortalis is ESM-only; requires Node >=14.0.0 and 'type': 'module' in package.json or .mjs extension.
fix
Add "type": "module" to package.json or rename files to .mjs.
affects: >=0.1.0
gotchaGPU acceleration (CUDA) is optional and requires NVIDIA drivers, CUDA toolkit, and explicit enabling via options.gpu: true.
fix
Set { gpu: true } in translate/compile options and ensure CUDA environment is configured.
affects: >=0.1.0
breakingWassetteRuntime moved from 'portalis' to 'portalis/runtime' in v0.1.4; imports from the main entry will fail.
fix
Update import to 'portalis/runtime'.
affects: >=0.1.4
gotchaSIMD optimizations (AVX2/NEON) are enabled by default but may cause issues in non-native environments (e.g., some cloud containers). Disable with { simd: false }.
fix
Pass { simd: false } to translate or compile options.
affects: >=0.1.0
deprecatedThe 'wasm' output format uses the old Wassette v1 runtime; v2 is in preview and activated via { runtimeVersion: 2 }.
fix
For new projects, set { runtimeVersion: 2 } to use the preview Wassette v2 runtime.
affects: >=0.1.5 <0.2.0
Errors
Common errors & fixes
Error [ERR_REQUIRE_ESM]: require() of ES Module /path/to/node_modules/portalis/index.js not supported.
Portalis is ESM-only; using require() instead of import.
fix
Use import statement or dynamic import(). If using CommonJS, consider dynamic import: const portalis = await import('portalis');
TypeError: Cannot read properties of undefined (reading 'factorial')
Trying to call an exported function before the WASM instance is fully initialized.
fix
Ensure runtime.load() is awaited and the module exports are accessed after the promise resolves.
error[portalis]: GPU acceleration requires CUDA toolkit and NVIDIA GPU. Set 'gpu: false' to disable.
CUDA environment not set up but GPU option enabled.
fix
Install CUDA toolkit and drivers, or disable GPU: { gpu: false }.
SyntaxError: Unexpected token 'export'
Trying to run Portalis in a CommonJS context without proper module system.
fix
Use ESM: add "type": "module" in package.json or rename to .mjs.
Upgrade
Version history
0.1.6latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
4 hits · last 30 days
node
4
Resources
portalis — npm install portalis · libregistry