and standard pypi boilerplate

This commit is contained in:
geeksville
2020-04-27 11:36:55 -07:00
parent 3ad780e3cd
commit d11854c39c
4 changed files with 64 additions and 4 deletions

18
TODO.md
View File

@@ -27,15 +27,25 @@ Use a pubsub model to communicate events [https://pypubsub.readthedocs.io/en/v4.
- meshtastic.receive.position(MeshPacket)
- meshtastic.receive.user(MeshPacket)
- meshtastic.receive.data(MeshPacket)
- meshtastic.debugMessage(string)
- meshtastic.debug(string)
## Wire encoding
When sending protobuf packets over serial or TCP each packet is preceded by uint32_t sent in network byte order (big endian).
The upper 16 bits must be 0x4403. The lower 16 bits are packet length (this encoding gives room to eventually allow quite large packets).
When sending protobuf packets over serial or TCP each packet is preceded by uint32 sent in network byte order (big endian).
The upper 16 bits must be 0x94C3. The lower 16 bits are packet length (this encoding gives room to eventually allow quite large packets).
Implementations validate length against the maximum possible size of a BLE packet (our lowest common denominator) of 512 bytes. If the
length provided is larger than that we assume the packet is corrupted and begin again looking for 0x4403 framing.
The packets flowing towards the device are ToRadio protobufs, the packets flowing from the device are FromRadio protobufs.
The 0x4403 marker can be used as framing to (eventually) resync if packets are corrupted over the wire.
The 0x94C3 marker can be used as framing to (eventually) resync if packets are corrupted over the wire.
Note: the 0x94C3 framing was chosen to prevent confusion with the 7 bit ascii character set. It also doesn't collide with any valid utf8 encoding. This makes it a bit easier to start a device outputting regular debug output on its serial port and then only after it has received a valid packet from the PC, turn off unencoded debug printing and switch to this
packet encoding.
## MeshtasticShell
A tool to talk to radios (also serves as an example of the API).
tips to output to multiple windows:
https://stackoverflow.com/questions/12351786/how-to-redirect-print-statements-to-tkinter-text-widget

35
setup.py Normal file
View File

@@ -0,0 +1,35 @@
import pathlib
from setuptools import setup
# The directory containing this file
HERE = pathlib.Path(__file__).parent
# The text of the README file
README = (HERE / "README.md").read_text()
# This call to setup() does all the work
setup(
name="ezdevice",
version="0.0.7",
description="Python API & client shell for talking to Meshtastic devices",
long_description=README,
long_description_content_type="text/markdown",
url="https://github.com/meshtastic/Meshtastic-python",
author="Kevin Hester",
author_email="kevinh@geeksville.com",
license="MIT",
classifiers=[
"License :: OSI Approved :: MIT License",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.7",
],
packages=["meshtastic"],
include_package_data=True,
install_requires=["FIXME"],
python_requires='>=3',
entry_points={
"console_scripts": [
"meshtastic=meshtastic.__main__:main",
]
},
)

11
test-release.sh Executable file
View File

@@ -0,0 +1,11 @@
rm dist/*
set -e
pydoc3 -w meshtastic
mv *.html doc
python3 setup.py sdist bdist_wheel
python3 -m twine check dist/*
# test the upload
python3 -m twine upload --repository-url https://test.pypi.org/legacy/ dist/*
echo "view the upload at https://test.pypi.org/ it it looks good upload for real"

4
upload-release.sh Executable file
View File

@@ -0,0 +1,4 @@
rm dist/*
set -e
python3 setup.py sdist bdist_wheel
python3 -m twine upload dist/*