Skip to main content

StarOS language runtime, parser, and CLI for StarOS source files.

Project description

StarOS

StarOS is a namespace-safe runtime with a real syntax and execution layer for StarOS source files.

Important: the PyPI distribution name for this project is staros-lang. The import package remains staros.

Features

  • py.* imports for Python modules
  • star.* imports for StarOS modules
  • app.* imports for local .star modules
  • alias support
  • runtime validation for import targets
  • lexer + parser for StarOS source
  • AST output for tooling and future execution
  • interpreter for running .star programs

Quick start

Install:

pip install staros-lang
from staros import import_module, from_import, parse_source

math_mod = import_module("py.math")
sqrt = from_import("py.math", "sqrt")
program = parse_source("let answer = 40 + 2")

CLI

staros import py.math
staros from py.math sqrt
staros parse example.star
staros run example.star
staros run examples/app_demo.star

Publish To PyPI

The package name staros is already taken on PyPI, so this project is configured to publish as staros-lang.

Build locally:

python -m pip install --upgrade build
python -m build

Test local installation from the built wheel:

python -m pip install --force-reinstall dist/staros_lang-0.1.1-py3-none-any.whl
python -m staros.cli run examples/hello.star

If staros is not found on Windows after pip install, add this folder to PATH:

C:\Users\<your-user>\AppData\Roaming\Python\Python314\Scripts

Until then, you can always run the CLI with:

python -m staros.cli run examples/hello.star

Publish options:

  1. Manual upload:
python -m pip install --upgrade twine
python -m twine upload dist/*
  1. GitHub Actions Trusted Publishing: Use .github/workflows/publish.yml, then configure the PyPI project to trust that workflow.

For Trusted Publishing on PyPI, configure:

  • Repository owner: your GitHub owner or org
  • Repository name: StarOS
  • Workflow file: .github/workflows/publish.yml
  • Environment: pypi

Current StarOS syntax

import py.math as math
from star.web import render_page as render

const title = "Empire"
let answer = math.sqrt(40 + 2)
let flags = [true, false, not false]

fn classify(value) {
    if value > 10 {
        return "high"
    } else {
        return "low"
    }
}

print(classify(answer))
print(title)

Local StarOS modules

Create a local file like app/greetings.star:

const empire_name = "StarOS"

fn greet(name) {
    return empire_name + " welcomes " + name
}

Then import it from another StarOS file:

import app.greetings as greetings
from app.greetings import greet

print(greetings.empire_name)
print(greet("Commander"))

Project details


Download files

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

Source Distribution

staros_lang-0.1.1.tar.gz (13.6 kB view details)

Uploaded Source

Built Distribution

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

staros_lang-0.1.1-py3-none-any.whl (14.9 kB view details)

Uploaded Python 3

File details

Details for the file staros_lang-0.1.1.tar.gz.

File metadata

  • Download URL: staros_lang-0.1.1.tar.gz
  • Upload date:
  • Size: 13.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.0

File hashes

Hashes for staros_lang-0.1.1.tar.gz
Algorithm Hash digest
SHA256 aa9789abe98e9909ce82820f288ce5404775f2d86f15bb6858befd1009453556
MD5 7958a8e65a8a30a8bccde63ab3b127ea
BLAKE2b-256 e7ef72600dfb444737f7b04fa9aab850efdf4b3671a1bb591627f66c87ccb5a8

See more details on using hashes here.

File details

Details for the file staros_lang-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: staros_lang-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 14.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.0

File hashes

Hashes for staros_lang-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 93c01f499bca39ca1b236ef2aa6a70b76035091725bedc770007b192d40b5b4a
MD5 618882e8111b9d5944c8bb23e6fe0286
BLAKE2b-256 42559969cbdb1f318413e71d4e17c462d066c9a66dccabd36c53623d770b57e6

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