Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bunch of Tiny Fixes and Enhancements #41

Merged
merged 7 commits into from
Dec 27, 2019
Merged

Conversation

mcfletch
Copy link
Contributor

Hey there,

Thanks for all the work on the package. We've just spent an hour or two here getting everything connected and working on Linux/Ubuntu/Kubuntu 19.10 on a new Boost Vernie and thought we'd kick back the changes we made to get the demo running here.

Feel free to cherry pick individual commits if you'd rather skip some of the changes.

  • The first change is to use setuptools for setup, as python3.6 distutils reused to honour the extras_require parameters
  • second is to allow for debugging an error seen where an assert is raised for the incoming type of a message, but it simply bombed out the script without telling us what was wrong
  • third is to deal with cases where there is truncated input on the input, so the struct unpacking was failing. The most common failure case we saw was to have 0 bytes coming in on a 1-byte unpack
  • fourth is the most invasive change, which reworks the demo to use argparse and allow for providing a URL for the robot to use, and also to specify that a single demo be run rather than always running all demos (to make it easier to debug a single demo)

Take care,
Mike

This also declares some hidden dependencies for the underlying
connection protocols, but note that they are normally reliant
on system-packaged versions, which is a bit less than optimal.
…nd line

Also addresses a crash in led demo where parameters x and y were not provided
to an empty lamba that was passed in.
@codecov-io
Copy link

codecov-io commented Dec 26, 2019

Codecov Report

Merging #41 into master will increase coverage by 30.24%.
The diff coverage is 60%.

Impacted file tree graph

@@             Coverage Diff             @@
##           master      #41       +/-   ##
===========================================
+ Coverage   45.24%   75.49%   +30.24%     
===========================================
  Files          37       17       -20     
  Lines        3421     2057     -1364     
===========================================
+ Hits         1548     1553        +5     
+ Misses       1873      504     -1369
Impacted Files Coverage Δ
setup.py 0% <0%> (ø) ⬆️
pylgbst/messages.py 75.8% <50%> (-0.17%) ⬇️
pylgbst/utilities.py 88.46% <72.72%> (-6.28%) ⬇️
examples/bb8joystick/program.py
examples/plotter/__init__.py
examples/bb8joystick/__init__.py
examples/harmonograph/__init__.py
examples/automata/__init__.py
examples/plotter/try.py
examples/vernie/run_away_game.py
... and 12 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 7dc8b80...196761e. Read the comment docs.

@@ -173,7 +173,7 @@ def bytes(self):
return super(MsgHubAction, self).bytes()

def is_reply(self, msg):
assert isinstance(msg, MsgHubAction)
assert isinstance(msg, MsgHubAction), type(msg)
Copy link
Owner

Choose a reason for hiding this comment

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

It's good to add some message to it, like 'Unexpected type message type: %s'. Let's do it good if we got to improving it :)

@@ -14,18 +15,24 @@

queue = queue # just to use it

def check_unpack(seq, index, pattern, size):
Copy link
Owner

Choose a reason for hiding this comment

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

This code needs some formatting to comply to PEP-9.

setup.py Outdated
@@ -1,4 +1,5 @@
from distutils.core import setup
#from distutils.core import setup
Copy link
Owner

Choose a reason for hiding this comment

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

don't comment, just delete

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sure, if you're okay with the change I'll commit to it.

setup.py Outdated
@@ -8,9 +9,10 @@
packages=['pylgbst', "pylgbst.comms"],
requires=[],
extras_require={
'gatt': ["gatt"],
# Note that dbus and gi are normally system packages
Copy link
Owner

Choose a reason for hiding this comment

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

Please do regular formatting, like standards require

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Didn't realise you had a formatting spec. I don't see one in the repository, so I'm assuming black, though that seems to be producing rather large diffs on the modules to which I'm applying it.

@undera
Copy link
Owner

undera commented Dec 26, 2019

Thanks for contributing. I've put some comments, please address them.
The most intrusive change is the one with check_unpack - I totally don't expect this to happen on a regular basis, so I don't fully like this change. I'd love to understand why can this happen and if there is more aesthetic way to deal with the situation.

@undera undera merged commit c955820 into undera:master Dec 27, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants