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 .
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.1.3-cp38-cp38-manylinux2010_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a41ff28773d678e659cf715328273c79e927db818398ec8e786d0c92720453cd |
|
MD5 | 2980204589fc3fda5289f6d755d0eb10 |
|
BLAKE2b-256 | a29ea6d26070742ef42f912c5ffa47de4cbeb1807f470774b81225024ffd6e01 |
Hashes for littlefs_python-0.1.3-cp38-cp38-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f5ce412ecabe2d730112d8fedaf45eca2d82e221c182cce1b0dc9d54488054df |
|
MD5 | f8da18425a137aef344482516e473d6e |
|
BLAKE2b-256 | 57e83fcb1300814372bec0590ce5b6ae8fc38feb54bd2a5bad438cfc29edd925 |
Hashes for littlefs_python-0.1.3-cp38-cp38-manylinux1_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e04a5050f87f665bf3bb5079f79a203ca28b9018bb6aaf394c49bb32e7c7db52 |
|
MD5 | cbaf73991a172446da975ac250a4319b |
|
BLAKE2b-256 | 1559cb47811bb054419b8b63818c8de2dc14f231aff94ca648a15a58e109b9f1 |
Hashes for littlefs_python-0.1.3-cp37-cp37m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e8286f5d2baffac616353e8ff330f5ec77f50c2cb305fe7050a6ec08d03acfe2 |
|
MD5 | 22907cebd2c5e9c08a61e6e8f585afa6 |
|
BLAKE2b-256 | 2a19cbd5e6321d3203169747b58f21821ca7485f8d3c33b8816f3f12493ac0df |
Hashes for littlefs_python-0.1.3-cp37-cp37m-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | aa1e8b4a63db1c5aa42da347af7c7d525f9df520b5fd840f31c376be490cd455 |
|
MD5 | 452f45599a718bcf824f8ccd7d99e6cb |
|
BLAKE2b-256 | c2b3b33276a37abbe4c3cd4bbee8113fb0b15b154fb3eee3af7e837702391754 |
Hashes for littlefs_python-0.1.3-cp37-cp37m-manylinux2010_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b15ad42a3785578d2b2e91ccd84e2b3e30a50791fe463937932a82ae242df4fd |
|
MD5 | 349f5ca5c15a3c30aa953dcc1d59caa3 |
|
BLAKE2b-256 | 84376dd2507b8d8d74bd75838193555e2ebc71bb886407488de3892c0fba828c |
Hashes for littlefs_python-0.1.3-cp37-cp37m-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 55fe226b8dc6b3f05e35f18c8ad65db140160a07ea98d5f47af40aff9dce4a5b |
|
MD5 | fd96c7357525fac9f941bf01dbac240a |
|
BLAKE2b-256 | 8e3c27887a57d070865b2d024bf3d876c0c37eb23a006b26ad8c1c611ba18ad5 |
Hashes for littlefs_python-0.1.3-cp37-cp37m-manylinux1_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 954f70a5e388c7efd4fc63928500bf3c43d59da24d9fe56f4d72a95b060ac460 |
|
MD5 | a105f7951bcb13d6257f5d4b91a60504 |
|
BLAKE2b-256 | a7a19606c95dbde8fddb7c1a01cc019aff55a67c3a0ef18e7b1b3cc059986486 |
Hashes for littlefs_python-0.1.3-cp36-cp36m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f3ed5f6b323fecf64b2ab062f5ca774f6bc30235f189ff0ae006ed539a917c07 |
|
MD5 | 6873bb6ff12ca2db461f020c9d2cb1f1 |
|
BLAKE2b-256 | 33080f0409fd80896183c78b7614295d365c840b6cb5a631c0fd97f80971b659 |
Hashes for littlefs_python-0.1.3-cp36-cp36m-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 504cff7b0f327f2ce6588444906c8a6409a7f3168b4a2a091d6448fe7ed5f8e2 |
|
MD5 | 0a41468ea83464caf946bc55ad377955 |
|
BLAKE2b-256 | 74315242c227ad139b70d2a0852e741020e2460411183f1e79697c07169d282c |
Hashes for littlefs_python-0.1.3-cp36-cp36m-manylinux2010_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a76e26c7f331dd24119e114e42b853005c2420e4c62a3e369fdd26ab73823ec6 |
|
MD5 | 88c8ca02c8e6bb293b83bbe5695876ee |
|
BLAKE2b-256 | 4accef30004c4c65741f40ffaf5417feff6b64cf11b0d06631acc9b66abdad73 |
Hashes for littlefs_python-0.1.3-cp36-cp36m-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 57714eb4382986d3d7231b18960d7dbeec7a3525ae30b904cabe467cf3d013a4 |
|
MD5 | a4d1fbf55c4c967e9c7d92802721249d |
|
BLAKE2b-256 | 63dfd60221c506b916ba16f47466ad2fc008f03c60be41f08c7e9e00c501f026 |
Hashes for littlefs_python-0.1.3-cp36-cp36m-manylinux1_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c02fbeab1e1bf90c8347309406de727ce37489863295f4082b727739bab377d9 |
|
MD5 | eaed0239bca42ef8518eb74c9d90ec0a |
|
BLAKE2b-256 | 70022aa8261f7a4db7d5ce154344949501ee1ad673b7aea27598dda476e46f68 |
Hashes for littlefs_python-0.1.3-cp35-cp35m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 89a480eb6df2f74628954131978c53e0a8cf3aa63e0c39f31c2a2ffed218e4cf |
|
MD5 | 6e1d7cb09e40df17f1ff5ea0bfe76946 |
|
BLAKE2b-256 | 1ed50cb3138bcd6520a4fca33969ee50fb1f79612aed2715ff85516b0e7ef9cc |
Hashes for littlefs_python-0.1.3-cp35-cp35m-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | cc001165776f46657a4d22c26a1681f3e85fb80fa334418c4e8de8516bf68615 |
|
MD5 | 9df334e7af7b6f4d4a6006c6d477ce4f |
|
BLAKE2b-256 | 1072ead6796839c9ac03ef780969e6687f6c98ea58a795770fcfedd1bb6e085a |
Hashes for littlefs_python-0.1.3-cp35-cp35m-manylinux2010_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a9598591bb7da6a51ad0dc1b1f558418b7b7cc3f01363aef34b70162c35a98b1 |
|
MD5 | a099d41a3baf0fc9ea74edfd539581c2 |
|
BLAKE2b-256 | 19a157117135313e09e0006ae5d6ed52f29698f3a445bbc3f4058e51ab4ad09a |
Hashes for littlefs_python-0.1.3-cp35-cp35m-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 15262aa4ef386af7264b91d8f03c95abd7d8032d53282fc110eec14a0c979717 |
|
MD5 | 26a50412ccbf9a7808a79b7867b331f4 |
|
BLAKE2b-256 | 10acc934ff5835a5bbec2f7f41d901a304ed0f8c24236991899e873c7203a2d6 |
Hashes for littlefs_python-0.1.3-cp35-cp35m-manylinux1_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 09788f833a69c8af5d757cf46880203497ebb75c2dfc31dcdfa590d6a8a65e7b |
|
MD5 | 0385bc3e8c8e43ca9e955ecdc867f2b3 |
|
BLAKE2b-256 | ea7a4220abdafe6060de891e5d631253bc621fc5219ed73cd9feb124df14200e |