Skip to main content

Koskript

Koskript

Koskript is a simple, embeddable, and lightweight scripting language for Python applications. It features dynamic typing, lexical scoping, closures, classes and native Python interop — letting you expose any Python function or object directly to your scripts.

See the documentation here

from koskript import KoskriptRuntime

runtime = KoskriptRuntime()
runtime.execute("""
const names = ["Ana", "Luis"]
array.each(names, (name) { print("hello " + name) })
""")

NOTE: Koskript is in early development; expect the language and API to change between releases.


Features

  • Dynamic typing.
  • Block-level lexical scoping with local declarations.
  • Namespaces (namespace Name { ... }) to group declarations.
  • Closures that capture their defining scope, including this inside methods.
  • Constants with const.
  • Classes with inheritance, visibility, static methods and constructors.
  • Standard library: core builtins plus map, array, string, bytes, math and json.
  • Module imports with per-module resolution (import "utils").
  • Configurable import search paths (runtime.add_import_path).
  • Native Python interop for functions, objects and classes.
  • if, elseif, else.
  • while, for, foreach loops with break / continue.
  • Error handling with error declarations, throw, try / catch / finally.
  • Member access and index access.
  • First-class functions and lambda expressions.
  • Wrappers with implicit return and Python-style decorators (@wrapper).
  • Arithmetic, comparison and logical operators.
  • Embeddable in any Python application.

Installation

pip install -U koskript

Or clone the repository and import it directly:

git clone https://github.com/alesis-buzz/koskript.git

Koskript requires Python 3.10+ and Lark. There is an experimental dependency-free parser behind KoskriptRuntime(native_parser_experiment=True).


Documentation

Document What it covers
Getting started Installation, first script, a complete example
Language reference Types, variables, operators, control flow, errors, functions, wrappers, namespaces, closures, modules, loops, strings, bytes
Classes Inheritance, visibility, static members, constructors, super
Standard library Core builtins and the map, array, string, bytes, math and json namespaces
Python interop Exposing Python values, callables and classes to scripts
Embedding guide KoskriptRuntime, run(), error handling and stdlib activation
Roadmap What is done, what is planned, known limitations

License

Koskript is licensed under the Mozilla Public License 2.0 (MPL-2.0). See LICENSE for the full text.

You are free to use, modify, and redistribute Koskript. However, you may not redistribute this project under a different name or claim authorship of the Koskript language.

Koskript is a trademark of Alesis.


Built with ❤️ by Alesis

Metadata

Release files for koskript 1.4.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for koskript 1.4.2
File Size Uploaded
koskript-1.4.2.tar.gz 88.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for koskript 1.4.2
File Interpreter ABI Platform
koskript-1.4.2-py3-none-any.whl Python 3 none any Details

Total release size: 149.0 kB

Release files / koskript-1.4.2.tar.gz

Download URL koskript-1.4.2.tar.gz
Size 88.2 kB
Tags Source
SHA-256 checksum
How to use checksums
180cf74bee6232c4e75e61035ec560b0ffee7828172b52536b86bbe7e7423437
BLAKE2b-256 checksum
How to use checksums
6e9d6f99a7c0ebc01e90bcf84db5443de9d2b1ce1ba1c19024930ea4b5657f8a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.6

Release files / koskript-1.4.2-py3-none-any.whl

Download URL koskript-1.4.2-py3-none-any.whl
Size 60.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
6d0e55dec9618842e2e8d7c2ccad9e158e60e930cb38daab03c8af9808db00de
BLAKE2b-256 checksum
How to use checksums
c29c9cf866bf765582d719bbe5c13fd6e2ddaf9b0e9848e8d84ab17251348ac8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.6

Release history Release notifications | RSS feed

This release

1.4.2 This release

2 release files

1.4.1

2 release files

1.4.0

2 release files

1.3.1

2 release files

1.2.1

2 release files

1.2.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page