Skip to main content

A module and utility to work with the simple filesystem on the BBC micro:bit

Project description

A community fork of 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 microfs2

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.lib import MicroBitSerial, ls, rm, cp, mv, cat, du, put, get, version

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

To see the version of microfs:

$ ufs --version

To set the device timeout (default is 10 seconds):

$ ufs --timeout 3 command

List the files on the device:

$ ufs ls

You can also specify a delimiter to separate file names displayed on the output (default is whitespace ‘ ‘):

# use ';' as a delimiter
$ ufs ls ';'

Delete a file on the device:

$ ufs rm foo.txt

Copy a file from one location to another on the device:

$ ufs cp foo.txt bar.txt

Move a file from one location to another on the device:

$ ufs mv foo.txt bar.txt

Display the contents of a file on the device:

$ ufs cat foo.txt

Get the size of a file on the device in bytes:

$ ufs du 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

Get version information for MicroPython running on the device:

$ ufs version

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/blackteahamburger/microfs.git

To locally install your development version of the module into a virtualenv, run the following command:

$ pip install -e ".[dev]"

This also ensures that you have the correct dependencies for development.

There is a Makefile that helps with most of the common workflows associated with development.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

microfs2-2.0.3.tar.gz (18.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

microfs2-2.0.3-py3-none-any.whl (12.6 kB view details)

Uploaded Python 3

File details

Details for the file microfs2-2.0.3.tar.gz.

File metadata

  • Download URL: microfs2-2.0.3.tar.gz
  • Upload date:
  • Size: 18.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.5

File hashes

Hashes for microfs2-2.0.3.tar.gz
Algorithm Hash digest
SHA256 a813bbe7c7445f912f8b33a6a022b411cc60b4100667793dd63b36e9b1bcb36d
MD5 7f0b329d496aaf2721e8b498c25a4605
BLAKE2b-256 a7ebe202ef5f0829920f8df7123f29bbec7ef1be9e10a9659e90388fccf0ad6f

See more details on using hashes here.

File details

Details for the file microfs2-2.0.3-py3-none-any.whl.

File metadata

  • Download URL: microfs2-2.0.3-py3-none-any.whl
  • Upload date:
  • Size: 12.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.5

File hashes

Hashes for microfs2-2.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 0077e67162cb6092de4839e2aabfccc048140b7973e9dad7b57189b1c49ae403
MD5 1471628c1b9a96b7a999f1eb3a1abb40
BLAKE2b-256 305991e9e42f6337d3736b899932e5e3e7c88bcaf2213f4565d45ecd47d76e9e

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page