littlefs-python 0.13.0__cp313-cp313-win_amd64.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- littlefs/__init__.py +494 -0
- littlefs/__main__.py +312 -0
- littlefs/context.py +171 -0
- littlefs/errors.py +37 -0
- littlefs/lfs.cp313-win_amd64.pyd +0 -0
- littlefs/lfs.pyi +114 -0
- littlefs/py.typed +0 -0
- littlefs_python-0.13.0.dist-info/LICENSE +29 -0
- littlefs_python-0.13.0.dist-info/METADATA +215 -0
- littlefs_python-0.13.0.dist-info/RECORD +13 -0
- littlefs_python-0.13.0.dist-info/WHEEL +5 -0
- littlefs_python-0.13.0.dist-info/entry_points.txt +2 -0
- littlefs_python-0.13.0.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,215 @@
|
|
|
1
|
+
Metadata-Version: 2.1
|
|
2
|
+
Name: littlefs-python
|
|
3
|
+
Version: 0.13.0
|
|
4
|
+
Summary: A python wrapper for littlefs
|
|
5
|
+
Home-page: https://github.com/jrast/littlefs-python
|
|
6
|
+
Author: Jürg Rast
|
|
7
|
+
Author-email: juergr@gmail.com
|
|
8
|
+
Classifier: Development Status :: 3 - Alpha
|
|
9
|
+
Classifier: Intended Audience :: Developers
|
|
10
|
+
Classifier: Programming Language :: Python :: 3
|
|
11
|
+
Classifier: Programming Language :: Python :: 3.7
|
|
12
|
+
Classifier: Programming Language :: Python :: 3.8
|
|
13
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
17
|
+
Classifier: Topic :: Scientific/Engineering
|
|
18
|
+
Classifier: Topic :: Software Development :: Embedded Systems
|
|
19
|
+
Classifier: Topic :: Software Development :: Libraries
|
|
20
|
+
Classifier: Topic :: System :: Filesystems
|
|
21
|
+
Description-Content-Type: text/x-rst
|
|
22
|
+
License-File: LICENSE
|
|
23
|
+
Requires-Dist: importlib-metadata>=4.4; python_version < "3.10"
|
|
24
|
+
|
|
25
|
+
===================
|
|
26
|
+
littlefs for Python
|
|
27
|
+
===================
|
|
28
|
+
|
|
29
|
+
.. image:: https://readthedocs.org/projects/littlefs-python/badge/?version=latest
|
|
30
|
+
:target: https://littlefs-python.readthedocs.io/en/latest/?badge=latest
|
|
31
|
+
:alt: Documentation Status
|
|
32
|
+
|
|
33
|
+
.. image:: https://badge.fury.io/py/littlefs-python.svg
|
|
34
|
+
:target: https://badge.fury.io/py/littlefs-python
|
|
35
|
+
|
|
36
|
+
littlefs-python provides a thin wrapper around littlefs_, a filesystem targeted for
|
|
37
|
+
small embedded systems.
|
|
38
|
+
The wrapper provides a pythonic interface to the filesystem and allows the creation,
|
|
39
|
+
inspection and modification of the filesystem or individual files.
|
|
40
|
+
Even if this package uses Cython_, the goal is not to provide a high performance
|
|
41
|
+
implementation. Cython was chosen as an easy method is offered to generate the binding
|
|
42
|
+
and the littlefs library in one step.
|
|
43
|
+
|
|
44
|
+
Quick Examples
|
|
45
|
+
==============
|
|
46
|
+
Let's create a image ready to transfer to a flash memory using the pythonic interface:
|
|
47
|
+
|
|
48
|
+
.. code:: python
|
|
49
|
+
|
|
50
|
+
from littlefs import LittleFS
|
|
51
|
+
|
|
52
|
+
# Initialize the File System according to your specifications
|
|
53
|
+
fs = LittleFS(block_size=512, block_count=256)
|
|
54
|
+
|
|
55
|
+
# Open a file and write some content
|
|
56
|
+
with fs.open('first-file.txt', 'w') as fh:
|
|
57
|
+
fh.write('Some text to begin with\n')
|
|
58
|
+
|
|
59
|
+
# Dump the filesystem content to a file
|
|
60
|
+
with open('FlashMemory.bin', 'wb') as fh:
|
|
61
|
+
fh.write(fs.context.buffer)
|
|
62
|
+
|
|
63
|
+
The same can be done by using the more verbose C-Style API, which closely resembles the
|
|
64
|
+
steps which must be performed in C:
|
|
65
|
+
|
|
66
|
+
.. code:: python
|
|
67
|
+
|
|
68
|
+
from littlefs import lfs
|
|
69
|
+
|
|
70
|
+
cfg = lfs.LFSConfig(block_size=512, block_count=256)
|
|
71
|
+
fs = lfs.LFSFilesystem()
|
|
72
|
+
|
|
73
|
+
# Format and mount the filesystem
|
|
74
|
+
lfs.format(fs, cfg)
|
|
75
|
+
lfs.mount(fs, cfg)
|
|
76
|
+
|
|
77
|
+
# Open a file and write some content
|
|
78
|
+
fh = lfs.file_open(fs, 'first-file.txt', 'w')
|
|
79
|
+
lfs.file_write(fs, fh, b'Some text to begin with\n')
|
|
80
|
+
lfs.file_close(fs, fh)
|
|
81
|
+
|
|
82
|
+
# Dump the filesystem content to a file
|
|
83
|
+
with open('FlashMemory.bin', 'wb') as fh:
|
|
84
|
+
fh.write(cfg.user_context.buffer)
|
|
85
|
+
|
|
86
|
+
|
|
87
|
+
Installation
|
|
88
|
+
============
|
|
89
|
+
|
|
90
|
+
As littlefs_ is bundled with the package you will need to install the correct version of
|
|
91
|
+
this package in successfully read or create images for your embedded system. If you start
|
|
92
|
+
from scratch the latest version is recommended.
|
|
93
|
+
|
|
94
|
+
.. csv-table::
|
|
95
|
+
:header: "LittleFS Version", "Package Version", "LittleFS File System Version"
|
|
96
|
+
|
|
97
|
+
2.10.0, v0.13.X, 2.0 / 2.1 [#f1]_
|
|
98
|
+
2.9.0, v0.12.X v0.11.X, 2.0 / 2.1 [#f1]_
|
|
99
|
+
2.9.0, v0.10.X, 2.0 / 2.1 [#f1]_
|
|
100
|
+
2.8.0, 0.8.X-0.9.X, 2.0 / 2.1 [#f1]_
|
|
101
|
+
2.7.0, 0.7.X, 2.0 / 2.1 [#f1]_
|
|
102
|
+
2.7.0, 0.6.X, 2.0 / 2.1 [#f1]_
|
|
103
|
+
2.6.1, 0.5.0, 2.1
|
|
104
|
+
2.2.1, 0.4.0, 2.0
|
|
105
|
+
2.2.1, 0.3.0, 2.0
|
|
106
|
+
|
|
107
|
+
.. [#f1] See ``test/test_multiversion.py`` for examples.
|
|
108
|
+
|
|
109
|
+
|
|
110
|
+
This is as simple as it can be::
|
|
111
|
+
|
|
112
|
+
pip install littlefs-python
|
|
113
|
+
|
|
114
|
+
At the moment wheels (which require no build) are provided for the following platforms,
|
|
115
|
+
on other platforms the source package is used and a compiler is required:
|
|
116
|
+
|
|
117
|
+
+ Linux: Python 3.7 - 3.13 / x86_64, arm64
|
|
118
|
+
+ MacOS: Python 3.7 - 3.13 / x86_64, arm64
|
|
119
|
+
+ Windows: Python 3.7 - 3.13 / 32- & 64-bit
|
|
120
|
+
|
|
121
|
+
CLI
|
|
122
|
+
===
|
|
123
|
+
littlefs-python comes bundled with a command-line tool, ``littlefs-python``, that can be used to create and extract littlefs binary images.
|
|
124
|
+
|
|
125
|
+
.. code:: console
|
|
126
|
+
|
|
127
|
+
$ littlefs-python --help
|
|
128
|
+
usage: littlefs-python [-h] [--version] {create,extract,list} ...
|
|
129
|
+
|
|
130
|
+
Create, extract and inspect LittleFS filesystem images. Use one of the
|
|
131
|
+
commands listed below, the '-h' / '--help' option can be used on each command
|
|
132
|
+
to learn more about the usage.
|
|
133
|
+
|
|
134
|
+
optional arguments:
|
|
135
|
+
-h, --help show this help message and exit
|
|
136
|
+
--version show program's version number and exit
|
|
137
|
+
|
|
138
|
+
Available Commands:
|
|
139
|
+
{create,extract,list}
|
|
140
|
+
create Create LittleFS image from file/directory contents.
|
|
141
|
+
extract Extract LittleFS image contents to a directory.
|
|
142
|
+
list List LittleFS image contents.
|
|
143
|
+
|
|
144
|
+
To create a littlefs binary image:
|
|
145
|
+
|
|
146
|
+
.. code:: console
|
|
147
|
+
|
|
148
|
+
# Creates a 1-megabyte "lfs.bin" containing README.rst
|
|
149
|
+
$ littlefs-python create README.rst lfs.bin --fs-size=1mb --block-size=4096
|
|
150
|
+
|
|
151
|
+
# Creates a 1-megabyte "lfs.bin" containing the contents of the examples/ folder
|
|
152
|
+
$ littlefs-python create examples lfs.bin --fs-size=1mb --block-size=4096
|
|
153
|
+
|
|
154
|
+
To extract the contents of a littlefs binary image:
|
|
155
|
+
|
|
156
|
+
.. code:: console
|
|
157
|
+
|
|
158
|
+
$ littlefs-python extract lfs.bin output/ --block-size=4096
|
|
159
|
+
|
|
160
|
+
Development Setup
|
|
161
|
+
=================
|
|
162
|
+
|
|
163
|
+
Start by checking out the source repository of littlefs-python::
|
|
164
|
+
|
|
165
|
+
git clone https://github.com/jrast/littlefs-python.git
|
|
166
|
+
|
|
167
|
+
The source code for littlefs is included as a submodule which must be
|
|
168
|
+
checked out after the clone::
|
|
169
|
+
|
|
170
|
+
cd <littlefs-python>
|
|
171
|
+
git submodule update --init
|
|
172
|
+
|
|
173
|
+
this ensures that the correct version of littlefs_ is cloned into
|
|
174
|
+
the littlefs folder. As a next step install the dependencies and install
|
|
175
|
+
the package::
|
|
176
|
+
|
|
177
|
+
pip install -r requirements.txt
|
|
178
|
+
pip install -e .
|
|
179
|
+
|
|
180
|
+
It's highly recommended to install the package in a virtual environment!
|
|
181
|
+
|
|
182
|
+
Development Hints
|
|
183
|
+
-----------------
|
|
184
|
+
|
|
185
|
+
- Test should be run before committing: ``pytest test``
|
|
186
|
+
- Mypy is used for typechecking. Run it also on the tests to catch more issues:
|
|
187
|
+
``mypy src test test/lfs``
|
|
188
|
+
- Mypy stubs can be generated with ``stubgen src``. This will create a ``out`` directory
|
|
189
|
+
containing the generated stub files.
|
|
190
|
+
|
|
191
|
+
|
|
192
|
+
Creating a new release
|
|
193
|
+
======================
|
|
194
|
+
|
|
195
|
+
NEW (with github deploy action):
|
|
196
|
+
|
|
197
|
+
- Make sure the master branch is in the state you want it.
|
|
198
|
+
- Create a new tag with the correct version number and push the tag to github
|
|
199
|
+
- Start the "Build and Deploy Package" workflow for the created tag on github
|
|
200
|
+
|
|
201
|
+
|
|
202
|
+
OUTDATED (without github deploy action):
|
|
203
|
+
|
|
204
|
+
- Make sure the master branch is in the state you want it.
|
|
205
|
+
- Create a tag with the new version number
|
|
206
|
+
- Wait until all builds are completed. A new release should be created
|
|
207
|
+
automatically on github.
|
|
208
|
+
- Build the source distribution with ``python setup.py sdist``.
|
|
209
|
+
- Download all assets (using ``ci/download_release_files.py``).
|
|
210
|
+
- Upload to pypi using twine: ``twine upload dist/*``.
|
|
211
|
+
|
|
212
|
+
|
|
213
|
+
|
|
214
|
+
.. _littlefs: https://github.com/littlefs-project/littlefs
|
|
215
|
+
.. _Cython: http://docs.cython.org/en/latest/index.html
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
littlefs/__init__.py,sha256=dSyBYZhamanMaPw5tU0ZRUAIHoupqZO8K8jkda5HlaU,15641
|
|
2
|
+
littlefs/__main__.py,sha256=sXHy6Vcr8Gr7O7fKhNVNf5kPtABmLJLBUyALydY0Dr8,10308
|
|
3
|
+
littlefs/context.py,sha256=ffuEuYpUKPwphaoKTkNzhIn0TjHhSN2jrl-Xf8an6cA,5546
|
|
4
|
+
littlefs/errors.py,sha256=_DgZnb4j1yd4rooKwrDqaBWGOfnahBnN7I1W9SIOVi0,1307
|
|
5
|
+
littlefs/lfs.cp313-win_amd64.pyd,sha256=REJjeimzD8SosrhdISnX_-9CCHoxvca-o2nMHLl8Lxc,335360
|
|
6
|
+
littlefs/lfs.pyi,sha256=IrhSlr0XK0iP8CddBJAwrmfFP9w9kV2MWXCtHL2Rucg,3732
|
|
7
|
+
littlefs/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
8
|
+
littlefs_python-0.13.0.dist-info/LICENSE,sha256=pXUK4Zs9BSuHBxj-C0KBwPBjufyi-4ZhcCqm--m58tQ,1547
|
|
9
|
+
littlefs_python-0.13.0.dist-info/METADATA,sha256=kH09iP5E3TxOgB4XRrC2Znkto4kWU1kn2C8pDD4f5Hg,7430
|
|
10
|
+
littlefs_python-0.13.0.dist-info/WHEEL,sha256=4-iQBlRoDdX1wfPofc7KLWa5Cys4eZSgXs6GVU8fKlQ,101
|
|
11
|
+
littlefs_python-0.13.0.dist-info/entry_points.txt,sha256=mmVZvtJwx-4y5NGjeCkO2BzL5rDEGr10zEqshIDp2Qw,59
|
|
12
|
+
littlefs_python-0.13.0.dist-info/top_level.txt,sha256=ODpjzoOixM9dzTvlv3Fgd78PG_icni-AmzUB6VfdDwU,9
|
|
13
|
+
littlefs_python-0.13.0.dist-info/RECORD,,
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
littlefs
|