-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: resolve python imports, package pyinstaller exec correctly
- Loading branch information
1 parent
23e24af
commit e7711d2
Showing
6 changed files
with
13 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
viam-sdk | ||
adafruit-circuitpython-mcp3xxx | ||
google-api-python-client | ||
RPi.GPIO |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,3 @@ | ||
""" | ||
This file registers the model with the Python SDK. | ||
""" | ||
|
||
from viam.components.sensor import Sensor | ||
from viam.resource.registry import Registry, ResourceCreatorRegistration | ||
|
||
from .mcp300x import mcp300x | ||
|
||
Registry.register_resource_creator(Sensor.SUBTYPE, mcp300x.MODEL, ResourceCreatorRegistration(mcp300x.new, mcp300x.validate)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,24 @@ | ||
import asyncio | ||
|
||
from viam.components.sensor import Sensor | ||
from viam.resource.registry import Registry, ResourceCreatorRegistration | ||
from viam.module.module import Module | ||
from .mcp300x import mcp300x | ||
from mcp300x import mcp3xxx | ||
|
||
|
||
async def main(): | ||
"""This function creates and starts a new module, after adding all desired resources. | ||
Resources must be pre-registered. For an example, see the `__init__.py` file. | ||
""" | ||
Registry.register_resource_creator( | ||
Sensor.SUBTYPE, | ||
mcp3xxx.MODEL, | ||
ResourceCreatorRegistration(mcp3xxx.new, mcp3xxx.validate), | ||
) | ||
module = Module.from_args() | ||
module.add_model_from_registry(Sensor.SUBTYPE, mcp300x.MODEL) | ||
module.add_model_from_registry(Sensor.SUBTYPE, mcp3xxx.MODEL) | ||
await module.start() | ||
|
||
|
||
if __name__ == "__main__": | ||
asyncio.run(main()) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters