From b468c026556cfed559b0fff13c490a041c575d50 Mon Sep 17 00:00:00 2001 From: hexbabe Date: Fri, 1 Dec 2023 12:26:14 -0500 Subject: [PATCH] Change model to be unique; Remove mentions of OAK-D; Update README.md to include note of caution --- README.md | 2 +- meta.json | 2 +- packaging/AppImageBuilder.yml | 2 +- src/module.py | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index ffb6584..71aefb8 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ This is an example of using AppImageBuilder to bundle a Python module as an AppImage (only supported on AArch64 for now), and then running it on a robot. -The built AppImage is a binary that runs the Viam module on any Linux AArch64 robot without installing anything else or worrying about the system Python runtime and package dependencies. It is executed via `run.sh`, and packaged to the Viam Modular Registry as a tar.gz file (see Makefile for details). +The built AppImage is a binary that runs the Viam module on any Linux AArch64 robot without installing anything else or worrying about the system Python runtime and package dependencies. It is executed via `run.sh`, and packaged to the Viam Modular Registry as a tar.gz file (see Makefile for details). Note that the AppImage bundling isn't always the best solution for packaging Viam Python modules, but likely the best choice for some use cases. Use this repository's build process as boilerplate to deploy your own Python Viam module as an AppImage. diff --git a/meta.json b/meta.json index 62e3d14..fa3823b 100644 --- a/meta.json +++ b/meta.json @@ -6,7 +6,7 @@ "models": [ { "api": "rdk:component:camera", - "model": "viam:camera:oak-d" + "model": "viam:camera:python-appimage-example" } ], "entrypoint": "run.sh" diff --git a/packaging/AppImageBuilder.yml b/packaging/AppImageBuilder.yml index 97b298d..5e1ac62 100644 --- a/packaging/AppImageBuilder.yml +++ b/packaging/AppImageBuilder.yml @@ -2,7 +2,7 @@ version: 1 script: - python3 -m pip install -r requirements.txt # install dependency packages as modules in root (modules in this context means Python modules) - mkdir -p AppDir/usr/lib/python3.10 && cp -r /usr/local/lib/python3.10/site-packages AppDir/usr/lib/python3.10 # cp from root into appdir; site-packages contains all our modules including dependencies - - cp -r src AppDir/usr/lib/python3.10/site-packages # add source code dir to site-packages so the OAK-D module can be discovered in PYTHONPATH and be run as a Python module + - cp -r src AppDir/usr/lib/python3.10/site-packages # add source code dir to site-packages so the module can be discovered in PYTHONPATH and be run as a Python module - mkdir -p AppDir/usr/share/icons/hicolor/256x256/apps/ && cp viam-server.png AppDir/usr/share/icons/hicolor/256x256/apps/ # icon is required AppDir: diff --git a/src/module.py b/src/module.py index c476e05..84b0ed2 100644 --- a/src/module.py +++ b/src/module.py @@ -30,7 +30,7 @@ class MyModule(Camera, Reconfigurable): # use a better name than this """The distortion parameters of the camera""" - MODEL: ClassVar[Model] = Model(ModelFamily("viam", "camera"), "oak-d") # make sure this matches the model in meta.json + MODEL: ClassVar[Model] = Model(ModelFamily("viam", "camera"), "python-appimage-example") # make sure this matches the model in meta.json # create any class parameters here, 'some_pin' is used as an example (change/add as needed) some_pin: int