cyberlang


Namecyberlang JSON
Version 0.7.0 PyPI version JSON
download
home_pagehttps://github.com/DaelonSuzuka/cyber-python
SummaryA self-contained Cyber intepreter
upload_time2023-09-10 15:08:59
maintainer
docs_urlNone
authorDavid Kincaid
requires_python>=3.8
licenseMIT
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage
            # cyberlang - batteries included python bindings for cyber

[![license](https://img.shields.io/pypi/l/cyberlang.svg)](./LICENSE)
[![pypi version](https://img.shields.io/pypi/v/cyberlang.svg)](https://pypi.org/project/cyberlang/)
[![PyPI status](https://img.shields.io/pypi/status/cyberlang.svg)](https://github.com/qtstrap/qtstrap)
[![discord](https://img.shields.io/discord/828041790711136274)](https://discord.gg/Ky8vNZJvAT)

## Installation

```
pip install cyberlang
```

## Usage

Simply create a CyberVM instance and evaluate a string:

```py
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.

```py
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:

```py
# 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

```py
# "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](https://github.com/fubark) - creator of the Cyber language

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/DaelonSuzuka/cyber-python",
    "name": "cyberlang",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.8",
    "maintainer_email": "",
    "keywords": "",
    "author": "David Kincaid",
    "author_email": "dlkincaid0@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/d1/b6/f668280acb1d07dced95869f9e770592629915a0fcf781931280caec2c30/cyberlang-0.7.0.tar.gz",
    "platform": null,
    "description": "# cyberlang - batteries included python bindings for cyber\r\n\r\n[![license](https://img.shields.io/pypi/l/cyberlang.svg)](./LICENSE)\r\n[![pypi version](https://img.shields.io/pypi/v/cyberlang.svg)](https://pypi.org/project/cyberlang/)\r\n[![PyPI status](https://img.shields.io/pypi/status/cyberlang.svg)](https://github.com/qtstrap/qtstrap)\r\n[![discord](https://img.shields.io/discord/828041790711136274)](https://discord.gg/Ky8vNZJvAT)\r\n\r\n## Installation\r\n\r\n```\r\npip install cyberlang\r\n```\r\n\r\n## Usage\r\n\r\nSimply create a CyberVM instance and evaluate a string:\r\n\r\n```py\r\nfrom cyber import CyberVM\r\n\r\nvm = CyberVM()\r\nvm.eval(\"print 'hello world!'\")\r\n```\r\n\r\nWant to capture printed output? Override the `print` function from Cyber's `core` module with a binding.\r\n\r\nThe decorator generates all the required wrappers and interfaces, and registers everything with Cyber's VM.\r\n\r\n```py\r\nfrom cyber import CyberVM\r\n\r\nvm = CyberVM()\r\n\r\n@vm.function('core.print')\r\ndef _print(string: str):\r\n    print(string)\r\n\r\nvm.eval(\"print 'hello world!'\")\r\n```\r\n\r\nAlternate techniques for creating callback functions:\r\n\r\n```py\r\n# if no module, assume core\r\n# same result as previous example\r\n# this creates function \"print2\" in the \"core\" module\r\n@cyber.function('print2')\r\ndef _print2(string: str):\r\n    print(string)\r\n\r\n# if no module, assume core\r\n# if no function name, use existing function name\r\n# this creates function \"test\" in the \"core\" module\r\n@cyber.function\r\ndef test():\r\n    print('core.test')\r\n```\r\n\r\nOr define multiple functions at once using this class-based syntax\r\n\r\n```py\r\n# \"core\" already exists, so add a() and b() to it\r\nclass Core(cyber.module('core')):\r\n    def a(self):\r\n        print('core.test')\r\n    def b(self):\r\n        print('core.test2')\r\n\r\n# create \"new_module\" and add c() and d() to it\r\n@cyber.module('new_module')\r\nclass Module:\r\n    def c(self):\r\n        print('new_module.test')\r\n    def d(self):\r\n        print('new_module.test2')\r\n\r\n# create module, implicitly named \"NewModule\" and add e() and f() to it\r\n@cyber.module\r\nclass NewModule:\r\n    def e(self):\r\n        print('NewModule.test')\r\n    def f(self):\r\n        print('NewModule.test2')\r\n```\r\n\r\n# Supporters\r\n\r\n[fubar](https://github.com/fubark) - creator of the Cyber language\r\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "A self-contained Cyber intepreter",
    "version": "0.7.0",
    "project_urls": {
        "Homepage": "https://github.com/DaelonSuzuka/cyber-python",
        "Source": "https://github.com/DaelonSuzuka/cyber-python",
        "Tracker": "https://github.com/DaelonSuzuka/cyber-python/issues"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "d326099dd78244758d45a4b4a9e5810c924e06ff5a0361b3c7fb8abcb3594548",
                "md5": "3f2e1ad9ba4528614f24af1cc9c58a26",
                "sha256": "eeed27dd13b19a14848558cda4b7b1a3e1e29e80fb62e879837bb291e6c70888"
            },
            "downloads": -1,
            "filename": "cyberlang-0.7.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "3f2e1ad9ba4528614f24af1cc9c58a26",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8",
            "size": 4372451,
            "upload_time": "2023-09-10T15:08:44",
            "upload_time_iso_8601": "2023-09-10T15:08:44.613195Z",
            "url": "https://files.pythonhosted.org/packages/d3/26/099dd78244758d45a4b4a9e5810c924e06ff5a0361b3c7fb8abcb3594548/cyberlang-0.7.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "89e57ea5a497562f02f52b815125c2e64e58f05d0331d7ef0e252e42ff48fbf5",
                "md5": "62c88c3d9f7b77abf2937607fa3c96eb",
                "sha256": "eaa2643066090f2476876117bed0fed83771dcdeff04d19b0f72040dc67463d6"
            },
            "downloads": -1,
            "filename": "cyberlang-0.7.0-py3-none-macosx_10_9_x86_64.whl",
            "has_sig": false,
            "md5_digest": "62c88c3d9f7b77abf2937607fa3c96eb",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8",
            "size": 1083670,
            "upload_time": "2023-09-10T15:08:47",
            "upload_time_iso_8601": "2023-09-10T15:08:47.282181Z",
            "url": "https://files.pythonhosted.org/packages/89/e5/7ea5a497562f02f52b815125c2e64e58f05d0331d7ef0e252e42ff48fbf5/cyberlang-0.7.0-py3-none-macosx_10_9_x86_64.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "a87c116642ebc9f45f1f0bc0e4ce43c3edcba45e3c474757da7e95d875d162db",
                "md5": "d454412abaf760d4ecf88d0e75a4ab95",
                "sha256": "e10556d17bc0aec79801d4ba1ac2b01b2fde753702275068ec0019268f4784ec"
            },
            "downloads": -1,
            "filename": "cyberlang-0.7.0-py3-none-macosx_11_0_arm64.whl",
            "has_sig": false,
            "md5_digest": "d454412abaf760d4ecf88d0e75a4ab95",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8",
            "size": 1099095,
            "upload_time": "2023-09-10T15:08:49",
            "upload_time_iso_8601": "2023-09-10T15:08:49.814471Z",
            "url": "https://files.pythonhosted.org/packages/a8/7c/116642ebc9f45f1f0bc0e4ce43c3edcba45e3c474757da7e95d875d162db/cyberlang-0.7.0-py3-none-macosx_11_0_arm64.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "4d9ca646a23b2a5f9bf0776416ae43ab6dc49b3cf6cd21538f676b4a45a1a410",
                "md5": "9a0f912f71f0ab42efebbb627cf4d6b8",
                "sha256": "e250054844e50e5a23b80282bbf7da8055d500169530b8d90b14456944ffb448"
            },
            "downloads": -1,
            "filename": "cyberlang-0.7.0-py3-none-manylinux_2_12_x86_64.manylinux2010_x86_64.musllinux_1_1_x86_64.whl",
            "has_sig": false,
            "md5_digest": "9a0f912f71f0ab42efebbb627cf4d6b8",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8",
            "size": 1132233,
            "upload_time": "2023-09-10T15:08:51",
            "upload_time_iso_8601": "2023-09-10T15:08:51.805742Z",
            "url": "https://files.pythonhosted.org/packages/4d/9c/a646a23b2a5f9bf0776416ae43ab6dc49b3cf6cd21538f676b4a45a1a410/cyberlang-0.7.0-py3-none-manylinux_2_12_x86_64.manylinux2010_x86_64.musllinux_1_1_x86_64.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "115d9aad936686f00e2771c79a5dca5a4d25f1cb3a424d521b9ed3ab95f9879c",
                "md5": "755eea3781abd166b709f12d3b37f99b",
                "sha256": "5d763ca3acd57a4ecc90400bc763bfa0adb969299a59e058eff569de880edfc5"
            },
            "downloads": -1,
            "filename": "cyberlang-0.7.0-py3-none-win_amd64.whl",
            "has_sig": false,
            "md5_digest": "755eea3781abd166b709f12d3b37f99b",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8",
            "size": 1081820,
            "upload_time": "2023-09-10T15:08:54",
            "upload_time_iso_8601": "2023-09-10T15:08:54.507998Z",
            "url": "https://files.pythonhosted.org/packages/11/5d/9aad936686f00e2771c79a5dca5a4d25f1cb3a424d521b9ed3ab95f9879c/cyberlang-0.7.0-py3-none-win_amd64.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "d1b6f668280acb1d07dced95869f9e770592629915a0fcf781931280caec2c30",
                "md5": "c7f7ecdd12dddc161e359e76a53cdaad",
                "sha256": "d81edf064f1079d706a9a899ef067848733017ebbc9d940c8f5d8c0c22fe9c81"
            },
            "downloads": -1,
            "filename": "cyberlang-0.7.0.tar.gz",
            "has_sig": false,
            "md5_digest": "c7f7ecdd12dddc161e359e76a53cdaad",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8",
            "size": 4368296,
            "upload_time": "2023-09-10T15:08:59",
            "upload_time_iso_8601": "2023-09-10T15:08:59.239978Z",
            "url": "https://files.pythonhosted.org/packages/d1/b6/f668280acb1d07dced95869f9e770592629915a0fcf781931280caec2c30/cyberlang-0.7.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-09-10 15:08:59",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "DaelonSuzuka",
    "github_project": "cyber-python",
    "travis_ci": false,
    "coveralls": true,
    "github_actions": true,
    "requirements": [],
    "lcname": "cyberlang"
}
        
Elapsed time: 0.10660s