Package: microfs
MicroFSA simple command line tool and module for interacting with the limited
file system provided by MicroPython on the BBC micro:bit.InstallationTo install simply type:$ pip install microfs…and the package will download from PyPI. If you wish to upgrade to the
latest version, use the following command:$ pip install --no-cache --upgrade microfsUsageThere are two ways to use microfs - as a module in your Python code or as a
stand-alone command to use from your shell (ufs).In CodeIn your Python script import the required functions like this:from microfs import ls, rm, put, get, get_serialRead the API documentation below to learn how each of the functions works.Command LineFrom the command line (but not the Python shell) use the “ufs” (“u” = micro)
command.To read the built-in help:$ ufs --helpList the files on the device:$ ufs lsYou can also specify a delimiter to separte file names displayed on the output (default is whitespace ‘ ‘):# use ';' as a delimiter
$ ufs ls ';'Delete a file on the device:$ ufs rm foo.txtCopy a file onto the device:$ ufs put path/to/local.txtGet a file from the device:$ ufs get remote.txtTheputandgetcommands optionally take a further argument to specify
the name of the target file:$ ufs put /path/to/local.txt remote.txt
$ ufs get remote.txt local.txtDevelopmentThe source code is hosted in GitHub. Please feel free to fork the repository.
Assuming you have Git installed you can download the code from the canonical
repository with the following command:$ git clone https://github.com/ntoll/microfs.gitEnsure you have the correct dependencies for development installed by creating
a virtualenv and running:$ pip install -r requirements.txtTo locally install your development version of the module into a virtualenv,
run the following command:$ python setup.py developThere is a Makefile that helps with most of the common workflows associated
with development. Typing “make” on its own will list the options thus:$make

There is no default Makefile target right now. Try:

make clean - reset the project and remove auto-generated assets.
make pyflakes - run the PyFlakes code checker.
make pep8 - run the PEP8 style checker.
make test - run the test suite.
make coverage - view a report on test coverage.
make check - run all the checkers and tests.
make package - create a deployable package for the project.
make publish - publish the project to PyPI.
make docs - run sphinx to create project documentation.Release History1.4.5Updated version of PySerial used by the script.Non-zero exit codes when things go wrong.Execute as__main__.Black formatting updates.Thanks to @carlosperate for these updates.1.4.4New feature. Thanks to @makinteract, it is possible to add an optional
delimeter for thelscommand. Please see PR #28 for more details.1.4.3Bug fix. See commentary in issue #22. Thanks again to alexandros769.1.4.2Update getting of data from micro:bit device to deal with control characters
found within the file on the device. Thanks to Damien George for the fix and
to GitHub user alexandros769 for reporting it.1.4.1Clamp PySerial version to use with microfs to a version known to work.1.4.0Updated and changed thegetfunctionality to work on a wider range of
supported boards. Many thanks to Carlos Pereira Atencio for putting in the
effort to make this happen.1.3.1Fix bug in version parsing that was mangling themachineattribute.1.3.0Added a new function (not available via the command line) to get the version
of MicroPython on the device.API CHANGEThe find_microbit function now returns a tuple with position 0
as the port and position 1 as the serial number of the connected device.1.2.3Extensive debugging and a fix by Carlos Pereira Atencio to ensure that serial
connections are opened, closed and made ready for microfs related commands in
a robust manner.1.2.2The get and put commands optionally take a further argument to specify the
name of the target file.1.2.1Made implicit string concatenation explicit.1.2.0API CHANGEthe serial object passed into command functions is optional.API CHANGEcall signature changes on command functions.1.1.2Allow external modules to use built-in device detection and connection.1.1.1Unlink command logic from device detection and serial connection.1.1.0Fix broken ‘put’ and ‘get’ commands to work with arbitrary file sizes.Fix error when working with binary data.Update execute function to work with lists of multiple commands.Minor refactor to extract raw mode related code.Updated tests to keep coverage at 100% on both Python 2 and Python 3.1.0.2Remove spare print call.1.0.1Fix broken setup.1.0.0Full implementation of all the expected features.100% test coverage.Comprehensive documentation.0.0.1Initial release. Basic functionality.