Add clarifying code comments and improve README

This commit is contained in:
hexbabe
2023-11-30 17:55:18 -05:00
parent f60b51d156
commit 85662fd6c3
4 changed files with 13 additions and 10 deletions

View File

@@ -3,7 +3,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.
Use this as a reference for:
- An alternative to managing Python version/dependencies directly
- An alternative to managing Python version/dependencies directly for your robot.
## Robot config
@@ -15,13 +15,15 @@ TODO: add example config after the module is on the registry
## Quick tour of this repo
- `packaging/`: The directory containing the Dockerfile that configures the Docker image for the builder, the AppImageBuilder.yml config file, and the icon
- `src/`: Python code for the Viam module
- `packaging/`: the directory containing the Dockerfile that configures the Docker image to run the builder in, the AppImageBuilder.yml config file, and the icon
- `src/`: Python module code for the Viam module
- `Makefile`: `make` commands to build the module in different ways
- `meta.json`: The metadata config file used when uploading/updating module info on the registry
- `requirements.txt`: List of Python dependencies
- `run.sh`: The entrypoint execution script that starts up the module process
- `meta.json`: the metadata config file used when uploading/updating module info on the registry
- `requirements.txt`: list of Python packages the module depends on
- `run.sh`: the entrypoint execution script that starts up the module process
## Forking this repo
## Using this repo as boilerplate
If you fork this and want to deploy to a robot, you'll need to change all placeholder variables, references to 'viam', and optionally set up secrets for CI. Follow the [fork instructions](https://github.com/viam-labs/python-example-module#forking-this-repo) from the Python example repo.
If you fork this and want to deploy to a robot, you'll need to change all placeholder names and references to the [viam namespace](https://docs.viam.com/appendix/glossary/#term-model-namespace-triplet). Follow the [fork instructions](https://github.com/viam-labs/python-example-module#forking-this-repo) from the Python example repo.
If you aren't making a camera module, you may want to use a different component's repo along with this repo as boilerplate in place of the `src` folder. When doing this, make sure to maintain the structure of a Python module i.e. keeping the outermost `__init__.py` to ensure the build doesn't break. Moreover, in this case, be sure to update your `meta.json` with the updated models.

View File

@@ -1,7 +1,7 @@
"""
This file registers the model with the Python SDK.
"""
# usage of camera type is arbitrary; refactor to your desired component/service
from viam.components.camera import Camera
from viam.resource.registry import Registry, ResourceCreatorRegistration

View File

@@ -1,5 +1,6 @@
import asyncio
# usage of camera type is arbitrary; refactor to your desired component/service
from viam.components.camera import Camera
from viam.logging import getLogger
from viam.module.module import Module

View File

@@ -15,7 +15,7 @@ from viam.resource.types import Model, ModelFamily
LOGGER = getLogger(__name__)
# usage of camera type is arbitrary; refactor to your desired component/service
class MyModule(Camera, Reconfigurable): # use a better name than this
"""
Camera represents any physical hardware that can capture frames.