Skip to content

Commit 36a5d23

Browse files
committed
Package resolution and exporting nonsense
1 parent 130a84d commit 36a5d23

4 files changed

Lines changed: 25 additions & 6 deletions

File tree

src/powersensor_local/__init__.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,9 @@
2828
respectively. There are also the legacy 'events' and 'rawfirehose' debug aids
2929
which get installed under the names ps-events and ps-rawfirehose respectively.
3030
"""
31-
__all__ = [ 'devices', 'listener', 'plug_api', 'plug_listener' ]
31+
__all__ = [ 'devices', 'listener', 'plug_api', 'plug_listener', 'virtual_household' ]
3232
from .devices import PowersensorDevices
3333
from .listener import PowersensorListener
3434
from .plug_api import PlugApi
3535
from .plug_listener import PlugListener
36+
from .virtual_household import VirtualHousehold

src/powersensor_local/plug_api.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
1-
from async_event_emitter import AsyncEventEmitter
2-
from plug_listener import PlugListener
3-
from xlatemsg import translate_raw_message
1+
import sys
2+
from pathlib import Path
3+
project_root = str(Path(__file__).parents[1])
4+
if project_root not in sys.path:
5+
sys.path.append(project_root)
6+
7+
from powersensor_local.async_event_emitter import AsyncEventEmitter
8+
from powersensor_local.plug_listener import PlugListener
9+
from powersensor_local.xlatemsg import translate_raw_message
410

511
class PlugApi(AsyncEventEmitter):
612
"""

src/powersensor_local/plug_listener.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,13 @@
33
import socket
44
import time
55

6-
from async_event_emitter import AsyncEventEmitter
6+
import sys
7+
from pathlib import Path
8+
project_root = str(Path(__file__).parents[1])
9+
if project_root not in sys.path:
10+
sys.path.append(project_root)
11+
12+
from powersensor_local.async_event_emitter import AsyncEventEmitter
713

814
class PlugListener(AsyncEventEmitter):
915
"""An interface class for accessing the event stream from a single plug.

src/powersensor_local/virtual_household.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
11
"""Abstraction for producing a household view."""
22

3-
from async_event_emitter import AsyncEventEmitter
3+
import sys
4+
from pathlib import Path
5+
project_root = str(Path(__file__).parents[1])
6+
if project_root not in sys.path:
7+
sys.path.append(project_root)
8+
9+
from powersensor_local.async_event_emitter import AsyncEventEmitter
410
from dataclasses import dataclass
511
from typing import Optional
612

0 commit comments

Comments
 (0)