Skip to content

Modules and Packages

0x4171341 edited this page Jul 24, 2026 · 2 revisions

Modules and Packages

Imports

import utils.mathx
from stdlib.math import pow

Dotted imports map to paths:

utils.mathx -> utils/mathx.lpp

Example

utils/mathx.lpp:

def double(x: Int) -> Int:
    return x * 2

def triple(x: Int) -> Int:
    return x * 3

main.lpp:

import utils.mathx
from stdlib.math import pow

def main():
    print(double(21))
    print(triple(10))
    print(pow(2, 8))

Search order

When the compiler sees an import, it searches:

  1. Relative to the importing file
  2. .lpp_packages/<package>/...
  3. The bundled stdlib/

Package manager

lpp new app
cd app
lpp add lpp-zip
lpp install
lpp build
lpp run

Registry

The JSON registry is hosted through GitHub Pages:

https://samarnever-droid.github.io/lplusplus/registry/index.json

Packages currently include:

  • lpp-zip
  • lpp-math
  • lpp-strings
  • lpp-collections
  • lpp-algo
  • lpp-convert

Import aliases

Alias syntax is parsed:

import utils.mathx as mathx

Namespace behavior for aliases is still experimental, so stable examples should prefer plain import module or from module import item.

Clone this wiki locally