Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,11 @@ jobs:
with:
node-version: "22"

- name: "Create OpenAPI Spec"
run: |
pip install -r backend_py/requirements.txt
python3 -m backend_py.scripts.export_openapi

- name: "Build Project"
run: |
./create_release.sh
Expand All @@ -32,7 +37,9 @@ jobs:
if: startsWith(github.ref, 'refs/tags/')
uses: softprops/action-gh-release@v2
with:
files: release.tar.gz
files: |
release.tar.gz
openapi.json
generate_release_notes: true
draft: true
prerelease: false
14 changes: 3 additions & 11 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -312,17 +312,7 @@ poetry.toml
# LSP config files
pyrightconfig.json

### VirtualEnv ###
# Virtualenv
# http://iamzed.com/2009/05/07/a-primer-on-virtualenv/
[Bb]in
[Ii]nclude
[Ll]ib
[Ll]ib64
[Ll]ocal
[Ss]cripts
pyvenv.cfg
pip-selfcheck.json
# Removed venv ignores

# End of https://www.toptal.com/developers/gitignore/api/python,virtualenv,data,pycharm,powershell

Expand All @@ -336,3 +326,5 @@ pi-gen
/recordings/

!frontend/src/lib/

openapi.json
4 changes: 0 additions & 4 deletions backend_py/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,15 +1,11 @@
#gevent==22.10.2
linuxpy==0.13.0
natsort==8.4.0
PyEventEmitter==1.0.5
rpi_hardware_pwm==0.2.2
fastapi
pydantic
python-socketio
dbus-python==1.2.18
uvicorn
sdbus==0.14.0
sdbus-networkmanager==2.0.0
rtp==0.0.4
pyserial
colorlog==6.10.1
8 changes: 4 additions & 4 deletions backend_py/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,12 @@ async def lifespan(app: FastAPI): # noqa: ANN201


# FastAPI application
app = FastAPI(
fastapi_app = FastAPI(
lifespan=lifespan, title="DWE OS API", description="API for DWE OS", version="0.1.0"
)

# CORS
app.add_middleware(
fastapi_app.add_middleware(
CORSMiddleware,
allow_origins=["*"],
allow_credentials=False,
Expand All @@ -51,15 +51,15 @@ async def lifespan(app: FastAPI): # noqa: ANN201
server = Server(
FeatureSupport(ttyd=True, wifi=True, serial=True),
sio,
app,
fastapi_app,
data_dir=".",
settings_path=".",
log_level=logging.DEBUG,
is_dev_mode=True,
)

# Combine FastAPI and Socket.IO ASGI apps
app = socketio.ASGIApp(sio, other_asgi_app=app)
app = socketio.ASGIApp(sio, other_asgi_app=fastapi_app)

# Run with Uvicorn
if __name__ == "__main__":
Expand Down
6 changes: 6 additions & 0 deletions backend_py/scripts/export_openapi.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import json

from backend_py.run import fastapi_app

with open("openapi.json", "w") as f:
json.dump(fastapi_app.openapi(), f, indent=2)
10 changes: 4 additions & 6 deletions install_requirements.sh
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ install_ttyd() {

local version="1.6.3"
local filename="ttyd.x86_64"

# set filename based on architecture
case $arch in
x86_64)
Expand All @@ -44,7 +44,7 @@ install_ttyd() {
esac

echo "Downloading ttyd version ${version} for ${arch}..."

# create temporary directory
local temp_dir=$(mktemp -d)
cd "$temp_dir"
Expand All @@ -71,7 +71,7 @@ install_ttyd() {
rm -rf "$temp_dir"

echo "Successfully installed ttyd version ${version}"

# verify installation
if command -v ttyd >/dev/null 2>&1; then
echo "ttyd is now available at: $(which ttyd)"
Expand All @@ -88,8 +88,6 @@ sudo apt-get update -y
# Install python and gstreamer dependencies
echo "Installing Python dependencies..."
sudo apt-get install python3 python3-venv -y
# For dbus-python
sudo apt-get install build-essential libdbus-glib-1-dev libdbus-1-dev libpython3-dev -y

echo "Installing GStreamer dependencies..."
sudo apt-get install -y libglib2.0-dev libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev gstreamer1.0-tools gstreamer1.0-x gstreamer1.0-plugins-base gstreamer1.0-plugins-good gstreamer1.0-plugins-bad gstreamer1.0-libav gstreamer1.0-plugins-ugly libimage-exiftool-perl
Expand All @@ -106,4 +104,4 @@ else
echo "ttyd installed from repositories"
fi

echo "Requirements installed."
echo "Requirements installed."
Loading