microfs2 2.0.0__tar.gz
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.
- microfs2-2.0.0/AUTHORS +3 -0
- microfs2-2.0.0/CHANGES.rst +153 -0
- microfs2-2.0.0/LICENSE +20 -0
- microfs2-2.0.0/MANIFEST.in +4 -0
- microfs2-2.0.0/PKG-INFO +147 -0
- microfs2-2.0.0/README.rst +114 -0
- microfs2-2.0.0/microfs/__init__.py +6 -0
- microfs2-2.0.0/microfs/__init__.pyi +2 -0
- microfs2-2.0.0/microfs/__main__.py +9 -0
- microfs2-2.0.0/microfs/lib.py +476 -0
- microfs2-2.0.0/microfs/lib.pyi +66 -0
- microfs2-2.0.0/microfs/main.py +252 -0
- microfs2-2.0.0/microfs/main.pyi +17 -0
- microfs2-2.0.0/microfs/py.typed +0 -0
- microfs2-2.0.0/microfs2.egg-info/PKG-INFO +147 -0
- microfs2-2.0.0/microfs2.egg-info/SOURCES.txt +22 -0
- microfs2-2.0.0/microfs2.egg-info/dependency_links.txt +1 -0
- microfs2-2.0.0/microfs2.egg-info/entry_points.txt +2 -0
- microfs2-2.0.0/microfs2.egg-info/requires.txt +8 -0
- microfs2-2.0.0/microfs2.egg-info/top_level.txt +1 -0
- microfs2-2.0.0/pyproject.toml +46 -0
- microfs2-2.0.0/setup.cfg +4 -0
- microfs2-2.0.0/tests/test_lib.py +568 -0
- microfs2-2.0.0/tests/test_main.py +375 -0
microfs2-2.0.0/AUTHORS
ADDED
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
Release History
|
|
2
|
+
===============
|
|
3
|
+
|
|
4
|
+
2.0.0
|
|
5
|
+
-----
|
|
6
|
+
|
|
7
|
+
* When reading a file, byte strings can use single and double quotes.
|
|
8
|
+
* The module is changed to be a package.
|
|
9
|
+
* Support for `--timeout` command line parameter.
|
|
10
|
+
The default value of timeout is adjusted to 10.
|
|
11
|
+
* Support for `--version` flag.
|
|
12
|
+
* Support for `cp`, `mv`, `cat`, `du`, and `version` subcommands.
|
|
13
|
+
* **API CHANGE**: New `MicroBitSerial` class to manage serial connections.
|
|
14
|
+
Related functions have become methods of this class.
|
|
15
|
+
* **API CHANGE**: Functions now accept `MicroBitSerial` instances instead
|
|
16
|
+
of raw `serial.Serial` objects.
|
|
17
|
+
* **API CHANGE**: Functions are not accepting None as a serial argument.
|
|
18
|
+
A `MicroBitSerial` instance must be provided.
|
|
19
|
+
Use `MicroBitSerial.get_serial()` to get a serial connection
|
|
20
|
+
of the detected micro:bit.
|
|
21
|
+
* **API CHANGE**: The order of function arguments has changed.
|
|
22
|
+
* **API CHANGE**: The `find_microbit` function now returns the port
|
|
23
|
+
(previously returned a tuple of (port string, serial number)).
|
|
24
|
+
* **API CHANGE**: Exception handling is now more granular. Introduced
|
|
25
|
+
`MicroBitError`, `MicroBitIOError`, and `MicroBitNotFoundError` for
|
|
26
|
+
micro:bit-specific errors, replacing generic `IOError` usage.
|
|
27
|
+
* **API CHANGE**: The `ls`, `rm`, `put`, and `get` functions now return None
|
|
28
|
+
instead of True.
|
|
29
|
+
* **API CHANGE**: The `put` and `get` functions now use `pathlib.Path` objects
|
|
30
|
+
for local file arguments (`filename` and `target`), instead of plain strings.
|
|
31
|
+
* **API CHANGE**: The `execute` function now returns only the stdout bytes
|
|
32
|
+
(previously returned a tuple of (stdout, stderr)). Errors are now raised as
|
|
33
|
+
exceptions instead of being returned.
|
|
34
|
+
* **API CHANGE**: The `put` and `get` command-line interfaces now require
|
|
35
|
+
`pathlib.Path` objects for file arguments.
|
|
36
|
+
* ... See the file docstring and function docstrings for more details.
|
|
37
|
+
|
|
38
|
+
1.4.5
|
|
39
|
+
-----
|
|
40
|
+
|
|
41
|
+
* Updated version of PySerial used by the script.
|
|
42
|
+
* Non-zero exit codes when things go wrong.
|
|
43
|
+
* Execute as ``__main__``.
|
|
44
|
+
* Black formatting updates.
|
|
45
|
+
* Thanks to @carlosperate for these updates.
|
|
46
|
+
|
|
47
|
+
1.4.4
|
|
48
|
+
-----
|
|
49
|
+
|
|
50
|
+
* New feature. Thanks to @makinteract, it is possible to add an optional
|
|
51
|
+
delimeter for the ``ls`` command. Please see PR #28 for more details.
|
|
52
|
+
|
|
53
|
+
1.4.3
|
|
54
|
+
-----
|
|
55
|
+
|
|
56
|
+
* Bug fix. See commentary in issue #22. Thanks again to alexandros769.
|
|
57
|
+
|
|
58
|
+
1.4.2
|
|
59
|
+
-----
|
|
60
|
+
|
|
61
|
+
* Update getting of data from micro:bit device to deal with control characters
|
|
62
|
+
found within the file on the device. Thanks to Damien George for the fix and
|
|
63
|
+
to GitHub user alexandros769 for reporting it.
|
|
64
|
+
|
|
65
|
+
1.4.1
|
|
66
|
+
-----
|
|
67
|
+
|
|
68
|
+
* Clamp PySerial version to use with microfs to a version known to work.
|
|
69
|
+
|
|
70
|
+
1.4.0
|
|
71
|
+
-----
|
|
72
|
+
|
|
73
|
+
* Updated and changed the ``get`` functionality to work on a wider range of
|
|
74
|
+
supported boards. Many thanks to Carlos Pereira Atencio for putting in the
|
|
75
|
+
effort to make this happen.
|
|
76
|
+
|
|
77
|
+
1.3.1
|
|
78
|
+
-----
|
|
79
|
+
|
|
80
|
+
* Fix bug in version parsing that was mangling the ``machine`` attribute.
|
|
81
|
+
|
|
82
|
+
1.3.0
|
|
83
|
+
-----
|
|
84
|
+
|
|
85
|
+
* Added a new function (not available via the command line) to get the version
|
|
86
|
+
of MicroPython on the device.
|
|
87
|
+
* **API CHANGE** The find_microbit function now returns a tuple with position 0
|
|
88
|
+
as the port and position 1 as the serial number of the connected device.
|
|
89
|
+
|
|
90
|
+
1.2.3
|
|
91
|
+
-----
|
|
92
|
+
|
|
93
|
+
* Extensive debugging and a fix by Carlos Pereira Atencio to ensure that serial
|
|
94
|
+
connections are opened, closed and made ready for microfs related commands in
|
|
95
|
+
a robust manner.
|
|
96
|
+
|
|
97
|
+
1.2.2
|
|
98
|
+
-----
|
|
99
|
+
|
|
100
|
+
* The get and put commands optionally take a further argument to specify the
|
|
101
|
+
name of the target file.
|
|
102
|
+
|
|
103
|
+
1.2.1
|
|
104
|
+
-----
|
|
105
|
+
|
|
106
|
+
* Made implicit string concatenation explicit.
|
|
107
|
+
|
|
108
|
+
1.2.0
|
|
109
|
+
-----
|
|
110
|
+
|
|
111
|
+
* **API CHANGE** the serial object passed into command functions is optional.
|
|
112
|
+
* **API CHANGE** call signature changes on command functions.
|
|
113
|
+
|
|
114
|
+
1.1.2
|
|
115
|
+
-----
|
|
116
|
+
|
|
117
|
+
* Allow external modules to use built-in device detection and connection.
|
|
118
|
+
|
|
119
|
+
1.1.1
|
|
120
|
+
-----
|
|
121
|
+
|
|
122
|
+
* Unlink command logic from device detection and serial connection.
|
|
123
|
+
|
|
124
|
+
1.1.0
|
|
125
|
+
-----
|
|
126
|
+
|
|
127
|
+
* Fix broken 'put' and 'get' commands to work with arbitrary file sizes.
|
|
128
|
+
* Fix error when working with binary data.
|
|
129
|
+
* Update execute function to work with lists of multiple commands.
|
|
130
|
+
* Minor refactor to extract raw mode related code.
|
|
131
|
+
* Updated tests to keep coverage at 100% on both Python 2 and Python 3.
|
|
132
|
+
|
|
133
|
+
1.0.2
|
|
134
|
+
-----
|
|
135
|
+
|
|
136
|
+
* Remove spare print call.
|
|
137
|
+
|
|
138
|
+
1.0.1
|
|
139
|
+
-----
|
|
140
|
+
|
|
141
|
+
* Fix broken setup.
|
|
142
|
+
|
|
143
|
+
1.0.0
|
|
144
|
+
-----
|
|
145
|
+
|
|
146
|
+
* Full implementation of all the expected features.
|
|
147
|
+
* 100% test coverage.
|
|
148
|
+
* Comprehensive documentation.
|
|
149
|
+
|
|
150
|
+
0.0.1
|
|
151
|
+
-----
|
|
152
|
+
|
|
153
|
+
* Initial release. Basic functionality.
|
microfs2-2.0.0/LICENSE
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
Copyright (c) 2025 Blackteahamburger <blackteahamburger@outlook.com>
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2016 Nicholas H.Tollervey
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
|
6
|
+
this software and associated documentation files (the "Software"), to deal in
|
|
7
|
+
the Software without restriction, including without limitation the rights to
|
|
8
|
+
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
|
9
|
+
the Software, and to permit persons to whom the Software is furnished to do so,
|
|
10
|
+
subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
|
17
|
+
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
|
18
|
+
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
|
19
|
+
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
|
20
|
+
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
microfs2-2.0.0/PKG-INFO
ADDED
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: microfs2
|
|
3
|
+
Version: 2.0.0
|
|
4
|
+
Summary: A module and utility to work with the simple filesystem on the BBC micro:bit
|
|
5
|
+
Author: Carlos Pereira Atencio
|
|
6
|
+
Author-email: Blackteahamburger <blackteahamburger@outlook.com>, "Nicholas H.Tollervey" <ntoll@ntoll.org>
|
|
7
|
+
Maintainer-email: Blackteahamburger <blackteahamburger@outlook.com>
|
|
8
|
+
License-Expression: MIT
|
|
9
|
+
Project-URL: Homepage, https://github.com/blackteahamburger/microfs
|
|
10
|
+
Classifier: Development Status :: 5 - Production/Stable
|
|
11
|
+
Classifier: Environment :: Console
|
|
12
|
+
Classifier: Intended Audience :: Developers
|
|
13
|
+
Classifier: Intended Audience :: Education
|
|
14
|
+
Classifier: Operating System :: POSIX
|
|
15
|
+
Classifier: Operating System :: Microsoft :: Windows
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
19
|
+
Classifier: Topic :: Education
|
|
20
|
+
Classifier: Topic :: Software Development :: Embedded Systems
|
|
21
|
+
Requires-Python: >=3.11
|
|
22
|
+
Description-Content-Type: text/x-rst
|
|
23
|
+
License-File: LICENSE
|
|
24
|
+
License-File: AUTHORS
|
|
25
|
+
Requires-Dist: pyserial<4.0,>=3.0.1
|
|
26
|
+
Provides-Extra: dev
|
|
27
|
+
Requires-Dist: pytest>=5; extra == "dev"
|
|
28
|
+
Requires-Dist: pytest-cov; extra == "dev"
|
|
29
|
+
Requires-Dist: coverage; extra == "dev"
|
|
30
|
+
Requires-Dist: sphinx; extra == "dev"
|
|
31
|
+
Requires-Dist: ruff; extra == "dev"
|
|
32
|
+
Dynamic: license-file
|
|
33
|
+
|
|
34
|
+
MicroFS
|
|
35
|
+
=======
|
|
36
|
+
|
|
37
|
+
A community fork of `MicroFS <https://github.com/ntoll/microfs>`_.
|
|
38
|
+
|
|
39
|
+
A simple command line tool and module for interacting with the limited
|
|
40
|
+
file system provided by MicroPython on the BBC micro:bit.
|
|
41
|
+
|
|
42
|
+
Installation
|
|
43
|
+
------------
|
|
44
|
+
|
|
45
|
+
To install simply type::
|
|
46
|
+
|
|
47
|
+
$ pip install microfs2
|
|
48
|
+
|
|
49
|
+
Usage
|
|
50
|
+
-----
|
|
51
|
+
|
|
52
|
+
There are two ways to use microfs - as a module in your Python code or as a
|
|
53
|
+
stand-alone command to use from your shell (``ufs``).
|
|
54
|
+
|
|
55
|
+
In Code
|
|
56
|
+
^^^^^^^
|
|
57
|
+
|
|
58
|
+
In your Python script import the required functions like this::
|
|
59
|
+
|
|
60
|
+
from microfs.lib import MicroBitSerial, ls, rm, cp, mv, cat, du, put, get, version
|
|
61
|
+
|
|
62
|
+
Read the API documentation below to learn how each of the functions works.
|
|
63
|
+
|
|
64
|
+
Command Line
|
|
65
|
+
^^^^^^^^^^^^
|
|
66
|
+
|
|
67
|
+
From the command line (but not the Python shell) use the "ufs" ("u" = micro)
|
|
68
|
+
command.
|
|
69
|
+
|
|
70
|
+
To read the built-in help::
|
|
71
|
+
|
|
72
|
+
$ ufs --help
|
|
73
|
+
|
|
74
|
+
To see the version of microfs::
|
|
75
|
+
|
|
76
|
+
$ ufs --version
|
|
77
|
+
|
|
78
|
+
To set the device timeout (default is 10 seconds)::
|
|
79
|
+
|
|
80
|
+
$ ufs --timeout 3 command
|
|
81
|
+
|
|
82
|
+
List the files on the device::
|
|
83
|
+
|
|
84
|
+
$ ufs ls
|
|
85
|
+
|
|
86
|
+
You can also specify a delimiter to separate file names displayed on the output
|
|
87
|
+
(default is whitespace ' ')::
|
|
88
|
+
|
|
89
|
+
# use ';' as a delimiter
|
|
90
|
+
$ ufs ls ';'
|
|
91
|
+
|
|
92
|
+
Delete a file on the device::
|
|
93
|
+
|
|
94
|
+
$ ufs rm foo.txt
|
|
95
|
+
|
|
96
|
+
Copy a file from one location to another on the device::
|
|
97
|
+
|
|
98
|
+
$ ufs cp foo.txt bar.txt
|
|
99
|
+
|
|
100
|
+
Move a file from one location to another on the device::
|
|
101
|
+
|
|
102
|
+
$ ufs mv foo.txt bar.txt
|
|
103
|
+
|
|
104
|
+
Display the contents of a file on the device::
|
|
105
|
+
|
|
106
|
+
$ ufs cat foo.txt
|
|
107
|
+
|
|
108
|
+
Get the size of a file on the device in bytes::
|
|
109
|
+
|
|
110
|
+
$ ufs du foo.txt
|
|
111
|
+
|
|
112
|
+
Copy a file onto the device::
|
|
113
|
+
|
|
114
|
+
$ ufs put path/to/local.txt
|
|
115
|
+
|
|
116
|
+
Get a file from the device::
|
|
117
|
+
|
|
118
|
+
$ ufs get remote.txt
|
|
119
|
+
|
|
120
|
+
The ``put`` and ``get`` commands optionally take a further argument to specify
|
|
121
|
+
the name of the target file::
|
|
122
|
+
|
|
123
|
+
$ ufs put /path/to/local.txt remote.txt
|
|
124
|
+
$ ufs get remote.txt local.txt
|
|
125
|
+
|
|
126
|
+
Get version information for MicroPython running on the device::
|
|
127
|
+
|
|
128
|
+
$ ufs version
|
|
129
|
+
|
|
130
|
+
Development
|
|
131
|
+
-----------
|
|
132
|
+
|
|
133
|
+
The source code is hosted in GitHub. Please feel free to fork the repository.
|
|
134
|
+
Assuming you have Git installed you can download the code from the canonical
|
|
135
|
+
repository with the following command::
|
|
136
|
+
|
|
137
|
+
$ git clone https://github.com/blackteahamburger/microfs.git
|
|
138
|
+
|
|
139
|
+
To locally install your development version of the module into a virtualenv,
|
|
140
|
+
run the following command::
|
|
141
|
+
|
|
142
|
+
$ pip install -e ".[dev]"
|
|
143
|
+
|
|
144
|
+
This also ensures that you have the correct dependencies for development.
|
|
145
|
+
|
|
146
|
+
There is a Makefile that helps with most of the common workflows associated
|
|
147
|
+
with development.
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
MicroFS
|
|
2
|
+
=======
|
|
3
|
+
|
|
4
|
+
A community fork of `MicroFS <https://github.com/ntoll/microfs>`_.
|
|
5
|
+
|
|
6
|
+
A simple command line tool and module for interacting with the limited
|
|
7
|
+
file system provided by MicroPython on the BBC micro:bit.
|
|
8
|
+
|
|
9
|
+
Installation
|
|
10
|
+
------------
|
|
11
|
+
|
|
12
|
+
To install simply type::
|
|
13
|
+
|
|
14
|
+
$ pip install microfs2
|
|
15
|
+
|
|
16
|
+
Usage
|
|
17
|
+
-----
|
|
18
|
+
|
|
19
|
+
There are two ways to use microfs - as a module in your Python code or as a
|
|
20
|
+
stand-alone command to use from your shell (``ufs``).
|
|
21
|
+
|
|
22
|
+
In Code
|
|
23
|
+
^^^^^^^
|
|
24
|
+
|
|
25
|
+
In your Python script import the required functions like this::
|
|
26
|
+
|
|
27
|
+
from microfs.lib import MicroBitSerial, ls, rm, cp, mv, cat, du, put, get, version
|
|
28
|
+
|
|
29
|
+
Read the API documentation below to learn how each of the functions works.
|
|
30
|
+
|
|
31
|
+
Command Line
|
|
32
|
+
^^^^^^^^^^^^
|
|
33
|
+
|
|
34
|
+
From the command line (but not the Python shell) use the "ufs" ("u" = micro)
|
|
35
|
+
command.
|
|
36
|
+
|
|
37
|
+
To read the built-in help::
|
|
38
|
+
|
|
39
|
+
$ ufs --help
|
|
40
|
+
|
|
41
|
+
To see the version of microfs::
|
|
42
|
+
|
|
43
|
+
$ ufs --version
|
|
44
|
+
|
|
45
|
+
To set the device timeout (default is 10 seconds)::
|
|
46
|
+
|
|
47
|
+
$ ufs --timeout 3 command
|
|
48
|
+
|
|
49
|
+
List the files on the device::
|
|
50
|
+
|
|
51
|
+
$ ufs ls
|
|
52
|
+
|
|
53
|
+
You can also specify a delimiter to separate file names displayed on the output
|
|
54
|
+
(default is whitespace ' ')::
|
|
55
|
+
|
|
56
|
+
# use ';' as a delimiter
|
|
57
|
+
$ ufs ls ';'
|
|
58
|
+
|
|
59
|
+
Delete a file on the device::
|
|
60
|
+
|
|
61
|
+
$ ufs rm foo.txt
|
|
62
|
+
|
|
63
|
+
Copy a file from one location to another on the device::
|
|
64
|
+
|
|
65
|
+
$ ufs cp foo.txt bar.txt
|
|
66
|
+
|
|
67
|
+
Move a file from one location to another on the device::
|
|
68
|
+
|
|
69
|
+
$ ufs mv foo.txt bar.txt
|
|
70
|
+
|
|
71
|
+
Display the contents of a file on the device::
|
|
72
|
+
|
|
73
|
+
$ ufs cat foo.txt
|
|
74
|
+
|
|
75
|
+
Get the size of a file on the device in bytes::
|
|
76
|
+
|
|
77
|
+
$ ufs du foo.txt
|
|
78
|
+
|
|
79
|
+
Copy a file onto the device::
|
|
80
|
+
|
|
81
|
+
$ ufs put path/to/local.txt
|
|
82
|
+
|
|
83
|
+
Get a file from the device::
|
|
84
|
+
|
|
85
|
+
$ ufs get remote.txt
|
|
86
|
+
|
|
87
|
+
The ``put`` and ``get`` commands optionally take a further argument to specify
|
|
88
|
+
the name of the target file::
|
|
89
|
+
|
|
90
|
+
$ ufs put /path/to/local.txt remote.txt
|
|
91
|
+
$ ufs get remote.txt local.txt
|
|
92
|
+
|
|
93
|
+
Get version information for MicroPython running on the device::
|
|
94
|
+
|
|
95
|
+
$ ufs version
|
|
96
|
+
|
|
97
|
+
Development
|
|
98
|
+
-----------
|
|
99
|
+
|
|
100
|
+
The source code is hosted in GitHub. Please feel free to fork the repository.
|
|
101
|
+
Assuming you have Git installed you can download the code from the canonical
|
|
102
|
+
repository with the following command::
|
|
103
|
+
|
|
104
|
+
$ git clone https://github.com/blackteahamburger/microfs.git
|
|
105
|
+
|
|
106
|
+
To locally install your development version of the module into a virtualenv,
|
|
107
|
+
run the following command::
|
|
108
|
+
|
|
109
|
+
$ pip install -e ".[dev]"
|
|
110
|
+
|
|
111
|
+
This also ensures that you have the correct dependencies for development.
|
|
112
|
+
|
|
113
|
+
There is a Makefile that helps with most of the common workflows associated
|
|
114
|
+
with development.
|