diff --git a/docs/requirements.txt b/docs/requirements.txt
index 88e6733..979f568 100644
--- a/docs/requirements.txt
+++ b/docs/requirements.txt
@@ -2,4 +2,6 @@
#
# SPDX-License-Identifier: Unlicense
-sphinx>=4.0.0
+sphinx
+sphinxcontrib-jquery
+sphinx-rtd-theme
diff --git a/examples/bluefruitconnect_controlpad.py b/examples/bluefruitconnect_controlpad.py
index e59f6e4..fe5457f 100644
--- a/examples/bluefruitconnect_controlpad.py
+++ b/examples/bluefruitconnect_controlpad.py
@@ -8,10 +8,10 @@
from adafruit_ble import BLERadio
from adafruit_ble.advertising.standard import ProvideServicesAdvertisement
from adafruit_ble.services.nordic import UARTService
-from adafruit_bluefruit_connect.packet import Packet
# Only the packet classes that are imported will be known to Packet.
from adafruit_bluefruit_connect.button_packet import ButtonPacket
+from adafruit_bluefruit_connect.packet import Packet
ble = BLERadio()
uart_server = UARTService()
@@ -30,7 +30,6 @@
# Loop and read packets
while ble.connected:
-
# Keeping trying until a good packet is received
try:
packet = Packet.from_stream(uart_server)
diff --git a/examples/bluefruitconnect_sensors.py b/examples/bluefruitconnect_sensors.py
index 30175c2..218bf60 100644
--- a/examples/bluefruitconnect_sensors.py
+++ b/examples/bluefruitconnect_sensors.py
@@ -8,13 +8,13 @@
from adafruit_ble import BLERadio
from adafruit_ble.advertising.standard import ProvideServicesAdvertisement
from adafruit_ble.services.nordic import UARTService
-from adafruit_bluefruit_connect.packet import Packet
# Only the packet classes that are imported will be known to Packet.
from adafruit_bluefruit_connect.accelerometer_packet import AccelerometerPacket
from adafruit_bluefruit_connect.gyro_packet import GyroPacket
from adafruit_bluefruit_connect.location_packet import LocationPacket
from adafruit_bluefruit_connect.magnetometer_packet import MagnetometerPacket
+from adafruit_bluefruit_connect.packet import Packet
from adafruit_bluefruit_connect.quaternion_packet import QuaternionPacket
ble = BLERadio()
@@ -34,7 +34,6 @@
# Loop and read packets
while ble.connected:
-
# Keeping trying until a good packet is received
try:
packet = Packet.from_stream(uart_server)
diff --git a/examples/bluefruitconnect_simpletest.py b/examples/bluefruitconnect_simpletest.py
index f0deca1..3f71e92 100644
--- a/examples/bluefruitconnect_simpletest.py
+++ b/examples/bluefruitconnect_simpletest.py
@@ -8,10 +8,10 @@
from adafruit_ble import BLERadio
from adafruit_ble.advertising.standard import ProvideServicesAdvertisement
from adafruit_ble.services.nordic import UARTService
-from adafruit_bluefruit_connect.packet import Packet
# Only the packet classes that are imported will be known to Packet.
from adafruit_bluefruit_connect.color_packet import ColorPacket
+from adafruit_bluefruit_connect.packet import Packet
ble = BLERadio()
uart_server = UARTService()
diff --git a/examples/bluefruitconnect_simpletest2.py b/examples/bluefruitconnect_simpletest2.py
new file mode 100644
index 0000000..596e23c
--- /dev/null
+++ b/examples/bluefruitconnect_simpletest2.py
@@ -0,0 +1,35 @@
+# SPDX-FileCopyrightText: 2021 ladyada for Adafruit Industries
+# SPDX-License-Identifier: MIT
+
+# Print out the color data from ColorPackets and text data from RawTextPackets.
+# To use, start this program, and start the Adafruit Bluefruit LE Connect app.
+# Connect, and then select colors on the Controller->Color Picker screen.
+# Select text by entering the UART screen and sending a string.
+# (Do NOT use a "!" at the start of your string.)
+
+from adafruit_ble import BLERadio
+from adafruit_ble.advertising.standard import ProvideServicesAdvertisement
+from adafruit_ble.services.nordic import UARTService
+
+# Only the packet classes that are imported will be known to Packet.
+from adafruit_bluefruit_connect.color_packet import ColorPacket
+from adafruit_bluefruit_connect.packet import Packet
+from adafruit_bluefruit_connect.raw_text_packet import RawTextPacket
+
+ble = BLERadio()
+uart_server = UARTService()
+advertisement = ProvideServicesAdvertisement(uart_server)
+
+while True:
+ # Advertise when not connected.
+ ble.start_advertising(advertisement)
+ while not ble.connected:
+ pass
+
+ while ble.connected:
+ packet = Packet.from_stream(uart_server)
+ if isinstance(packet, ColorPacket):
+ print(packet.color)
+ elif isinstance(packet, RawTextPacket):
+ print("Received Raw Text Packet:")
+ print(packet.text)
diff --git a/examples/bluefruitconnect_uart.py b/examples/bluefruitconnect_uart.py
index 2bbbf43..d73ae67 100644
--- a/examples/bluefruitconnect_uart.py
+++ b/examples/bluefruitconnect_uart.py
@@ -7,6 +7,7 @@
# will be displayed. Periodically, text is sent TO the connected device.
import time
+
from adafruit_ble import BLERadio
from adafruit_ble.advertising.standard import ProvideServicesAdvertisement
from adafruit_ble.services.nordic import UARTService
@@ -40,7 +41,7 @@
print("RX:", text)
# OUTGOING (TX) periodically send text
if time.monotonic() - last_send > SEND_RATE:
- text = "COUNT = {}\r\n".format(count)
+ text = f"COUNT = {count}\r\n"
print("TX:", text.strip())
uart_server.write(text.encode())
count += 1
diff --git a/optional_requirements.txt b/optional_requirements.txt
new file mode 100644
index 0000000..d4e27c4
--- /dev/null
+++ b/optional_requirements.txt
@@ -0,0 +1,3 @@
+# SPDX-FileCopyrightText: 2022 Alec Delaney, for Adafruit Industries
+#
+# SPDX-License-Identifier: Unlicense
diff --git a/pyproject.toml b/pyproject.toml
new file mode 100644
index 0000000..8684faf
--- /dev/null
+++ b/pyproject.toml
@@ -0,0 +1,45 @@
+# SPDX-FileCopyrightText: 2022 Alec Delaney for Adafruit Industries
+#
+# SPDX-License-Identifier: MIT
+
+[build-system]
+requires = [
+ "setuptools",
+ "wheel",
+ "setuptools-scm",
+]
+
+[project]
+name = "adafruit-circuitpython-bluefruitconnect"
+description = "CircuitPython library for use with the Adafruit Bluefruit Connect apps."
+version = "0.0.0+auto.0"
+readme = "README.rst"
+authors = [
+ {name = "Adafruit Industries", email = "circuitpython@adafruit.com"}
+]
+urls = {Homepage = "https://github.com/adafruit/Adafruit_CircuitPython_BluefruitConnect"}
+keywords = [
+ "adafruit",
+ "ble",
+ "bluefruit",
+ "bluetooth",
+ "micropython",
+ "circuitpython",
+]
+license = {text = "MIT"}
+classifiers = [
+ "Intended Audience :: Developers",
+ "Topic :: Software Development :: Libraries",
+ "Topic :: Software Development :: Embedded Systems",
+ "Topic :: System :: Hardware",
+ "License :: OSI Approved :: MIT License",
+ "Programming Language :: Python :: 3",
+]
+dynamic = ["dependencies", "optional-dependencies"]
+
+[tool.setuptools]
+packages = ["adafruit_bluefruit_connect"]
+
+[tool.setuptools.dynamic]
+dependencies = {file = ["requirements.txt"]}
+optional-dependencies = {optional = {file = ["optional_requirements.txt"]}}
diff --git a/requirements.txt b/requirements.txt
index 17a850d..7a984a4 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -1,4 +1,4 @@
-# SPDX-FileCopyrightText: 2021 ladyada for Adafruit Industries
+# SPDX-FileCopyrightText: 2022 Alec Delaney, for Adafruit Industries
#
# SPDX-License-Identifier: Unlicense
diff --git a/ruff.toml b/ruff.toml
new file mode 100644
index 0000000..ecb20d0
--- /dev/null
+++ b/ruff.toml
@@ -0,0 +1,110 @@
+# SPDX-FileCopyrightText: 2024 Tim Cocks for Adafruit Industries
+#
+# SPDX-License-Identifier: MIT
+
+target-version = "py38"
+line-length = 100
+
+[lint]
+preview = true
+select = ["I", "PL", "UP"]
+
+extend-select = [
+ "D419", # empty-docstring
+ "E501", # line-too-long
+ "W291", # trailing-whitespace
+ "PLC0414", # useless-import-alias
+ "PLC2401", # non-ascii-name
+ "PLC2801", # unnecessary-dunder-call
+ "PLC3002", # unnecessary-direct-lambda-call
+ "E999", # syntax-error
+ "PLE0101", # return-in-init
+ "F706", # return-outside-function
+ "F704", # yield-outside-function
+ "PLE0116", # continue-in-finally
+ "PLE0117", # nonlocal-without-binding
+ "PLE0241", # duplicate-bases
+ "PLE0302", # unexpected-special-method-signature
+ "PLE0604", # invalid-all-object
+ "PLE0605", # invalid-all-format
+ "PLE0643", # potential-index-error
+ "PLE0704", # misplaced-bare-raise
+ "PLE1141", # dict-iter-missing-items
+ "PLE1142", # await-outside-async
+ "PLE1205", # logging-too-many-args
+ "PLE1206", # logging-too-few-args
+ "PLE1307", # bad-string-format-type
+ "PLE1310", # bad-str-strip-call
+ "PLE1507", # invalid-envvar-value
+ "PLE2502", # bidirectional-unicode
+ "PLE2510", # invalid-character-backspace
+ "PLE2512", # invalid-character-sub
+ "PLE2513", # invalid-character-esc
+ "PLE2514", # invalid-character-nul
+ "PLE2515", # invalid-character-zero-width-space
+ "PLR0124", # comparison-with-itself
+ "PLR0202", # no-classmethod-decorator
+ "PLR0203", # no-staticmethod-decorator
+ "UP004", # useless-object-inheritance
+ "PLR0206", # property-with-parameters
+ "PLR0904", # too-many-public-methods
+ "PLR0911", # too-many-return-statements
+ "PLR0912", # too-many-branches
+ "PLR0913", # too-many-arguments
+ "PLR0914", # too-many-locals
+ "PLR0915", # too-many-statements
+ "PLR0916", # too-many-boolean-expressions
+ "PLR1702", # too-many-nested-blocks
+ "PLR1704", # redefined-argument-from-local
+ "PLR1711", # useless-return
+ "C416", # unnecessary-comprehension
+ "PLR1733", # unnecessary-dict-index-lookup
+ "PLR1736", # unnecessary-list-index-lookup
+
+ # ruff reports this rule is unstable
+ #"PLR6301", # no-self-use
+
+ "PLW0108", # unnecessary-lambda
+ "PLW0120", # useless-else-on-loop
+ "PLW0127", # self-assigning-variable
+ "PLW0129", # assert-on-string-literal
+ "B033", # duplicate-value
+ "PLW0131", # named-expr-without-context
+ "PLW0245", # super-without-brackets
+ "PLW0406", # import-self
+ "PLW0602", # global-variable-not-assigned
+ "PLW0603", # global-statement
+ "PLW0604", # global-at-module-level
+
+ # fails on the try: import typing used by libraries
+ #"F401", # unused-import
+
+ "F841", # unused-variable
+ "E722", # bare-except
+ "PLW0711", # binary-op-exception
+ "PLW1501", # bad-open-mode
+ "PLW1508", # invalid-envvar-default
+ "PLW1509", # subprocess-popen-preexec-fn
+ "PLW2101", # useless-with-lock
+ "PLW3301", # nested-min-max
+]
+
+ignore = [
+ "PLR2004", # magic-value-comparison
+ "UP030", # format literals
+ "PLW1514", # unspecified-encoding
+ "PLR0913", # too-many-arguments
+ "PLR0915", # too-many-statements
+ "PLR0917", # too-many-positional-arguments
+ "PLR0904", # too-many-public-methods
+ "PLR0912", # too-many-branches
+ "PLR0916", # too-many-boolean-expressions
+ "PLR6301", # could-be-static no-self-use
+ "PLC0415", # import outside toplevel
+ "PLC2701", # private import
+ "UP006", # builtin instead of typing class
+ "UP007", # x | y typing
+]
+
+[format]
+line-ending = "lf"
diff --git a/setup.py b/setup.py
deleted file mode 100644
index 75a351e..0000000
--- a/setup.py
+++ /dev/null
@@ -1,56 +0,0 @@
-# SPDX-FileCopyrightText: 2021 ladyada for Adafruit Industries
-#
-# SPDX-License-Identifier: MIT
-
-"""A setuptools based setup module.
-
-See:
-https://packaging.python.org/en/latest/distributing.html
-https://github.com/pypa/sampleproject
-"""
-
-# Always prefer setuptools over distutils
-from setuptools import setup, find_packages
-
-# To use a consistent encoding
-from codecs import open
-from os import path
-
-here = path.abspath(path.dirname(__file__))
-
-# Get the long description from the README file
-with open(path.join(here, "README.rst"), encoding="utf-8") as f:
- long_description = f.read()
-
-setup(
- name="adafruit-circuitpython-bluefruitconnect",
- use_scm_version=True,
- setup_requires=["setuptools_scm"],
- description="CircuitPython library for use with the Adafruit Bluefruit Connect apps.",
- long_description=long_description,
- long_description_content_type="text/x-rst",
- # The project's main homepage.
- url="https://github.com/adafruit/Adafruit_CircuitPython_BluefruitConnect",
- # Author details
- author="Adafruit Industries",
- author_email="circuitpython@adafruit.com",
- install_requires=["Adafruit-Blinka"],
- # Choose your license
- license="MIT",
- # See https://pypi.python.org/pypi?%3Aaction=list_classifiers
- classifiers=[
- "Development Status :: 3 - Alpha",
- "Intended Audience :: Developers",
- "Topic :: Software Development :: Libraries",
- "Topic :: System :: Hardware",
- "License :: OSI Approved :: MIT License",
- "Programming Language :: Python :: 3",
- "Programming Language :: Python :: 3.4",
- "Programming Language :: Python :: 3.5",
- ],
- # What does your project relate to?
- keywords="adafruit ble bluefruit bluetooth micropython circuitpython",
- # You can just specify the packages manually here if your project is
- # simple. Or you can use find_packages().
- packages=["adafruit_bluefruit_connect"],
-)
pFad - Phonifier reborn
Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.
Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.
Alternative Proxies:
Alternative Proxy
pFad Proxy
pFad v3 Proxy
pFad v4 Proxy