use installable shared lib for shared code

This commit is contained in:
Marco Zeisler
2021-05-27 19:53:41 +02:00
parent 37bffd5ce8
commit 73174858d6
21 changed files with 50 additions and 15 deletions
View File
+1 -1
View File
@@ -1,7 +1,7 @@
import pickle
from flask_redis import Redis
from shared.message_broker_wrapper import MBWrapper
from dse_shared_libs.message_broker_wrapper import MBWrapper
class EventLogger:
+1 -1
View File
@@ -1,6 +1,6 @@
import threading
from event_store.event_logger import EventLogger
from event_logger import EventLogger
from flask import Flask
from flask_redis import Redis
+3 -4
View File
@@ -6,10 +6,9 @@ from datetime import datetime
from circuitbreaker import circuit
# Default switching time in seconds
from shared import traffic_light_color
from shared.traffic_light_color import TrafficLightColor
from shared.message_broker_wrapper import MBWrapper
from shared.traffic_light_state import TrafficLightState
from dse_shared_libs.traffic_light_color import TrafficLightColor
from dse_shared_libs.message_broker_wrapper import MBWrapper
from dse_shared_libs.traffic_light_state import TrafficLightState
SWITCHING_TIME = 500
# Scale speed of switching by factor x
+3 -3
View File
@@ -7,12 +7,12 @@ from typing import Union
import geopy
import geopy.distance
from circuitbreaker import circuit
from shared.daf import DAF
from dse_shared_libs.daf import DAF
from shared.message_broker_wrapper import MBWrapper
from dse_shared_libs.message_broker_wrapper import MBWrapper
# Lat, Long
from shared.target_velocity import TargetVelocity
from dse_shared_libs.target_velocity import TargetVelocity
STARTING_POINT = geopy.Point(48.853, 2.349)
# in km/h
+5 -5
View File
@@ -3,13 +3,13 @@ import sys
from random import randrange
from typing import List, Dict
from shared import daf
from shared.traffic_light_color import TrafficLightColor
from shared.message_broker_wrapper import MBWrapper
from dse_shared_libs import daf
from dse_shared_libs.traffic_light_color import TrafficLightColor
from dse_shared_libs.message_broker_wrapper import MBWrapper
# necessary to unpickle daf object
from shared.target_velocity import TargetVelocity
from shared.traffic_light_state import TrafficLightState
from dse_shared_libs.target_velocity import TargetVelocity
from dse_shared_libs.traffic_light_state import TrafficLightState
sys.modules['daf'] = daf
+5
View File
@@ -0,0 +1,5 @@
Install shared libs via
* To have life changes: `python setup.py develop`
* To install properly: `python setup.py install`
Create installable package via `python setup.py sdist`
View File
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,10 @@
Metadata-Version: 1.0
Name: dse-shared-libs
Version: 1
Summary: UNKNOWN
Home-page: UNKNOWN
Author: UNKNOWN
Author-email: UNKNOWN
License: BSD License
Description: UNKNOWN
Platform: UNKNOWN
@@ -0,0 +1,11 @@
setup.py
dse_shared_libs/__init__.py
dse_shared_libs/daf.py
dse_shared_libs/message_broker_wrapper.py
dse_shared_libs/target_velocity.py
dse_shared_libs/traffic_light_color.py
dse_shared_libs/traffic_light_state.py
dse_shared_libs.egg-info/PKG-INFO
dse_shared_libs.egg-info/SOURCES.txt
dse_shared_libs.egg-info/dependency_links.txt
dse_shared_libs.egg-info/top_level.txt
@@ -0,0 +1 @@
dse_shared_libs
@@ -1,7 +1,7 @@
from dataclasses import dataclass
from datetime import datetime
from shared.traffic_light_color import TrafficLightColor
from dse_shared_libs.traffic_light_color import TrafficLightColor
@dataclass
+8
View File
@@ -0,0 +1,8 @@
from setuptools import find_packages, setup
setup(name='dse-shared-libs',
version=1,
packages=find_packages(),
include_package_data=True,
license='BSD License', # example license
)