From 5c662822b99a28d91554bb52064126d8cf8bc066 Mon Sep 17 00:00:00 2001 From: Mike Kinney Date: Wed, 5 Jan 2022 11:16:08 -0800 Subject: [PATCH 1/2] need to fully qualify imports so projects consuming the library will work --- meshtastic/__init__.py | 8 +++++--- meshtastic/__main__.py | 8 ++++---- meshtastic/ble_interface.py | 2 +- meshtastic/mesh_interface.py | 6 +++--- meshtastic/node.py | 4 ++-- meshtastic/remote_hardware.py | 4 ++-- meshtastic/serial_interface.py | 2 +- meshtastic/stream_interface.py | 4 ++-- meshtastic/tcp_interface.py | 2 +- meshtastic/test.py | 6 +++--- meshtastic/tunnel.py | 6 +++--- 11 files changed, 27 insertions(+), 25 deletions(-) diff --git a/meshtastic/__init__.py b/meshtastic/__init__.py index e2a91f3bf..0bcf1021b 100644 --- a/meshtastic/__init__.py +++ b/meshtastic/__init__.py @@ -77,9 +77,11 @@ def onConnection(interface, topic=pub.AUTO_TOPIC): # called when we (re)connect from dotmap import DotMap from tabulate import tabulate from google.protobuf.json_format import MessageToJson -from .util import fixme, catchAndIgnore, stripnl, DeferredExecution, Timeout -from .node import Node -from . import mesh_pb2, portnums_pb2, apponly_pb2, admin_pb2, environmental_measurement_pb2, remote_hardware_pb2, channel_pb2, radioconfig_pb2, util +from meshtastic.util import fixme, catchAndIgnore, stripnl, DeferredExecution, Timeout +from meshtastic.node import Node +from meshtastic import (mesh_pb2, portnums_pb2, apponly_pb2, admin_pb2, + environmental_measurement_pb2, remote_hardware_pb2, + channel_pb2, radioconfig_pb2, util) # Note: To follow PEP224, comments should be after the module variable. diff --git a/meshtastic/__main__.py b/meshtastic/__main__.py index 007eec25c..f835133d6 100644 --- a/meshtastic/__main__.py +++ b/meshtastic/__main__.py @@ -13,10 +13,10 @@ import pkg_resources import meshtastic.util import meshtastic.test -from . import remote_hardware -from .ble_interface import BLEInterface -from . import portnums_pb2, channel_pb2, radioconfig_pb2 -from .globals import Globals +from meshtastic import remote_hardware +from meshtastic.ble_interface import BLEInterface +from meshtastic import portnums_pb2, channel_pb2, radioconfig_pb2 +from meshtastic.globals import Globals def onReceive(packet, interface): diff --git a/meshtastic/ble_interface.py b/meshtastic/ble_interface.py index 8248d2427..0f4517450 100644 --- a/meshtastic/ble_interface.py +++ b/meshtastic/ble_interface.py @@ -4,7 +4,7 @@ import pygatt -from .mesh_interface import MeshInterface +from meshtastic.mesh_interface import MeshInterface # Our standard BLE characteristics TORADIO_UUID = "f75c76d2-129e-4dad-a1dd-7866124401e7" diff --git a/meshtastic/mesh_interface.py b/meshtastic/mesh_interface.py index 2234f08a3..06e414713 100644 --- a/meshtastic/mesh_interface.py +++ b/meshtastic/mesh_interface.py @@ -17,9 +17,9 @@ import meshtastic.node -from . import portnums_pb2, mesh_pb2 -from .util import stripnl, Timeout, our_exit, remove_keys_from_dict, convert_mac_addr -from .__init__ import LOCAL_ADDR, BROADCAST_NUM, BROADCAST_ADDR, ResponseHandler, publishingThread, OUR_APP_VERSION, protocols +from meshtastic import portnums_pb2, mesh_pb2 +from meshtastic.util import stripnl, Timeout, our_exit, remove_keys_from_dict, convert_mac_addr +from meshtastic.__init__ import LOCAL_ADDR, BROADCAST_NUM, BROADCAST_ADDR, ResponseHandler, publishingThread, OUR_APP_VERSION, protocols class MeshInterface: """Interface class for meshtastic devices diff --git a/meshtastic/node.py b/meshtastic/node.py index 003c94502..3d28200bd 100644 --- a/meshtastic/node.py +++ b/meshtastic/node.py @@ -4,8 +4,8 @@ import logging import base64 from google.protobuf.json_format import MessageToJson -from . import portnums_pb2, apponly_pb2, admin_pb2, channel_pb2 -from .util import pskToString, stripnl, Timeout, our_exit, fromPSK +from meshtastic import portnums_pb2, apponly_pb2, admin_pb2, channel_pb2 +from meshtastic.util import pskToString, stripnl, Timeout, our_exit, fromPSK diff --git a/meshtastic/remote_hardware.py b/meshtastic/remote_hardware.py index 59286c417..832dd63b7 100644 --- a/meshtastic/remote_hardware.py +++ b/meshtastic/remote_hardware.py @@ -2,8 +2,8 @@ """ import logging from pubsub import pub -from . import portnums_pb2, remote_hardware_pb2 -from .util import our_exit +from meshtastic import portnums_pb2, remote_hardware_pb2 +from meshtastic.util import our_exit def onGPIOreceive(packet, interface): diff --git a/meshtastic/serial_interface.py b/meshtastic/serial_interface.py index 720615ea6..43e0f83ec 100644 --- a/meshtastic/serial_interface.py +++ b/meshtastic/serial_interface.py @@ -6,7 +6,7 @@ import serial import meshtastic.util -from .stream_interface import StreamInterface +from meshtastic.stream_interface import StreamInterface if platform.system() != 'Windows': import termios diff --git a/meshtastic/stream_interface.py b/meshtastic/stream_interface.py index 8b81f9c5b..0db74e386 100644 --- a/meshtastic/stream_interface.py +++ b/meshtastic/stream_interface.py @@ -7,8 +7,8 @@ import serial -from .mesh_interface import MeshInterface -from .util import stripnl +from meshtastic.mesh_interface import MeshInterface +from meshtastic.util import stripnl START1 = 0x94 diff --git a/meshtastic/tcp_interface.py b/meshtastic/tcp_interface.py index 204872d6d..37e34bb05 100644 --- a/meshtastic/tcp_interface.py +++ b/meshtastic/tcp_interface.py @@ -4,7 +4,7 @@ import socket from typing import AnyStr -from .stream_interface import StreamInterface +from meshtastic.stream_interface import StreamInterface class TCPInterface(StreamInterface): """Interface class for meshtastic devices over a TCP link""" diff --git a/meshtastic/test.py b/meshtastic/test.py index c35b37c4d..bedae30fe 100644 --- a/meshtastic/test.py +++ b/meshtastic/test.py @@ -8,9 +8,9 @@ from dotmap import DotMap from pubsub import pub import meshtastic.util -from .__init__ import BROADCAST_NUM -from .serial_interface import SerialInterface -from .tcp_interface import TCPInterface +from meshtastic.__init__ import BROADCAST_NUM +from meshtastic.serial_interface import SerialInterface +from meshtastic.tcp_interface import TCPInterface """The interfaces we are using for our tests""" diff --git a/meshtastic/tunnel.py b/meshtastic/tunnel.py index 1fff1e1ff..6e235d899 100644 --- a/meshtastic/tunnel.py +++ b/meshtastic/tunnel.py @@ -22,9 +22,9 @@ from pytap2 import TapDevice -from . import portnums_pb2 -from .util import ipstr, readnet_u16 -from .globals import Globals +from meshtastic import portnums_pb2 +from meshtastic.util import ipstr, readnet_u16 +from meshtastic.globals import Globals def onTunnelReceive(packet, interface): From fe69f05e75d4ab7b001b37171bce26844aeb79e7 Mon Sep 17 00:00:00 2001 From: Mike Kinney Date: Wed, 5 Jan 2022 11:20:04 -0800 Subject: [PATCH 2/2] add python 3.6, 3.7, 3.8, and 3.9 for ci and validation --- .github/workflows/ci.yml | 18 ++++++++++++++---- setup.py | 5 ++++- 2 files changed, 18 insertions(+), 5 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 0d18680cc..5a1c8da01 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -10,12 +10,17 @@ on: jobs: build: runs-on: ubuntu-latest + strategy: + matrix: + python-version: + - "3.6" + - "3.7" + - "3.8" + - "3.9" steps: - uses: actions/checkout@v2 - name: Install Python 3 uses: actions/setup-python@v1 - with: - python-version: 3.9 - name: Uninstall meshtastic run: | pip3 uninstall meshtastic @@ -46,12 +51,17 @@ jobs: fail_ci_if_error: true validate: runs-on: ubuntu-latest + strategy: + matrix: + python-version: + - "3.6" + - "3.7" + - "3.8" + - "3.9" steps: - uses: actions/checkout@v2 - name: Install Python 3 uses: actions/setup-python@v1 - with: - python-version: 3.9 - name: Install meshtastic from local run: | pip3 install . diff --git a/setup.py b/setup.py index c19f9c47a..bf210046f 100644 --- a/setup.py +++ b/setup.py @@ -12,7 +12,7 @@ # This call to setup() does all the work setup( name="meshtastic", - version="1.2.51", + version="1.2.52", description="Python API & client shell for talking to Meshtastic devices", long_description=long_description, long_description_content_type="text/markdown", @@ -23,7 +23,10 @@ classifiers=[ "License :: OSI Approved :: MIT License", "Programming Language :: Python :: 3", + "Programming Language :: Python :: 3.6", "Programming Language :: Python :: 3.7", + "Programming Language :: Python :: 3.8", + "Programming Language :: Python :: 3.9", ], packages=["meshtastic"], include_package_data=True,