belay


Namebelay JSON
Version 0.25.0 PyPI version JSON
download
home_pagehttps://github.com/BrianPugh/belay
SummaryNone
upload_time2025-07-14 18:47:02
maintainerNone
docs_urlNone
authorBrian Pugh
requires_python>=3.8
licenseApache-2.0
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            .. image:: https://raw.githubusercontent.com/BrianPugh/belay/main/assets/logo_white_400w.png

|Python compat| |PyPi| |GHA tests| |Codecov report| |readthedocs|


.. inclusion-marker-do-not-remove


Belay is:

* A python library that enables the rapid development of projects that interact with hardware via a MicroPython or CircuitPython compatible board.

* A command-line tool for developing standalone MicroPython projects.

* A `Poetry`_-inspired `MicroPython package manager <https://belay.readthedocs.io/en/latest/Package%20Manager.html>`_.

Belay supports wired serial connections (USB) and wireless connections via WebREPL over WiFi.

`Quick Video of Belay in 22 seconds.`_

See `the documentation`_ for usage and other details.


Who is Belay For?
=================

Belay is for people creating a software project that needs to interact with hardware.
Examples include:

* Control a motor so a webcam is always pointing at a person.

* Turn on an LED when you receive a notification.

* Read a potentiometer to control system volume.

The Belay Package Manager is for people that want to use public libraries, and get them on-device in
an easy, repeatable, dependable manner.

What Problems Does Belay Solve?
===============================

Typically, having a python script interact with hardware involves 3 major challenges:

1. On-device firmware (usually C or MicroPython) for directly handling hardware interactions. Typically this is developed, compiled, and uploaded as a (nearly) independent project.

2. A program on your computer that performs the tasks specified and interacts with the device.

3. Computer-to-device communication protocol. How are commands and results transferred? How does the device execute those commands?

This is lot of work if you just want your computer to do something simple like turn on an LED.
Belay simplifies all of this by merging steps 1 and 2 into the same codebase, and manages step 3 for you.
Code is automatically synced at the beginning of script execution.

The Belay Package Manager makes it easy to cache, update, and deploy third party libraries with your project.

Installation
============

Belay requires Python ``>=3.8`` and can be installed via:

.. code-block:: bash

   pip install belay

The MicroPython-compatible board only needs MicroPython installed; no additional preparation is required.
If using CircuitPython, and additional modification needs to be made to ``boot.py``. See `documentation <https://belay.readthedocs.io/en/latest/CircuitPython.html>`_ for details.

Examples
========

Turning on an LED with Belay takes only 6 lines of code.
Functions decorated with the ``task`` decorator are sent to the device and interpreted by the MicroPython interpreter.
Calling the decorated function on-host sends a command to the device to execute the actual function.

.. code-block:: python

   import belay

   device = belay.Device("/dev/ttyUSB0")


   @device.task
   def set_led(state):
       print(f"Printing from device; turning LED to {state}.")
       Pin(25, Pin.OUT).value(state)


   set_led(True)

Outputs from ``print`` calls from on-device user-code are forwarded to host ``stdout``.

`For more examples, see the examples folder.`_


.. |GHA tests| image:: https://github.com/BrianPugh/belay/actions/workflows/tests.yaml/badge.svg?branch=main
   :target: https://github.com/BrianPugh/belay/actions?query=workflow%3Atests
   :alt: GHA Status
.. |Codecov report| image:: https://codecov.io/github/BrianPugh/belay/coverage.svg?branch=main
   :target: https://codecov.io/github/BrianPugh/belay?branch=main
   :alt: Coverage
.. |readthedocs| image:: https://readthedocs.org/projects/belay/badge/?version=latest
        :target: https://belay.readthedocs.io/en/latest/?badge=latest
        :alt: Documentation Status
.. |Python compat| image:: https://img.shields.io/badge/>=python-3.8-blue.svg
.. |PyPi| image:: https://img.shields.io/pypi/v/belay.svg
        :target: https://pypi.python.org/pypi/belay
