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, 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.


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
Classes Inheritance, visibility, static members, constructors, super
Standard library Core builtins and the map, array, string, 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.1

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.1
File Size Uploaded
koskript-1.4.1.tar.gz 61.4 kB Details

Built distribution (wheel)

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

Total release size: 108.2 kB

Release files / koskript-1.4.1.tar.gz

Download URL koskript-1.4.1.tar.gz
Size 61.4 kB
Tags Source
SHA-256 checksum
How to use checksums
a7b1ad29b2278dabde18f167643c142f34d02833e7dc9fab9e6b99875bc7728e
BLAKE2b-256 checksum
How to use checksums
de7b6bc6173c469285a6e21635acc1a970d89da05a40ed65dd46e09586d57974
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.1-py3-none-any.whl

Download URL koskript-1.4.1-py3-none-any.whl
Size 46.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
54f87e51bf0ad64274347fe77b9b46da4ffedff5e8e5764c8a77e60044afcd51
BLAKE2b-256 checksum
How to use checksums
c9b0d3801fc74b90fd15efd2dc6dc74e82a574e2db57ff343ba1455dbf3884b5
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

1.4.2

2 release files

This release

1.4.1 This release

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