Python Module Dependencies - sparky8512/starlink-grpc-tools GitHub Wiki

This page describes in detail the external Python module dependencies required by the starlink-grpc-tools scripts. It is not necessary to know this information to run the scripts, as you can just run the install command listed in the README file. Or, if you just want the commands to run for each specific bit of functionality without having to read through piles of background documentation, see the section below.

Required Python modules

The "grpc" scripts require the grpcio Python package at runtime and the optional step of generating the gRPC protocol module code requires the grpcio-tools package. Information about how to install both can be found at https://grpc.io/docs/languages/python/quickstart/. If you skip generation of the gRPC protocol modules, the scripts will instead require the yagrc Python package. Information about how to install that is at https://github.com/sparky8512/yagrc. Most of the grpc scripts also require the typing-extensions module, which can be installed via pip:

pip install typing-extensions

The protobuf Python package should already be installed as a dependency of one of either grpcio-tools or yagrc, but if you care about the performance of the running scripts, you should try to install a version of the protobuf package that has a native-compiled package for your OS and Python version. Notably, the latest versions of the protobuf package are often missing Windows binaries for the latest versions of Python, which will result in a much much slower pure Python implementation being installed. (NOTE: This no longer seems to be the case, but it's still worth checking if performance is important to you.) It requires a little digging to find which OS and Python versions support native builds, but you can find this info by checking the project's release history in the PyPI repository, clicking on a specific release, clicking on "Download files", then looking for a .whl file that matches your OS, architecture, and Python version. You can then install that specific version via pip, for example:

pip install protobuf==3.19.1

The scripts that use MQTT for output require the paho-mqtt Python package. Information about how to install that can be found at https://www.eclipse.org/paho/index.php?page=clients/python/index.php

The scripts that use InfluxDB for output require either the influxdb Python package for InfluxDB 1.x server or the influxdb_client Python package for InfluxDB 2.x server. Information about how to install those can be found at https://github.com/influxdata/influxdb-python#installation and https://github.com/influxdata/influxdb-client-python#installation, respectively.

The dish_obstruction_map.py script requires the pypng Python package. Information about how to install that can be found at https://pypng.readthedocs.io/en/latest/png.html#installation-and-overview

The dish_check_update.py script requires the croniter and python-dateutil packages, but only if the cron-like loop scheduling option in enabled via command line arg. Those can be installed via pip. Some of the other scripts may get this option in the future, at which point, they would have the same requirement if the option is enabled.

Note that the Python package versions available from various Linux distributions (ie: installed via apt-get or similar) tend to run a bit behind those available to install via pip. While the distro packages should work OK as long as they aren't extremely old, they may not work as well as the later versions.

TL;DR

The documents linked in the prior section generally just boil down to a pip install command for each package.

For base functionality, including the text and sqlite output, using reflection to get the protocol definitions (recommended):

pip install "grpcio>=1.12.0" "protobuf>=3.6.0" "typing-extensions>=4.3.0" "yagrc>=1.1.1"

For base functionality using manually generated protocol modules (not recommended, but may be appropriate for some use cases):

pip install "grpcio>=1.12.0" "protobuf>=3.6.0" "grpcio-tools>=1.20.0" "typing-extensions>=4.3.0"

however, grpcio-tools is not needed for the script run time, only to generate the protocol modules.

The following scripts have specific requirements in addition to the above-mentioned base requirements:

For dish_grpc_influx.py:

pip install "influxdb>=5.3.1"

For dish_grpc_influx2.py:

pip install "influxdb_client>=1.23.0"

For dish_grpc_mqtt.py:

pip install "paho-mqtt>=1.5.1"

For dish_obstruction_map.py:

pip install "pypng>=0.0.20"

For dish_check_update.py, if the --loop-cron (-c) command line option is used:

pip install "croniter>=1.0.1" "python-dateutil>=2.7.0"