.. _Quick Video of Belay in 22 seconds.: https://www.youtube.com/watch?v=wq3cyjSE8ek
.. _the documentation: https://belay.readthedocs.io
.. _For more examples, see the examples folder.:  https://github.com/BrianPugh/belay/tree/main/examples
.. _Poetry: https://python-poetry.org

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/BrianPugh/belay",
    "name": "belay",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.8",
    "maintainer_email": null,
    "keywords": null,
    "author": "Brian Pugh",
    "author_email": null,
    "download_url": "https://files.pythonhosted.org/packages/da/39/ba93560f43388986a2784fa12db7ca452ebf1e728d0a9501a469962b2409/belay-0.25.0.tar.gz",
    "platform": null,
    "description": ".. image:: https://raw.githubusercontent.com/BrianPugh/belay/main/assets/logo_white_400w.png\n\n|Python compat| |PyPi| |GHA tests| |Codecov report| |readthedocs|\n\n\n.. inclusion-marker-do-not-remove\n\n\nBelay is:\n\n* A python library that enables the rapid development of projects that interact with hardware via a MicroPython or CircuitPython compatible board.\n\n* A command-line tool for developing standalone MicroPython projects.\n\n* A `Poetry`_-inspired `MicroPython package manager <https://belay.readthedocs.io/en/latest/Package%20Manager.html>`_.\n\nBelay supports wired serial connections (USB) and wireless connections via WebREPL over WiFi.\n\n`Quick Video of Belay in 22 seconds.`_\n\nSee `the documentation`_ for usage and other details.\n\n\nWho is Belay For?\n=================\n\nBelay is for people creating a software project that needs to interact with hardware.\nExamples include:\n\n* Control a motor so a webcam is always pointing at a person.\n\n* Turn on an LED when you receive a notification.\n\n* Read a potentiometer to control system volume.\n\nThe Belay Package Manager is for people that want to use public libraries, and get them on-device in\nan easy, repeatable, dependable manner.\n\nWhat Problems Does Belay Solve?\n===============================\n\nTypically, having a python script interact with hardware involves 3 major challenges:\n\n1. On-device firmware (usually C or MicroPython) for directly handling hardware interactions. Typically this is developed, compiled, and uploaded as a (nearly) independent project.\n\n2. A program on your computer that performs the tasks specified and interacts with the device.\n\n3. Computer-to-device communication protocol. How are commands and results transferred? How does the device execute those commands?\n\nThis is lot of work if you just want your computer to do something simple like turn on an LED.\nBelay simplifies all of this by merging steps 1 and 2 into the same codebase, and manages step 3 for you.\nCode is automatically synced at the beginning of script execution.\n\nThe Belay Package Manager makes it easy to cache, update, and deploy third party libraries with your project.\n\nInstallation\n============\n\nBelay requires Python ``>=3.8`` and can be installed via:\n\n.. code-block:: bash\n\n   pip install belay\n\nThe MicroPython-compatible board only needs MicroPython installed; no additional preparation is required.\nIf using CircuitPython, and additional modification needs to be made to ``boot.py``. See `documentation <https://belay.readthedocs.io/en/latest/CircuitPython.html>`_ for details.\n\nExamples\n========\n\nTurning on an LED with Belay takes only 6 lines of code.\nFunctions decorated with the ``task`` decorator are sent to the device and interpreted by the MicroPython interpreter.\nCalling the decorated function on-host sends a command to the device to execute the actual function.\n\n.. code-block:: python\n\n   import belay\n\n   device = belay.Device(\"/dev/ttyUSB0\")\n\n\n   @device.task\n   def set_led(state):\n       print(f\"Printing from device; turning LED to {state}.\")\n       Pin(25, Pin.OUT).value(state)\n\n\n   set_led(True)\n\nOutputs from ``print`` calls from on-device user-code are forwarded to host ``stdout``.\n\n`For more examples, see the examples folder.`_\n\n\n.. |GHA tests| image:: https://github.com/BrianPugh/belay/actions/workflows/tests.yaml/badge.svg?branch=main\n   :target: https://github.com/BrianPugh/belay/actions?query=workflow%3Atests\n   :alt: GHA Status\n.. |Codecov report| image:: https://codecov.io/github/BrianPugh/belay/coverage.svg?branch=main\n   :target: https://codecov.io/github/BrianPugh/belay?branch=main\n   :alt: Coverage\n.. |readthedocs| image:: https://readthedocs.org/projects/belay/badge/?version=latest\n        :target: https://belay.readthedocs.io/en/latest/?badge=latest\n        :alt: Documentation Status\n.. |Python compat| image:: https://img.shields.io/badge/>=python-3.8-blue.svg\n.. |PyPi| image:: https://img.shields.io/pypi/v/belay.svg\n        :target: https://pypi.python.org/pypi/belay\n.. _Quick Video of Belay in 22 seconds.: https://www.youtube.com/watch?v=wq3cyjSE8ek\n.. _the documentation: https://belay.readthedocs.io\n.. _For more examples, see the examples folder.:  https://github.com/BrianPugh/belay/tree/main/examples\n.. _Poetry: https://python-poetry.org\n",
    "bugtrack_url": null,
    "license": "Apache-2.0",
    "summary": null,
    "version": "0.25.0",
    "project_urls": {
        "Homepage": "https://github.com/BrianPugh/belay",
        "Repository": "https://github.com/BrianPugh/belay"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "019db2ed81d51524ada8d040d2950d2762d8f1bc3e8fb473e7f6e9b61ea35f9e",
                "md5": "4c369c3c824726f98b78caf46d5a4fc4",
                "sha256": "90d692117c3b74a6fe0f7b494ab5399e5da308c91cfabcd972fc285efc2f303e"
            },
            "downloads": -1,
            "filename": "belay-0.25.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "4c369c3c824726f98b78caf46d5a4fc4",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8",
            "size": 97499,
            "upload_time": "2025-07-14T18:47:01",
            "upload_time_iso_8601": "2025-07-14T18:47:01.087589Z",
            "url": "https://files.pythonhosted.org/packages/01/9d/b2ed81d51524ada8d040d2950d2762d8f1bc3e8fb473e7f6e9b61ea35f9e/belay-0.25.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "da39ba93560f43388986a2784fa12db7ca452ebf1e728d0a9501a469962b2409",
                "md5": "77ca36b47ca7f1870b9ecb10a026fac3",
                "sha256": "2ee1be8e48fbb0b746473e0790d0165b39f9b1167fde07a79aab1ac7ee449aa7"
            },
            "downloads": -1,
            "filename": "belay-0.25.0.tar.gz",
            "has_sig": false,
            "md5_digest": "77ca36b47ca7f1870b9ecb10a026fac3",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8",
            "size": 65411,
            "upload_time": "2025-07-14T18:47:02",
            "upload_time_iso_8601": "2025-07-14T18:47:02.292897Z",
            "url": "https://files.pythonhosted.org/packages/da/39/ba93560f43388986a2784fa12db7ca452ebf1e728d0a9501a469962b2409/belay-0.25.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-07-14 18:47:02",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "BrianPugh",
    "github_project": "belay",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "belay"
}
        
Elapsed time: 0.48401s