pybkick - tools to make deploying code to pyboard easier

Discussion about programs, libraries and tools that work with MicroPython. Mostly these are provided by a third party.
Target audience: All users and developers of MicroPython.
salimfadhley
Posts: 22
Joined: Thu Jun 19, 2014 10:18 pm

pybkick - tools to make deploying code to pyboard easier

Post by salimfadhley » Thu Oct 16, 2014 11:39 pm

https://github.com/salimfadhley/pybkick

This is my ongoing project, it's a fork of the pyboard.py utility that is included with the micropython project.

The initial goal is to support remote file operations (e.g. create file, delete, read) over the tty (no USB storage). This means that files can be transferred without having to mount any drive, which can be a nuisance especially if your program requires you to reboot often.

The short term goal is to make a command-line utility that can be scripted from the IDE that can copy a tree of files over and then launch a particular entry-point on the pyboard.

I'd also like to be able to make a 'sdist_pyboard' setuptools extension that automates pushing code to the pyboard in one shot from a python project.

User avatar
dhylands
Posts: 3821
Joined: Mon Jan 06, 2014 6:08 pm
Location: Peachland, BC, Canada
Contact:

Re: pybkick - tools to make deploying code to pyboard easier

Post by dhylands » Fri Oct 17, 2014 1:26 am

Sweet.

I've been thinking about doing something similar.

I was thinking it would be cool to enhance my shell.py to create a remote-shell.py (i.e. you run the shell, and then you can copy files into and out of, and examine the files, but the python code for the shell is actually running on the host.

The next phase after that would be to integrate this into something the IDE that is done for openmv.

User avatar
shell
Posts: 15
Joined: Tue Aug 12, 2014 8:31 pm
Location: Germany
Contact:

Re: pybkick - tools to make deploying code to pyboard easier

Post by shell » Fri Oct 17, 2014 9:14 am

A short howto / description would be nice.

salimfadhley
Posts: 22
Joined: Thu Jun 19, 2014 10:18 pm

Re: pybkick - tools to make deploying code to pyboard easier

Post by salimfadhley » Fri Oct 17, 2014 10:32 pm

I intend to fully document it. :-) Once I get it basically working, I'm going to describe a pattern for how it should be used with a setuptools-configured project (i.e. one with a setup.py file).

salimfadhley
Posts: 22
Joined: Thu Jun 19, 2014 10:18 pm

Re: pybkick - tools to make deploying code to pyboard easier

Post by salimfadhley » Sat Oct 18, 2014 12:19 am

A 0.0.1 release has been pushed to pypi.

There are also some very basic docs on the github page. If anybody has time to try this out I'd be most grateful.

Current limitations:
* The program can only copy to the root directory of the pyboard
* The program can only copy flat directories (i.e. no subdirectories).
* The 'entry point' behavior has not been implemented yet - the idea of this was that whatever function you designated as the package's main-method would be added as the final function call to boot.py

salimfadhley
Posts: 22
Joined: Thu Jun 19, 2014 10:18 pm

Re: pybkick - tools to make deploying code to pyboard easier

Post by salimfadhley » Sat Oct 18, 2014 3:35 pm

For the next feature, I was thinking of making a micropython-lib installer.

It would be able to install/update specfic modules from micropython-lib directly onto the pyboard, for example:

Code: Select all

kick_micropython_lib(['os', 'json']
Would download the appropriate modules from https://github.com/micropython/micropython-lib, and then transfer them over to the pyboard.

Would anybody actually use this kind of feature?

User avatar
dhylands
Posts: 3821
Joined: Mon Jan 06, 2014 6:08 pm
Location: Peachland, BC, Canada
Contact:

Re: pybkick - tools to make deploying code to pyboard easier

Post by dhylands » Sat Oct 18, 2014 5:23 pm

I think its hard to say.

I tend to treat the file system on my pyboard as fairly volatile and that it might disappear at any point in time.

So I tend to keep a directory with all of the files I want on my pyboard locally on my host, and then sync them to the pyboard.

So, what I'd like to implement is something like rsync, where it looks at the timestamp/filesize and copies across any files which are newer/not present on the pyboard.

salimfadhley
Posts: 22
Joined: Thu Jun 19, 2014 10:18 pm

Re: pybkick - tools to make deploying code to pyboard easier

Post by salimfadhley » Sat Oct 18, 2014 10:38 pm

dhylands wrote: I tend to treat the file system on my pyboard as fairly volatile and that it might disappear at any point in time. So I tend to keep a directory with all of the files I want on my pyboard locally on my host, and then sync them to the pyboard. So, what I'd like to implement is something like rsync, where it looks at the timestamp/filesize and copies across any files which are newer/not present on the pyboard.
That was broadly what I was aiming for: Periodically things go wrong on the pyboard, so factory resets/wipes are common. My idea was just to push a directory full of code onto the pyboard as quickly as possible.

I suppose we could make something like rsync - the easiest way to do it would be to compare a checksum of files and then copy if the checksum was different. My feeling was that unless people have very big amounts of code to move then it would be quicker to copy and ask questions later.

That's pretty much what I'm able to do right now.

User avatar
dhylands
Posts: 3821
Joined: Mon Jan 06, 2014 6:08 pm
Location: Peachland, BC, Canada
Contact:

Re: pybkick - tools to make deploying code to pyboard easier

Post by dhylands » Sun Oct 19, 2014 12:56 am

Yeah copy everything is a good start.

I'm not sure I'd go as far as checksums, but I think using timestamps/filesize (which can both be queried without actually reading the file), seems like a logical optimization.

I anticipate using this over some type of wireless link, so I expect the transfer speeds will be less what when using USB.

User avatar
shell
Posts: 15
Joined: Tue Aug 12, 2014 8:31 pm
Location: Germany
Contact:

Re: pybkick - tools to make deploying code to pyboard easier

Post by shell » Sun Oct 19, 2014 6:44 am

Some other ideas:

* do a reset after files are transfered to run the code
* show files on pyboard am sd card
* some kind of debugging the code (for example copy files, start connection to /dev/ttyASM0 and import main.py)

Post Reply