### Installing charachorder.py from PyPI (Windows) Source: https://github.com/charachorder/charachorder.py/blob/master/docs/src/installation.md This command installs or upgrades the charachorder.py library from PyPI using pip for Windows systems. It uses the `py -3` launcher to ensure the installation targets a Python 3 environment. ```sh py -3 -m pip install -U charachorder.py ``` -------------------------------- ### Installing charachorder.py from Source Source: https://github.com/charachorder/charachorder.py/blob/master/docs/src/installation.md These commands clone the charachorder.py repository from GitHub, navigate into the project directory, and then install the library directly from the local source using pip. This method is suitable for developers who need to work with the latest unreleased changes or contribute to the project. ```sh git clone https://github.com/CharaChorder/charachorder.py cd charachorder.py python3 -m pip install -U . ``` -------------------------------- ### Installing charachorder.py from PyPI (Linux/macOS) Source: https://github.com/charachorder/charachorder.py/blob/master/docs/src/installation.md This command installs or upgrades the charachorder.py library from the Python Package Index (PyPI) using pip for Linux and macOS systems. It ensures you have the latest stable version of the package. ```sh python3 -m pip install -U charachorder.py ``` -------------------------------- ### Nix Derivation for charachorder.py Source: https://github.com/charachorder/charachorder.py/blob/master/docs/src/installation.md This Nix expression defines a package derivation for charachorder.py, allowing it to be integrated into Nix-managed environments. It specifies the package name, version, source, build inputs (inquirer, pyserial), and metadata, providing a reproducible way to build and manage the library within a Nix ecosystem. Users must fill in the `hash` field after the first build attempt. ```nix { buildPythonPackage, fetchFromGitHub, lib, pythonOlder, inquirer, pyserial }: buildPythonPackage { pname = "charachorder.py"; version = "0.6.0"; format = "setuptools"; disabled = pythonOlder "3.9"; src = fetchFromGitHub { owner = "CharaChorder"; repo = "charachorder.py"; rev = "v${version}"; hash = ""; # FIXME: Fill the hash here. Hint: Run this once and you will get the hash in the error }; nativeBuildInputs = [ inquirer pyserial ]; meta = { description = "A wrapper for CharaChorder's Serial API written in Python"; downloadPage = "https://pypi.org/project/charachorder.py/#files"; homepage = "https://github.com/CharaChorder/charachorder.py"; license = lib.licenses.mit; maintainers = with lib.maintainers; [ getpsyched ]; }; } ``` -------------------------------- ### Sending Serial Commands within Context Manager (Python) Source: https://github.com/charachorder/charachorder.py/blob/master/docs/src/quick-start.md This snippet provides examples of sending various serial API commands to a CharaChorder device while its connection is managed by a `with` context manager. It shows how to retrieve the device ID, firmware version, and the total count of chord maps using respective methods like `get_id()`, `get_version()`, and `get_chordmap_count()`. ```Python with device: # ID id: str = device.get_id() # VERSION version: str = device.get_version() # CML C0 total_chords: int = device.get_chordmap_count() ``` -------------------------------- ### Installing Development Version of charachorder.py Source: https://github.com/charachorder/charachorder.py/blob/master/readme.md This snippet outlines the steps to install the development version of `charachorder.py` by cloning its Git repository and performing a local editable installation using `pip`. ```sh git clone https://github.com/CharaChorder/charachorder.py cd charachorder.py python3 -m pip install -U . ``` -------------------------------- ### Managing Serial Connection with Context Manager (Python) Source: https://github.com/charachorder/charachorder.py/blob/master/docs/src/quick-start.md This snippet illustrates the recommended way to manage the serial connection to a CharaChorder device using a Python `with` context manager. This approach automatically handles opening the serial port when entering the block and closing it upon exiting, simplifying resource management and preventing leaks. ```Python with device: # run commands here ``` -------------------------------- ### Listing All CharaChorder Devices (Python) Source: https://github.com/charachorder/charachorder.py/blob/master/docs/src/quick-start.md This snippet demonstrates how to discover and list all connected CharaChorder devices using the `CharaChorder.list_devices()` method. It iterates through the found devices and prints their representations. This method typically returns subclasses like `CharaChorderOne` or `CharaChorderLite`. ```Python from charachorder import CharaChorder for device in CharaChorder.list_devices(): print(device) ``` -------------------------------- ### Installing charachorder.py on Linux/macOS using pip Source: https://github.com/charachorder/charachorder.py/blob/master/readme.md This snippet provides the command to install or upgrade the `charachorder.py` library on Linux and macOS systems using the `pip` package manager, ensuring the latest stable version is utilized. ```sh python3 -m pip install -U charachorder.py ``` -------------------------------- ### Installing charachorder.py on Windows using pip Source: https://github.com/charachorder/charachorder.py/blob/master/readme.md This snippet provides the command to install or upgrade the `charachorder.py` library on Windows systems using the `pip` package manager, specifically using `py -3` to invoke Python 3. ```sh py -3 -m pip install -U charachorder.py ``` -------------------------------- ### Listing Specific CharaChorderLite Devices (Python) Source: https://github.com/charachorder/charachorder.py/blob/master/docs/src/quick-start.md This snippet shows how to list only `CharaChorderLite` devices connected to the system. By calling `list_devices()` on a specific subclass like `CharaChorderLite`, the library filters out other CharaChorder models, focusing only on the specified type. ```Python from charachorder import CharaChorderLite for device in CharaChorderLite.list_devices(): print(device) ``` -------------------------------- ### Manually Managing Serial Connection (Python) Source: https://github.com/charachorder/charachorder.py/blob/master/docs/src/quick-start.md This snippet demonstrates how to manually open and close the serial connection to a CharaChorder device using `device.open()` and `device.close()` methods. This method is suitable for use cases requiring a persistent connection over a long period, where frequent toggling of the connection might be inefficient. ```Python device.open() # run commands here device.close() ``` -------------------------------- ### Listing and Accessing CharaChorder Devices in Python Source: https://github.com/charachorder/charachorder.py/blob/master/readme.md This Python snippet demonstrates how to list connected CharaChorder devices and retrieve their IDs. It illustrates two common patterns: using a context manager for automatic resource management and explicit `open()`/`close()` calls. ```py from charachorder import CharaChorder for device in CharaChorder.list_devices(): # Method 1 with device: print(device.get_id()) # Method 2 device.open() print(device.get_id()) device.close() ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.