Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,16 +34,19 @@ jobs:
which meshtastic
meshtastic --version
- name: Run pylint
run: pylint meshtastic examples/ --ignore-patterns ".*_pb2.py$"
run: pylint meshtastic examples/ --ignore-patterns ".*_pb2.pyi?$"
- name: Check types with mypy
run: mypy meshtastic/
- name: Run tests with pytest
run: pytest --cov=meshtastic
- name: Generate coverage report
run: |
pytest --cov=meshtastic --cov-report=xml
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v2
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
env_vars: OS, PYTHON
files: ./coverage.xml
flags: unittests
name: codecov-umbrella
Expand Down
4 changes: 2 additions & 2 deletions bin/regen-protobufs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
#gsed -i 's/import "\//import ".\//g' ./protobufs/meshtastic/*
#gsed -i 's/package meshtastic;//g' ./protobufs/meshtastic/*

./nanopb-0.4.7/generator-bin/protoc -I=protobufs --python_out ./ ./protobufs/meshtastic/*.proto
./nanopb-0.4.7/generator-bin/protoc -I=protobufs --python_out ./meshtastic/ ./protobufs/nanopb.proto
./nanopb-0.4.7/generator-bin/protoc -I=protobufs --python_out ./ --mypy_out ./ ./protobufs/meshtastic/*.proto
./nanopb-0.4.7/generator-bin/protoc -I=protobufs --python_out ./meshtastic/ --mypy_out ./meshtastic/ ./protobufs/nanopb.proto
Comment on lines +7 to +8
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 is what gets the pyi files to be generated.


# workaround for import bug in protoc https://github.com/protocolbuffers/protobuf/issues/1491#issuecomment-690618628

Expand Down
9 changes: 4 additions & 5 deletions meshtastic/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,15 @@
import sys
import time

import pyqrcode
import pyqrcode # type: ignore[import-untyped]
import yaml
from google.protobuf.json_format import MessageToDict
from pubsub import pub
from pubsub import pub # type: ignore[import-untyped]

import meshtastic.test
import meshtastic.util
from meshtastic import channel_pb2, config_pb2, portnums_pb2, remote_hardware
from meshtastic import channel_pb2, config_pb2, portnums_pb2, remote_hardware, BROADCAST_ADDR
from meshtastic.version import get_active_version
from meshtastic.__init__ import BROADCAST_ADDR
Comment on lines -19 to -21
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Removing this import from meshtastic.__init__ was something mypy needed to be happy, and is done a few different places. Otherwise it would complain about the same file being imported both as meshtastic and as meshtastic.__init__. Plus importing from __init__ is a little bit funky anyway, pythonically speaking.

from meshtastic.ble_interface import BLEInterface
from meshtastic.globals import Globals

Expand Down Expand Up @@ -147,7 +146,7 @@ def setPref(config, comp_name, valStr) -> bool:

objDesc = config.DESCRIPTOR
config_type = objDesc.fields_by_name.get(name[0])
pref = False
pref = None
if config_type and config_type.message_type is not None:
pref = config_type.message_type.fields_by_name.get(snake_name)
# Others like ChannelSettings are standalone
Expand Down
22 changes: 11 additions & 11 deletions meshtastic/admin_pb2.py

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading