Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[RSDK-9936] Get the CI system to build the module again #30

Merged
merged 10 commits into from
Feb 10, 2025
6 changes: 5 additions & 1 deletion .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
7 changes: 7 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
__pycache__
.venv

# Artifacts created from running `make setup`
build/
dist/
main.spec
2 changes: 2 additions & 0 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This line looks wrong, but it's right. It looks like "look one directory up for a file, and add a symlink in dist/" but it's actually "add to dist/ a symlink that goes one directory up from there (to the current directory).

tar -czvf dist/archive.tar.gz dist/main

13 changes: 7 additions & 6 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -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
4 changes: 2 additions & 2 deletions src/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,15 @@ 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
),
)
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()


Expand Down
3 changes: 2 additions & 1 deletion src/motion_detector.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down