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
localdeclarations. - Namespaces (
namespace Name { ... }) to group declarations. - Closures that capture their defining scope, including
thisinside methods. - Constants with
const. - Classes with inheritance, visibility, static methods and constructors.
- Standard library: core builtins plus
map,array,string,bytes,mathandjson. - 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,foreachloops withbreak/continue.- Error handling with
errordeclarations,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.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| koskript-1.4.3.tar.gz | 74.3 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| koskript-1.4.3-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 137.5 kB
Release files / koskript-1.4.3.tar.gz
| Download URL | koskript-1.4.3.tar.gz |
|---|---|
| Size | 74.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
88cd2544829acc48558921429e53107a2d3708f36c1eb8f770c99fd2a1e9fda4
|
|
BLAKE2b-256 checksum How to use checksums |
b68d9983f883d72254ac2aa97d1b872710524a22e33d16d46731b6d8e547ce02
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.14.7
|
Release files / koskript-1.4.3-py3-none-any.whl
| Download URL | koskript-1.4.3-py3-none-any.whl |
|---|---|
| Size | 63.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
9d7dcf2238a9211c5d0f8340cefecef36e91c75408701f3831f7fcde59ac0f27
|
|
BLAKE2b-256 checksum How to use checksums |
7d7fca65312efdf7ff6bfc935d1d5185a0ac719d23eedcaadd0d44d3fa159603
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.14.7
|