A python wrapper for littlefs
Project description
littlefs-python provides a thin wrapper around littlefs, a filesystem targeted for small embedded systems. The wrapper provides a pythonic interface to the filesystem and allows the creation, inspection and modification of the filesystem or individual files. Even if this package uses Cython, the goal is not to provide a high performance implementation. Cython was chosen as an easy method is offered to generate the binding and the littlefs library in one step.
Quick Examples
Let’s create a image ready to transfer to a flash memory using the pythonic interface:
from littlefs import LittleFS
# Initialize the File System according to your specifications
fs = LittleFS(block_size=512, block_count=256)
# Open a file and write some content
with fs.open('first-file.txt', 'w') as fh:
fh.write(b'Some text to begin with\n')
# Dump the filesystem content to a file
with open('FlashMemory.bin', 'wb') as fh:
fh.write(fs.context.buffer)
The same can be done by using the more verbose C-Style API, which closely resembels the steps which must be performed in C:
from littlefs import lfs
cfg = lfs.LFSConfig(block_size=512, block_count=256)
fs = lfs.LFSFilesystem()
# Format and mount the filesystem
lfs.format(fs, cfg)
lfs.mount(fs, cfg)
# Open a file and write some content
fh = lfs.file_open(fs, 'first-file.txt', 'w') as fh:
lfs.file_write(fs, fh, b'Some text to begin with\n')
lfs.file_close(fs, fh)
# Dump the filesystem content to a file
with open('FlashMemory.bin', 'wb') as fh:
fh.write(cfg.user_context.buffer)
Installation
This is as simple as it can be:
pip install littlefs-python
At the moment wheels (which require no build) are provided for the following platforms, on other platforms the source package is provided:
Linux: Python 3.5, 3.6, 3.7 & 3.8 / 32- & 64-bit
Windows: Python 3.5, 3.6 & 3.7 / 32- & 64-bit
Development Setup
Start by checking out the source repository of littlefs-python:
git clone https://github.com/jrast/littlefs-python.git
The source code for littlefs is included as a submodule which must be checked out after the clone:
cd <littlefs-python> git submodule update --init
this ensures that the correct version of littlefs is cloned into the littlefs folder. As a next step install the dependencies and install the package:
pip install -r requirements.txt pip install -e .
Development Hints
Test should be run before commiting: pytest test
Mypy is used for typechecking. Run it also on the tests to catch more issues: mypy src test test/lfs
Mypy stubs can be generated with stubgen src. This will create a out direcotry containing the generated stub files.
Creating a new release
Make sure the master branch is in the state you want it.
Create a tag with the new version number
Wait until all builds are completed. A new release should be created automatically on github.
Build the source distribution with python setup.py sdist
Download all assets (using ci/download_release_files.py)
Upload to pypi using twine: twine upload dist/*
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
Built Distributions
Hashes for littlefs_python-0.2.0-cp38-cp38-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6abce15e7bc2b15531f556f681954499f1de630aa8c9714efd9d07c7f2bb27af |
|
MD5 | 65613fdd0849e2a7dde7d8b3f249fb9d |
|
BLAKE2b-256 | 64837e7d5eea9457df1fd1d9b41bfc7e346b6fc82333ea1957ed3826d319c824 |
Hashes for littlefs_python-0.2.0-cp38-cp38-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 14f0957d8912bcc10cad12aaec620ccdba87d42023ecf0b9f4ccc60655014a03 |
|
MD5 | ebe75acf586d7b5f5bdbc38eefc620da |
|
BLAKE2b-256 | e8c29ad48c68211845ba5a6b8bb18449c0797b494212780c21c8ead93c30ed2a |
Hashes for littlefs_python-0.2.0-cp38-cp38-manylinux2010_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 173226fe91bce8298c86f761cfc47184ac01baf0d971c0de8c7219792b35d3d9 |
|
MD5 | 1dde853fc47907d8c4fb5293d7242fc2 |
|
BLAKE2b-256 | fb7accbc73d95c3fb34db218ed1d7667368e519e409949f2984c1ba0b7189638 |
Hashes for littlefs_python-0.2.0-cp38-cp38-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9bb289dab9e8cb245015ba8156242b8a2a0261cbb1a91ee16667c36565d7d709 |
|
MD5 | a51a981380fd5abee15c3dffd5f7f1f2 |
|
BLAKE2b-256 | 73e79e4cc2e65a3f7c4b83544e227f12cc66e5274b49f81dbc73577b0d410669 |
Hashes for littlefs_python-0.2.0-cp38-cp38-manylinux1_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0f693945ac662618bb1d105dfffd3a1cb4c7c7ee0cb8224ed6b23330aa16b116 |
|
MD5 | 38eeb3fbb39e45d3fdd20a2ca05b9795 |
|
BLAKE2b-256 | 06f39af316a47e85d012792407bf53642a0c8ef0787ac29b246cb240106d45b0 |
Hashes for littlefs_python-0.2.0-cp37-cp37m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b10e10f4436b5829f61ecf4ad27247c4ee7abdf8e95a1998f54a2a64ea4d6716 |
|
MD5 | 38b17b7afb34d9d6199a73dcd41bea58 |
|
BLAKE2b-256 | 06b9f76aa87b99bd312a5e8d542e87455c49aef17a1423bfaa17db865495f212 |
Hashes for littlefs_python-0.2.0-cp37-cp37m-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8a48d739df1cfaac819c3137db0cd428b660f27b93fd3710a3e36cc9455183fa |
|
MD5 | e44659413f2374583d7550117ddf16ab |
|
BLAKE2b-256 | 92034ee23791f356662a18fb86b0b77578cf6382a8ded94a8a944f1958168c81 |
Hashes for littlefs_python-0.2.0-cp37-cp37m-manylinux2010_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f6533551aa4cdf29228f08caadb2af73148d6650535df076f381a83018c952a4 |
|
MD5 | 9419a35da48f98d136a78fc52ca97e3c |
|
BLAKE2b-256 | 11a16fed78c1266a705364dadb003a04940ab6161bbaa8126a5be0734f7e20cc |
Hashes for littlefs_python-0.2.0-cp37-cp37m-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 142c436ce8f48760558b839e5b06dae1ca7b403449dafab2b561f346deb3c104 |
|
MD5 | 46cecfda4cb05694be40382780592fca |
|
BLAKE2b-256 | ccbb1a4404ada048ac64d9ddc39fb0d31cc7bbae8391443fcd0415a857c6457d |
Hashes for littlefs_python-0.2.0-cp37-cp37m-manylinux1_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | cc916124fbc3143231c7252339db54e4b24dd9b601c02a12e758f1d52fb6bc13 |
|
MD5 | 180b3bd5c86cca365d75480442754c68 |
|
BLAKE2b-256 | dc33e962a98aa2036342c97450e1449e16738df77d420442d55b10130463d1df |
Hashes for littlefs_python-0.2.0-cp36-cp36m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 584368bdb229b405bedb47feffefb6b3d85c3c007319036752b97538fe52aa09 |
|
MD5 | 2d7867dfb781800fac56bcf9279a2aa3 |
|
BLAKE2b-256 | 23b9b1f6b595a1fb5c061c59d192bbe5c06f3c0162b6d12c7950547c86c94420 |
Hashes for littlefs_python-0.2.0-cp36-cp36m-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 72b66eeca622f14f11c2e6617117388aa0d498da1d910452e19f07cc5bba99ab |
|
MD5 | ede094db2af9559598ad5047bf389639 |
|
BLAKE2b-256 | 0c95eb8de51e828e4994e37bc97ac7e80f3f2c1523a71602ebf33e6f4fe7d37a |
Hashes for littlefs_python-0.2.0-cp36-cp36m-manylinux2010_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8bcef9692aa563e8aa189f0511297ea5b54916b103e2438b1c79acd698a16874 |
|
MD5 | c8ac7c7ba67c02988872570932ad8e35 |
|
BLAKE2b-256 | 70d19ae64147673095a2b3894672d25a02ced124ecd7972b4961d9985bebf37f |
Hashes for littlefs_python-0.2.0-cp36-cp36m-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2352c89432944dee9191c57eaaa4742f4e267a968355444fe35c8ddc7e035b0b |
|
MD5 | ae9af7b4f544b0f87bdc7e2ca21b0cc0 |
|
BLAKE2b-256 | 87185b4954145c03b51f83510a2e1d4d97fb1566ef5c8d09364b2d83bf893f51 |
Hashes for littlefs_python-0.2.0-cp36-cp36m-manylinux1_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a4d5a55f17a09b4c38743809632c1391df49acda65ec7f995160e2e4c0119017 |
|
MD5 | 6244356ac44ad5febd076f15302d5b64 |
|
BLAKE2b-256 | 61d2c40589ec9a954888ae2c5aee55ac0c983cb3b809393d5c9e93eb1c1fe1ab |
Hashes for littlefs_python-0.2.0-cp35-cp35m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d815c0bc7cd49dd0eda09c1ec511b26b6671711279557ea833739482e9856bfb |
|
MD5 | 5599d60f50545dbb1847c470329b2143 |
|
BLAKE2b-256 | cd8f5a65cefff22ce6fdabe23b14670bc8bce5548c6e0dadfd50bf428a2f748c |
Hashes for littlefs_python-0.2.0-cp35-cp35m-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 37b1521e58418b395c2a494123ede47081474d6b07cfebb23276da904feb142d |
|
MD5 | 14a26481f6ed5b826f366c1108dd6f5f |
|
BLAKE2b-256 | aef1ed64cf179d6f98973cccd1570c71a05fda2b33cbba3fae9c19c7c705799a |
Hashes for littlefs_python-0.2.0-cp35-cp35m-manylinux2010_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b67f49f67e826cc52c93880efc9ab11889cc538005fe7e676e16072a74b3eef8 |
|
MD5 | d4de0321afd6857b182c9b5d4c4ef9f4 |
|
BLAKE2b-256 | 8461d17760f335d2651b264e51e6400ea0a8c93b00857566e56c9089b81fc290 |
Hashes for littlefs_python-0.2.0-cp35-cp35m-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 97bca4187245d5ec0986be11d14004d2a5793324646e6662231a9035c277b643 |
|
MD5 | fecc753d54d0642b21c916e690c5a617 |
|
BLAKE2b-256 | 1a06b259167b650b23c67e86f9099ec67670dc1828d55bdbebdea2d4583759b0 |
Hashes for littlefs_python-0.2.0-cp35-cp35m-manylinux1_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a5febe61b03b726ec8392fc49014521b89460c4aa8bf2a42c456fe68333f50bf |
|
MD5 | 4931813d90ac99a172d4fddbf2a2bea6 |
|
BLAKE2b-256 | ab21729813a5d04b1e423bec609213a933a5d9f0ebe3a605c64cf3e8f6caf1eb |