diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index e6f680d..79cd155 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -15,7 +15,11 @@ jobs: - uses: actions/checkout@v3 - name: Install dependencies - run: pip install -r requirements.txt + run: | + python --version + pip install --upgrade pip + pip --version + pip install -r requirements.txt - name: Run lint run: make lint diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..44fc3db --- /dev/null +++ b/.gitignore @@ -0,0 +1,7 @@ +__pycache__ +.venv + +# Artifacts created from running `make setup` +build/ +dist/ +main.spec diff --git a/build.sh b/build.sh index 326d879..3242960 100755 --- a/build.sh +++ b/build.sh @@ -34,5 +34,7 @@ echo installing dependencies from requirements.txt $VIRTUAL_ENV/bin/pip install -r requirements.txt -U source $VIRTUAL_ENV/bin/activate $PYTHON -m PyInstaller --onefile --hidden-import="googleapiclient" --add-data="./src:src" src/main.py +# When running as a local module, we need meta.json to be in the same directory as the module. +ln -sf ../meta.json dist tar -czvf dist/archive.tar.gz dist/main diff --git a/requirements.txt b/requirements.txt index 90185a3..d20f106 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,7 +1,8 @@ -pillow == 10.0.1 -numpy == 1.25.0 -viam-sdk -pyinstaller -pylint -pytest +pillow == 11.0.0 +numpy == 1.26.4 +viam-sdk==0.39.0 +pyinstaller==6.11.1 +pylint==3.3.4 +pytest==8.3.4 +pytest-asyncio==0.25.3 opencv-python == 4.9.0.80 diff --git a/src/main.py b/src/main.py index 16e2ddf..b9ae947 100644 --- a/src/main.py +++ b/src/main.py @@ -13,7 +13,7 @@ async def main(): registry before the module adds the resource model. """ Registry.register_resource_creator( - Vision.SUBTYPE, + Vision.API, MotionDetector.MODEL, ResourceCreatorRegistration( MotionDetector.new_service, MotionDetector.validate_config @@ -21,7 +21,7 @@ async def main(): ) module = Module.from_args() - module.add_model_from_registry(Vision.SUBTYPE, MotionDetector.MODEL) + module.add_model_from_registry(Vision.API, MotionDetector.MODEL) await module.start() diff --git a/src/motion_detector.py b/src/motion_detector.py index 2bd3eae..760c2a7 100644 --- a/src/motion_detector.py +++ b/src/motion_detector.py @@ -193,7 +193,8 @@ async def get_properties( object_point_clouds_supported=False, ) - async def capture_all_from_camera( + # The linter doesn't like the vision service API, which we can't change. + async def capture_all_from_camera( # pylint: disable=too-many-positional-arguments self, camera_name: str, return_image: bool = False,