Skip to main content

cyberlang - batteries included python bindings for cyber

license pypi version PyPI status discord

Built with cyberlang 0.3

Installation

pip install cyberlang

Usage

Simply create a CyberVM instance and evaluate a string:

from cyber import CyberVM

vm = CyberVM()
vm.eval("print 'hello world!'")

Want to capture printed output? Override the print function from Cyber's core module with a binding.

The decorator generates all the required wrappers and interfaces, and registers everything with Cyber's VM.

from cyber import CyberVM

vm = CyberVM()

@vm.function('core.print')
def _print(string: str):
    print(string)

vm.eval("print 'hello world!'")

Alternate techniques for creating callback functions:

# if no module, assume core
# same result as previous example
# this creates function "print2" in the "core" module
@cyber.function('print2')
def _print2(string: str):
    print(string)

# if no module, assume core
# if no function name, use existing function name
# this creates function "test" in the "core" module
@cyber.function
def test():
    print('core.test')

Or define multiple functions at once using this class-based syntax

# "core" already exists, so add a() and b() to it
class Core(cyber.module('core')):
    def a(self):
        print('core.test')
    def b(self):
        print('core.test2')

# create "new_module" and add c() and d() to it
@cyber.module('new_module')
class Module:
    def c(self):
        print('new_module.test')
    def d(self):
        print('new_module.test2')

# create module, implicitly named "NewModule" and add e() and f() to it
@cyber.module
class NewModule:
    def e(self):
        print('NewModule.test')
    def f(self):
        print('NewModule.test2')

Supporters

fubar - creator of the Cyber language

Metadata

Release files for cyberlang 0.7.1

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

Built distributions (wheels)

Table of built distributions (wheels) for cyberlang 0.7.1
File Interpreter ABI Platform
cyberlang-0.7.1-py3-none-macosx_10_9_x86_64.whl Python 3 none macOS 10.9+ x86-64 Details
cyberlang-0.7.1-py3-none-any.whl Python 3 none any Details

Total release size: 1.2 MB

Release files / cyberlang-0.7.1-py3-none-macosx_10_9_x86_64.whl

Download URL cyberlang-0.7.1-py3-none-macosx_10_9_x86_64.whl
Size 10.4 kB
Tags Python 3 macOS 10.9+ x86-64
SHA-256 checksum
How to use checksums
d60e22bc3cd5abae362f6ce6521eed2384963d7f4a1fa55528439918f9f770e3
BLAKE2b-256 checksum
How to use checksums
ee3c138de2f187ce4f1b37323d0c2c5a876c3c1e85244c8bf94c3406b2a6b16e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.12.5

Release files / cyberlang-0.7.1-py3-none-any.whl

Download URL cyberlang-0.7.1-py3-none-any.whl
Size 1.2 MB
Tags Python 3
SHA-256 checksum
How to use checksums
b1da760642b33cd7579984138007ea3b271902590fb68d394549c620358c7d83
BLAKE2b-256 checksum
How to use checksums
ee2dc07254918fcd7ff1894aa411523b720a9872541cbafa47dbe789ceaf0cc0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.12.5

Release history Release notifications | RSS feed

This release

0.7.1 This release

2 release files

0.7.0

6 release files

0.6.5

6 release files

0.6.3

6 release files

0.6.2

6 release files

0.6.1

6 release files

0.6.0

6 release files

0.5.3

6 release files

0.5.1

2 release files

0.5.0

2 release files

0.3.1

2 release files

0.3.0

2 release files

0.2.0

2 release files

0.1.8

2 release files

0.1.7

2 release files

0.1.6

2 release files

0.1.5

2 release files

0.1.4

2 release files

0.1.3

2 release files

0.1.2

2 release files

0.1.1

2 release files

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