A module and utility to work with the simple filesystem on the BBC micro:bit
Project description
MicroFS
A simple command line tool and module for interacting with the limited file system provided by MicroPython on the BBC micro:bit.
Installation
To 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 microfs
Usage
There 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 Code
In your Python script import the required functions like this:
from microfs import ls, rm, put, get, get_serial
Read the API documentation below to learn how each of the functions works.
Command Line
From the command line (but not the Python shell) use the “ufs” (“u” = micro) command.
To read the built-in help:
$ ufs --help
List the files on the device:
$ ufs ls
Delete a file on the device:
$ ufs rm foo.txt
Copy a file onto the device:
$ ufs put path/to/local.txt
Get a file from the device:
$ ufs get remote.txt
The put and get commands 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.txt
Development
The 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.git
Ensure you have the correct dependencies for development installed by creating a virtualenv and running:
$ pip install -r requirements.txt
To locally install your development version of the module into a virtualenv, run the following command:
$ python setup.py develop
There 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 History
1.2.3
Extensive 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.2
The get and put commands optionally take a further argument to specify the name of the target file.
1.2.1
Made implicit string concatenation explicit.
1.2.0
API CHANGE the serial object passed into command functions is optional.
API CHANGE call signature changes on command functions.
1.1.2
Allow external modules to use built-in device detection and connection.
1.1.1
Unlink command logic from device detection and serial connection.
1.1.0
Fix 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.2
Remove spare print call.
1.0.1
Fix broken setup.
1.0.0
Full implementation of all the expected features.
100% test coverage.
Comprehensive documentation.
0.0.1
Initial release. Basic functionality.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
File details
Details for the file microfs-1.2.4.tar.gz
.
File metadata
- Download URL: microfs-1.2.4.tar.gz
- Upload date:
- Size: 7.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 930d9b9ef62b24e95ada8948843ecdf2e8f89f1a920e2368c539277643216fca |
|
MD5 | cf81b05c61178e2df26b657ef8a82ccb |
|
BLAKE2b-256 | 294940c981932b73276a58c9075d6cd734f4439f42ce799130ff3fadef4c1497 |