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.2-cp38-cp38-manylinux2010_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 01f372809144f3f64584307757fd0b1899cd7c88a3df815001ec77bf4e1c64b4 |
|
MD5 | f7847f04914401feab9d5674f20aacb8 |
|
BLAKE2b-256 | 8eb572c2957907d67917e9a91fa6f06b02fc0c1449567082a661e21eaa80457d |
Hashes for littlefs_python-0.1.2-cp38-cp38-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 08bd7d1cf42208e5a2cdf4246eb9a687d409975ad5856663589e6be03aad4d46 |
|
MD5 | 86e06ddf47313875094a8b58b9062c5a |
|
BLAKE2b-256 | b76cb9a93c9b659e6e592377f810e3a095873324f7baa118d6053f5e815c47a7 |
Hashes for littlefs_python-0.1.2-cp37-cp37m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6b41c3734d233385bfc55dffc4f0bc6fcfd155278ba45f61177bf1c0d84dee67 |
|
MD5 | f75abedb9f57c0c6743bdbdad71354e7 |
|
BLAKE2b-256 | 80a64e6dd812130adedffa8004b5a8d4c128479f5717d5b66b01acdaf8507acd |
Hashes for littlefs_python-0.1.2-cp37-cp37m-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 329dd98b51870d99cb474bf5f10b6edc77adda0c7cdc293bda2af37304031799 |
|
MD5 | a47d317aa8f433f3a619cd1465c4cc35 |
|
BLAKE2b-256 | cf82c7263c87417380b6dad652c0e49484affcbff7f435a0716e65ac126c9af2 |
Hashes for littlefs_python-0.1.2-cp37-cp37m-manylinux2010_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7e0c12f6678dd9938cecf0c11dc2b11cb95af64d4a8aa81756cc74d84dfe9b86 |
|
MD5 | e17cfd395e76974985b08ba0c95b6c44 |
|
BLAKE2b-256 | f7274b29ea0f9a966b6960cb077abadce86d251c828c3b4e55bd960296cc62c0 |
Hashes for littlefs_python-0.1.2-cp37-cp37m-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6cef18c800593fe62918d549d63a77c1a13ed6d024e601e5a33d8bec303e5519 |
|
MD5 | 78f36446a762df73e2e21ff8f6c0e764 |
|
BLAKE2b-256 | 1414d01152071b760cde3b679a2d5aaf0411627db06946a887241315217afa73 |
Hashes for littlefs_python-0.1.2-cp37-cp37m-manylinux1_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | beae0508a6f2628501aff97379cc026e3a357be3d52f693dbccd48866a30eae9 |
|
MD5 | b596e01d5fcb15fc0a50f39f011c76b5 |
|
BLAKE2b-256 | 84aed5eead7a66d23470d43e20b609f990226d815051ad88c7c9a1cfaf97b8e3 |
Hashes for littlefs_python-0.1.2-cp36-cp36m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 655746bb8edc6bd23ce7da011a6a7a14bb679390697ab7a08c1d4d69a8278511 |
|
MD5 | 3f6ea81aee137a96c64afdb1983d5a98 |
|
BLAKE2b-256 | d049d387e247f7d718bb996fcc4a3560a5c0f65119acb94b54ffdae4ac8887fe |
Hashes for littlefs_python-0.1.2-cp36-cp36m-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8bd61991412fa4c145b126d9a373f8a704f97e47af68451baa1ca211f48dba53 |
|
MD5 | f75c6fe2e44ae78def209ec17270a5f1 |
|
BLAKE2b-256 | f025968bdc492c0e54fdd22762c2642c84d9363b51339869058f9cb018ff8749 |
Hashes for littlefs_python-0.1.2-cp36-cp36m-manylinux2010_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4f1a8b54f5a19d47f897b835c5f0c4c77b1cd623080704076ff9b1a827daadf7 |
|
MD5 | a68f8a3f52b2ef44a6c5c6a5077acae4 |
|
BLAKE2b-256 | 8ef9bda685bd7e038d653285f36eb42830b78c7a7275adc21d843ceedf3df113 |
Hashes for littlefs_python-0.1.2-cp36-cp36m-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d1aca9b8baa55008cc480bca197bf12aed6929368baa8eccd0c7a790e306480d |
|
MD5 | 7034dd3f5a625f246a59d16a2dd1c8ac |
|
BLAKE2b-256 | b1f1a7ca3d58616b1d91b9c3b58e888d7c9852c0233baa047049a6c1933acaac |
Hashes for littlefs_python-0.1.2-cp36-cp36m-manylinux1_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | dc7c674f541d8cfe84bf2710307904a7b315e41795903e9db0c408fee53908aa |
|
MD5 | 978930fcb3483e5750f27f5e64893a15 |
|
BLAKE2b-256 | 67583a3c585b79eee5b44101e6209aef73f176dc607d82bbabb8e16104b2cd2d |
Hashes for littlefs_python-0.1.2-cp35-cp35m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | fe5098c46da20c62b52dcd8853c2c75de20484b53eda01953aa76cfe1acbc826 |
|
MD5 | c8da948f2f4a4cc6d1bcfc0e0376dc0f |
|
BLAKE2b-256 | 013ef37f05a392c358b4388f6a1be2255ab0bd99bcf453a2c454337cccddfbe3 |
Hashes for littlefs_python-0.1.2-cp35-cp35m-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 092e3faa81e636dd8615f78f598b41bb6ae7247d7058419bc2ec629d18498a07 |
|
MD5 | ef127fc99593d3675c8a1433c65e50d4 |
|
BLAKE2b-256 | 08884e800c356815f942106672091b2dce90bc74f87a0f8b9a3b03858fb37f24 |
Hashes for littlefs_python-0.1.2-cp35-cp35m-manylinux2010_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ef196de6e757db98c988b070dbdf846adf22b0a498d06eae9b3bb16f6c493f67 |
|
MD5 | 7ff6d65b0798c28923fa0ac31e8c26e0 |
|
BLAKE2b-256 | 89367b4817e100595c297b1ac91f0102a3976a6b1b05130d8a39749dc079c2cd |
Hashes for littlefs_python-0.1.2-cp35-cp35m-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6de6107325346e0819be708e8703ce33f819805d0c43a930de4cb06de956243d |
|
MD5 | afd750df29dc101069b8f717f9b593bb |
|
BLAKE2b-256 | 5523daeb1858c5fb1c2d10530decb0aa8e6efffd4cce7fb6f9a9d8a273d5304b |
Hashes for littlefs_python-0.1.2-cp35-cp35m-manylinux1_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ac3436e0f0be138098228202e9c5eb8276ac394042258ed6b31f0e88b70c6485 |
|
MD5 | be0482b652da21e717b35ffb2149a9b0 |
|
BLAKE2b-256 | 9a024641e1058b617ee73f556370ba48b54a39c2b9ad7dadf2a24aa3980568ee |