Skip to main content

Supercharge your CircuitPython classes similar to CPython dataclasses

Project description

Introduction

Documentation Status Discord Build Status CodeCov Metrics Code Style: Ruff License: MIT License: PSF-2.0 Maintained: Yes

Supercharge your CircuitPython classes similar to CPython dataclasses

Dependencies

This driver depends on:

Please ensure all dependencies are available on the CircuitPython filesystem. This is easily achieved by downloading the Adafruit library and driver bundle or individual libraries can be installed using circup.

Installing from PyPI

On supported GNU/Linux systems like the Raspberry Pi, you can install the driver locally from PyPI. To install for current user:

pip3 install circuitpython-nitroclass

To install system-wide (this may be required in some cases):

sudo pip3 install circuitpython-nitroclass

To install in a virtual environment in your current project:

mkdir project-name && cd project-name
python3 -m venv .venv
source .env/bin/activate
pip3 install circuitpython-nitroclass

Installing to a Connected CircuitPython Device with Circup

Make sure that you have circup installed in your Python environment. Install it with the following command if necessary:

pip3 install circup

With circup installed and your CircuitPython device connected use the following command to install:

circup install circuitpython_nitroclass

Or the following command to update an existing version:

circup update

Usage Example

from circuitpython_nitroclass import field, nitroclass

@nitroclass
class DataPacket:
    req = field(type=int)
    dyn = field(default_factory=list)
    cls_var = "a"


# NOTE: Due to CircuitPython implementation details, fields must be provided by keyword ONLY!

x = DataPacket(req=1)
y = DataPacket(req=2)

assert x != y

x.req = 2

assert x == y

Documentation

API documentation for this library can be found on Read the Docs.

For information on building library documentation, please check out this guide.

Contributing

Contributions are welcome! Please read our Code of Conduct before contributing to help this project stay welcoming.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

circuitpython_nitroclass-1.0.0.tar.gz (30.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

circuitpython_nitroclass-1.0.0-py3-none-any.whl (7.1 kB view details)

Uploaded Python 3

File details

Details for the file circuitpython_nitroclass-1.0.0.tar.gz.

File metadata

  • Download URL: circuitpython_nitroclass-1.0.0.tar.gz
  • Upload date:
  • Size: 30.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.15

File hashes

Hashes for circuitpython_nitroclass-1.0.0.tar.gz
Algorithm Hash digest
SHA256 9b4625d13ba327fc5b28e27499cf8ac5ff6d890c475bde19ea0c205fe070e316
MD5 fdda7e26e059975332efdc62e0e424c0
BLAKE2b-256 d4e840f60155e18e0ce0cb3f06872e552d5881679a815d2a86607e6271081d24

See more details on using hashes here.

File details

Details for the file circuitpython_nitroclass-1.0.0-py3-none-any.whl.

File metadata

File hashes

Hashes for circuitpython_nitroclass-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 34ad7c6f50f1017141f995f2cf0ce4022117f7eea72d4d6412fd8f637edfbf13
MD5 ff0cbd56271f4998c5ded0e6597d9388
BLAKE2b-256 ba30f0382e9c72ac653482f598d78c58796e7d9b3a00aa4790f3e4c63ea12a18

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page