From bf27aa9f4ade2250d4c08d99624406d896b07eda Mon Sep 17 00:00:00 2001 From: foamyguy Date: Mon, 16 Oct 2023 14:30:31 -0500 Subject: [PATCH 1/4] unpin sphinx and add sphinx-rtd-theme to docs reqs Signed-off-by: foamyguy --- docs/requirements.txt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/docs/requirements.txt b/docs/requirements.txt index 797aa04..979f568 100644 --- a/docs/requirements.txt +++ b/docs/requirements.txt @@ -2,5 +2,6 @@ # # SPDX-License-Identifier: Unlicense -sphinx>=4.0.0 +sphinx sphinxcontrib-jquery +sphinx-rtd-theme From c34d81ca81557fd56ee2b43fbdf77403c657b123 Mon Sep 17 00:00:00 2001 From: foamyguy Date: Mon, 7 Oct 2024 09:24:05 -0500 Subject: [PATCH 2/4] remove deprecated get_html_theme_path() call Signed-off-by: foamyguy --- docs/conf.py | 1 - 1 file changed, 1 deletion(-) diff --git a/docs/conf.py b/docs/conf.py index 776bfb8..0eb655c 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -104,7 +104,6 @@ import sphinx_rtd_theme html_theme = "sphinx_rtd_theme" -html_theme_path = [sphinx_rtd_theme.get_html_theme_path(), "."] # Add any paths that contain custom static files (such as style sheets) here, # relative to this directory. They are copied after the builtin static files, From 04ed5aaba276bc977e47c60558346fd1932d6dea Mon Sep 17 00:00:00 2001 From: foamyguy Date: Tue, 14 Jan 2025 11:32:34 -0600 Subject: [PATCH 3/4] add sphinx configuration to rtd.yaml Signed-off-by: foamyguy --- .readthedocs.yaml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.readthedocs.yaml b/.readthedocs.yaml index 33c2a61..88bca9f 100644 --- a/.readthedocs.yaml +++ b/.readthedocs.yaml @@ -8,6 +8,9 @@ # Required version: 2 +sphinx: + configuration: docs/conf.py + build: os: ubuntu-20.04 tools: From 7502ee631e28a7d18a759537b83996630732272b Mon Sep 17 00:00:00 2001 From: Justin Myers Date: Mon, 24 Feb 2025 13:55:56 -0800 Subject: [PATCH 4/4] Remove secrets usage --- examples/wsgi_simpletest.py | 34 +++++++++++++--------------- examples/wsgi_static_files_server.py | 34 ++++++++++++---------------- 2 files changed, 31 insertions(+), 37 deletions(-) diff --git a/examples/wsgi_simpletest.py b/examples/wsgi_simpletest.py index 738b206..ebf7032 100644 --- a/examples/wsgi_simpletest.py +++ b/examples/wsgi_simpletest.py @@ -1,6 +1,7 @@ # SPDX-FileCopyrightText: 2021 ladyada for Adafruit Industries # SPDX-License-Identifier: MIT +from os import getenv import board import busio from digitalio import DigitalInOut @@ -11,12 +12,9 @@ import adafruit_wsgi.esp32spi_wsgiserver as server from adafruit_wsgi.wsgi_app import WSGIApp -# Get wifi details and more from a secrets.py file -try: - from secrets import secrets -except ImportError: - print("WiFi secrets are kept in secrets.py, please add them there!") - raise +# Get WiFi details, ensure these are setup in settings.toml +ssid = getenv("CIRCUITPY_WIFI_SSID") +password = getenv("CIRCUITPY_WIFI_PASSWORD") # This example depends on a WSGI Server to run. # We are using the wsgi server made for the ESP32 @@ -40,25 +38,25 @@ ) # pylint: disable=line-too-long """Use below for Most Boards""" -status_light = neopixel.NeoPixel( +status_pixel = neopixel.NeoPixel( board.NEOPIXEL, 1, brightness=0.2 ) # Uncomment for Most Boards """Uncomment below for ItsyBitsy M4""" # import adafruit_dotstar as dotstar -# status_light = dotstar.DotStar(board.APA102_SCK, board.APA102_MOSI, 1, brightness=1) +# status_pixel = dotstar.DotStar(board.APA102_SCK, board.APA102_MOSI, 1, brightness=1) -## If you want to connect to wifi with secrets: -wifi = wifimanager.ESPSPI_WiFiManager(esp, secrets, status_light, debug=True) +## If you want to connect to wifi: +wifi = wifimanager.WiFiManager( + esp, ssid, password, status_pixel=status_pixel, debug=True +) wifi.connect() -## If you want to create a WIFI hotspot to connect to with secrets: -# secrets = {"ssid": "My ESP32 AP!", "password": "supersecret"} -# wifi = wifimanager.ESPSPI_WiFiManager(esp, secrets, status_light) +## If you want to create a WIFI hotspot to connect to: +# wifi = wifimanager.WiFiManager(esp, "My ESP32 AP!", "supersecret", status_pixel=status_pixel) # wifi.create_ap() -## To you want to create an un-protected WIFI hotspot to connect to with secrets:" -# secrets = {"ssid": "My ESP32 AP!"} -# wifi = wifimanager.ESPSPI_WiFiManager(esp, secrets, status_light) +## To you want to create an un-protected WIFI hotspot to connect to:" +# wifi = wifimanager.WiFiManager(esp, "My ESP32 AP!", password=None, status_pixel=status_pixel) # wifi.create_ap() # Here we create our application, registering the @@ -70,14 +68,14 @@ @web_app.route("/led_on///") def led_on(request, r, g, b): # pylint: disable=unused-argument print("led on!") - status_light.fill((int(r), int(g), int(b))) + status_pixel.fill((int(r), int(g), int(b))) return ("200 OK", [], "led on!") @web_app.route("/led_off") def led_off(request): # pylint: disable=unused-argument print("led off!") - status_light.fill(0) + status_pixel.fill(0) return ("200 OK", [], "led off!") diff --git a/examples/wsgi_static_files_server.py b/examples/wsgi_static_files_server.py index eacd70b..5165c0d 100755 --- a/examples/wsgi_static_files_server.py +++ b/examples/wsgi_static_files_server.py @@ -3,6 +3,7 @@ # SPDX-License-Identifier: MIT import os +from os import getenv import board import busio from digitalio import DigitalInOut @@ -16,12 +17,9 @@ # being copied to the root of the circuitpython filesystem. # This is where our static assets like html, js, and css live. -# Get wifi details and more from a secrets.py file -try: - from secrets import secrets -except ImportError: - print("WiFi secrets are kept in secrets.py, please add them there!") - raise +# Get WiFi details, ensure these are setup in settings.toml +ssid = getenv("CIRCUITPY_WIFI_SSID") +password = getenv("CIRCUITPY_WIFI_PASSWORD") try: import json as json_module @@ -49,25 +47,23 @@ print("MAC addr actual:", [hex(i) for i in esp.MAC_address_actual]) # Use below for Most Boards -status_light = neopixel.NeoPixel( +status_pixel = neopixel.NeoPixel( board.NEOPIXEL, 1, brightness=0.2 ) # Uncomment for Most Boards # Uncomment below for ItsyBitsy M4 # import adafruit_dotstar as dotstar -# status_light = dotstar.DotStar(board.APA102_SCK, board.APA102_MOSI, 1, brightness=1) +# status_pixel = dotstar.DotStar(board.APA102_SCK, board.APA102_MOSI, 1, brightness=1) -## If you want to connect to wifi with secrets: -wifi = wifimanager.ESPSPI_WiFiManager(esp, secrets, status_light) +## If you want to connect to wifi: +wifi = wifimanager.WiFiManager(esp, ssid, password, status_pixel=status_pixel) wifi.connect() -## If you want to create a WIFI hotspot to connect to with secrets: -# secrets = {"ssid": "My ESP32 AP!", "password": "supersecret"} -# wifi = wifimanager.ESPSPI_WiFiManager(esp, secrets, status_light) +## If you want to create a WIFI hotspot to connect to: +# wifi = wifimanager.WiFiManager(esp, "My ESP32 AP!", "supersecret", status_pixel=status_pixel) # wifi.create_ap() -## To you want to create an un-protected WIFI hotspot to connect to with secrets:" -# secrets = {"ssid": "My ESP32 AP!"} -# wifi = wifimanager.ESPSPI_WiFiManager(esp, secrets, status_light) +## To you want to create an un-protected WIFI hotspot to connect to:" +# wifi = wifimanager.WiFiManager(esp, "My ESP32 AP!", password=None, status_pixel=status_pixel) # wifi.create_ap() @@ -181,13 +177,13 @@ def _get_content_type(self, file): # pylint: disable=no-self-use # Our HTTP Request handlers def led_on(environ): # pylint: disable=unused-argument print("led on!") - status_light.fill((0, 0, 100)) + status_pixel.fill((0, 0, 100)) return web_app.serve_file("static/index.html") def led_off(environ): # pylint: disable=unused-argument print("led off!") - status_light.fill(0) + status_pixel.fill(0) return web_app.serve_file("static/index.html") @@ -195,7 +191,7 @@ def led_color(environ): # pylint: disable=unused-argument json = json_module.loads(environ["wsgi.input"].getvalue()) print(json) rgb_tuple = (json.get("r"), json.get("g"), json.get("b")) - status_light.fill(rgb_tuple) + status_pixel.fill(rgb_tuple) return ("200 OK", [], [])