跳转到主要内容

CircuitPython的prompt_toolkit精简实现

项目描述

简介

Documentation Status Discord Build Status Code Style: Black

Slimmed down implementation of prompt_toolkit for CircuitPython

依赖项

此驱动程序依赖于

请确保所有依赖项都可在CircuitPython文件系统中使用。这可以通过下载 Adafruit库和驱动程序捆绑包 或使用 circup 安装单独的库轻松实现。

从PyPI安装

此库可在PyPI中用于需要它的CircuitPython工具。如果您实际上想使用它来在CPython(而不是CircuitPython)上,我们建议使用PyPI上也可用的完整 prompt_toolkit 库。

使用Circup安装到连接的CircuitPython设备

确保您在Python环境中安装了circup。如果需要,请使用以下命令进行安装

pip3 install circup

安装circup并连接您的CircuitPython设备后,请使用以下命令进行安装

circup install adafruit_prompt_toolkit

或以下命令更新现有版本

circup update

使用示例

# This example works over the second CDC and supports history.

import usb_cdc

# Rename import to make the rest of the code compatible with CPython's prompt_toolkit library.
import adafruit_prompt_toolkit as prompt_toolkit

# If the second CDC is available, then use it instead.
serial = usb_cdc.console
if usb_cdc.data:
    serial = usb_cdc.data

session = prompt_toolkit.PromptSession(input=serial, output=serial)

while True:
    response = session.prompt("$ ")
    print("->", response, file=serial)

文档

此库的API文档可在Read the Docs上找到。

有关构建库文档的信息,请参阅本指南

贡献

欢迎贡献!在为此项目做出贡献之前,请阅读我们的行为准则,以帮助保持项目的友好氛围。

项目详情


下载文件

下载适用于您平台的文件。如果您不确定选择哪个,请了解有关安装包的更多信息。

源分布

adafruit_circuitpython_prompt_toolkit-1.0.0.tar.gz (27.2 kB 查看哈希值)

上传时间

构建分布

adafruit_circuitpython_prompt_toolkit-1.0.0-py3-none-any.whl (6.0 kB 查看哈希值)

上传时间 Python 3

由以下支持