OpenShock-AutoFlasher 0.0.1__py3-none-any.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.
@@ -0,0 +1,316 @@
1
+ Metadata-Version: 2.4
2
+ Name: OpenShock-AutoFlasher
3
+ Version: 0.0.1
4
+ Summary: Automatically flash OpenShock firmware to ESP32 devices
5
+ Author: NanashiTheNameless
6
+ Author-email: NanashiTheNameless <NanashiTheNameless@NamelessNanashi.dev>
7
+ Maintainer: NanashiTheNameless
8
+ Maintainer-email: NanashiTheNameless <NanashiTheNameless@NamelessNanashi.dev>
9
+ License: AGPL-3.0
10
+ Project-URL: Repository, https://github.com/NanashiTheNameless/OpenShock-AutoFlasher
11
+ Project-URL: Issues, https://github.com/NanashiTheNameless/OpenShock-AutoFlasher/issues
12
+ Project-URL: GitHub Sponsor, https://github.com/sponsors/NanashiTheNameless
13
+ Project-URL: Buy Me a Coffee, https://buymeacoffee.com/NamelessNanashi
14
+ Keywords: openshock,esp32,firmware,flasher
15
+ Classifier: Development Status :: 4 - Beta
16
+ Classifier: Intended Audience :: Developers
17
+ Classifier: License :: OSI Approved :: GNU Affero General Public License v3
18
+ Classifier: Operating System :: OS Independent
19
+ Classifier: Programming Language :: Python :: 3.12
20
+ Classifier: Programming Language :: Python :: 3.13
21
+ Requires-Python: >=3.12
22
+ Description-Content-Type: text/markdown
23
+ License-File: LICENSE
24
+ Requires-Dist: esptool>=5.1.0
25
+ Requires-Dist: pyserial>=3.5
26
+ Requires-Dist: requests>=2.32.5
27
+ Requires-Dist: rich>=14.3.2
28
+ Provides-Extra: dev
29
+ Requires-Dist: pytest>=9.0.2; extra == "dev"
30
+ Requires-Dist: pytest-cov>=7.0.0; extra == "dev"
31
+ Requires-Dist: pytest-mock>=3.12.0; extra == "dev"
32
+ Requires-Dist: black>=26.1.0; extra == "dev"
33
+ Requires-Dist: flake8>=7.0.0; extra == "dev"
34
+ Requires-Dist: mypy>=1.8.0; extra == "dev"
35
+ Dynamic: license-file
36
+
37
+ # OpenShock Auto-Flasher
38
+
39
+ [![PyPI version](https://img.shields.io/pypi/v/OpenShock-AutoFlasher.svg)](https://pypi.org/project/OpenShock-AutoFlasher/)
40
+ [![Python versions](https://img.shields.io/pypi/pyversions/OpenShock-AutoFlasher.svg)](https://pypi.org/project/OpenShock-AutoFlasher/)
41
+ ![Tests](https://github.com/NanashiTheNameless/OpenShock-AutoFlasher/workflows/Tests/badge.svg)
42
+ [![License](https://img.shields.io/github/license/NanashiTheNameless/OpenShock-AutoFlasher)](LICENSE)
43
+
44
+ Automatically flash OpenShock firmware to ESP32 devices when they are plugged in. Features color-coded terminal backgrounds to indicate the current status at a glance.
45
+
46
+ ## Features
47
+
48
+ - **Automatic detection** of newly connected devices
49
+ - **Color-coded status** with background colors:
50
+ - **Blue** - Waiting for device
51
+ - **Yellow** - Flashing in progress
52
+ - **Green** - Flash complete
53
+ - **Red** - Error occurred
54
+ - **Firmware verification** using SHA256 checksums
55
+ - **Multiple channels** - stable, beta, or develop
56
+ - **Post-flash commands** - Send serial commands to device after flashing
57
+ - **Continuous mode** - flash multiple devices in sequence
58
+ - **Optional flash erase** before flashing
59
+ - **Smart text wrapping** - Long messages wrap cleanly without cutting words
60
+ - **Dynamic boards list** - View available boards for any channel via `--help`
61
+
62
+ ## Requirements
63
+
64
+ - Python 3.12 or higher
65
+ - Linux, macOS, or Windows
66
+ - USB connection to ESP32 devices
67
+
68
+ ## Installation
69
+
70
+ ### From GitHub with pipx (Recommended)
71
+
72
+ Install directly from the latest GitHub version:
73
+
74
+ ```bash
75
+ pipx install --force 'OpenShock-AutoFlasher @ git+https://github.com/NanashiTheNameless/OpenShock-AutoFlasher@main'
76
+ ```
77
+
78
+ This makes the `OPSH-AutoFlash` command available system-wide.
79
+
80
+ ### Alternative: From PyPI
81
+
82
+ If you prefer a release from PyPI:
83
+
84
+ ```bash
85
+ pipx install OpenShock-AutoFlasher
86
+ ```
87
+
88
+ ### From Source
89
+
90
+ 1. Clone this repository:
91
+
92
+ ```bash
93
+ git clone https://github.com/NanashiTheNameless/OpenShock-AutoFlasher.git
94
+ cd OpenShock-AutoFlasher
95
+ ```
96
+
97
+ 1. Install dependencies:
98
+
99
+ ```bash
100
+ pip3 install -r requirements.txt
101
+ ```
102
+
103
+ ## Usage
104
+
105
+ ### Basic Usage
106
+
107
+ Flash devices using the stable firmware channel:
108
+
109
+ ```bash
110
+ OPSH-AutoFlash --board <board-name>
111
+ ```
112
+
113
+ View available boards for different channels:
114
+
115
+ ```bash
116
+ OPSH-AutoFlash --help # Shows boards for stable channel
117
+ OPSH-AutoFlash --channel beta --help # Shows boards for beta channel
118
+ OPSH-AutoFlash -c develop --help # Shows boards for develop channel
119
+ ```
120
+
121
+ ### Command-Line Options
122
+
123
+ | Option | Short | Description | Default |
124
+ |----------------|-------|------------------------------------------------------------|----------|
125
+ | `--channel` | `-c` | Firmware channel: `stable`, `beta`, or `develop` | `stable` |
126
+ | `--board` | `-b` | Board type (required) | - |
127
+ | `--erase` | `-e` | Erase flash before flashing | `false` |
128
+ | `--no-auto` | `-n` | Disable auto-flash (just detect devices) | `false` |
129
+ | `--post-flash` | `-p` | Serial command to send after flashing (can use multiple times) | - |
130
+
131
+ ### Examples
132
+
133
+ **Flash with stable firmware:**
134
+
135
+ ```bash
136
+ OPSH-AutoFlash --board Wemos-D1-Mini-ESP32
137
+ ```
138
+
139
+ **Flash with beta firmware and erase existing data:**
140
+
141
+ ```bash
142
+ OPSH-AutoFlash --channel beta --board Wemos-D1-Mini-ESP32 --erase
143
+ ```
144
+
145
+ **Flash and send post-flash commands to device:**
146
+
147
+ ```bash
148
+ OPSH-AutoFlash --board Wemos-D1-Mini-ESP32 \
149
+ --post-flash "help" \
150
+ --post-flash "version" \
151
+ --post-flash "status"
152
+ ```
153
+
154
+ **Use development firmware:**
155
+
156
+ ```bash
157
+ OPSH-AutoFlash --channel develop --board Wemos-D1-Mini-ESP32
158
+ ```
159
+
160
+ **Detect devices without auto-flashing:**
161
+
162
+ ```bash
163
+ OPSH-AutoFlash --board Wemos-D1-Mini-ESP32 --no-auto
164
+ ```
165
+
166
+ ## How It Works
167
+
168
+ 1. **Fetches** the latest firmware version from firmware.openshock.org
169
+ 2. **Validates** the specified board type
170
+ 3. **Monitors** USB ports for newly connected devices
171
+ 4. **Downloads** firmware binary and checksum in parallel
172
+ 5. **Verifies** firmware integrity using SHA256
173
+ 6. **Flashes** the device using esptool
174
+ 7. **Verifies** the flash was successful
175
+ 8. **Executes** post-flash commands over serial (if specified)
176
+ 9. **Repeats** for additional devices (continuous mode)
177
+
178
+ The tool uses esptool with optimized settings and can send serial commands to the device after flashing for automated configuration or testing.
179
+
180
+ ## Supported Boards
181
+
182
+ The tool supports multiple ESP32-based boards. To view the current list of available boards, run:
183
+
184
+ ```bash
185
+ OPSH-AutoFlash --help # Stable channel boards
186
+ OPSH-AutoFlash --channel beta --help # Beta channel boards
187
+ OPSH-AutoFlash -c develop --help # Develop channel boards
188
+ ```
189
+
190
+ Common board types include:
191
+
192
+ - `Wemos-D1-Mini-ESP32`
193
+ - `Wemos-Lolin-S2-Mini`
194
+ - `Wemos-Lolin-S3`
195
+ - `Wemos-Lolin-S3-Mini`
196
+ - `Waveshare_esp32_s3_zero`
197
+ - `Pishock-2023`
198
+ - `Pishock-Lite-2021`
199
+ - `Seeed-Xiao-ESP32C3`
200
+ - `Seeed-Xiao-ESP32S3`
201
+ - `DFRobot-Firebeetle2-ESP32E`
202
+ - `OpenShock-Core-V1`
203
+ - `OpenShock-Core-V2`
204
+
205
+ **Note:** Different channels may have different board support. Always check the help output for your selected channel.
206
+
207
+ ## Permissions (Linux)
208
+
209
+ On Linux, you may need to add your user to the `dialout` group to access serial ports:
210
+
211
+ ```bash
212
+ sudo usermod -a -G dialout $USER
213
+ ```
214
+
215
+ Then log out and log back in for the changes to take effect.
216
+
217
+ ## Troubleshooting
218
+
219
+ **Device not detected:**
220
+
221
+ - Ensure the device is in bootloader mode
222
+ - Check USB cable connection
223
+ - Verify device appears in system (check `dmesg` on Linux or Device Manager on Windows)
224
+
225
+ **Permission errors:**
226
+
227
+ - Add user to dialout/uucp group (Linux)
228
+ - Run with appropriate permissions
229
+ - Check USB cable supports data transfer (not charge-only)
230
+
231
+ **Verification fails:**
232
+
233
+ - Try using `--erase` flag to erase flash first
234
+ - Check for hardware issues
235
+ - Try a different USB port or cable
236
+
237
+ ## Development
238
+
239
+ ### Running Tests
240
+
241
+ The project includes a comprehensive test suite using pytest. To run the tests:
242
+
243
+ 1. Install development dependencies:
244
+
245
+ ```bash
246
+ pip install -e .[dev]
247
+ ```
248
+
249
+ 1. Run the test suite:
250
+
251
+ ```bash
252
+ pytest tests/ -v
253
+ ```
254
+
255
+ 1. Run tests with coverage:
256
+
257
+ ```bash
258
+ pytest tests/ -v --cov=openshock_autoflasher --cov-report=term-missing
259
+ ```
260
+
261
+ ### Code Quality
262
+
263
+ The project uses several tools for code quality:
264
+
265
+ - **Black** - Code formatting
266
+ - **Flake8** - Linting
267
+ - **Mypy** - Type checking
268
+
269
+ Run code quality checks:
270
+
271
+ ```bash
272
+ # Format code
273
+ black openshock_autoflasher/ tests/
274
+
275
+ # Lint code
276
+ flake8 openshock_autoflasher/ tests/
277
+
278
+ # Type check
279
+ mypy openshock_autoflasher/
280
+ ```
281
+
282
+ ### Project Structure
283
+
284
+ The codebase is modular and organized as follows:
285
+
286
+ - `openshock_autoflasher/` - Main package
287
+ - `constants.py` - Configuration constants
288
+ - `styles.py` - Terminal styling and colors
289
+ - `flasher.py` - Core AutoFlasher class with flashing logic
290
+ - `cli.py` - Command-line interface and argument parsing
291
+ - `__init__.py` - Package initialization
292
+ - `__main__.py` - Module entry point
293
+ - `tests/` - Test suite
294
+ - `test_constants.py` - Tests for constants module
295
+ - `test_styles.py` - Tests for styles module
296
+ - `test_flasher.py` - Tests for flasher module
297
+ - `test_cli.py` - Tests for CLI module
298
+
299
+ ### Continuous Integration
300
+
301
+ The project uses GitHub Actions for CI/CD:
302
+
303
+ - **Tests Workflow** - Runs tests on Ubuntu, Windows, and macOS with Python 3.12-3.13
304
+ - **Publish Workflow** - Publishes to PyPI on release
305
+
306
+ ## License
307
+
308
+ This project is licensed under the GNU Affero General Public License v3.0 (AGPL-3.0). See [LICENSE](LICENSE) file for details.
309
+
310
+ ## Contributing
311
+
312
+ Contributions are welcome! Please feel free to submit issues or pull requests.
313
+
314
+ ## Disclaimer
315
+
316
+ This tool is provided as-is. Use at your own risk. Always ensure you have backups of any important configurations before flashing firmware.
@@ -0,0 +1,13 @@
1
+ openshock_autoflasher/__init__.py,sha256=FK4y7lR1R4vaqFus8l28cDBvYxEH9MyqUZb-sO-sJDI,343
2
+ openshock_autoflasher/__main__.py,sha256=LSvt_hNE1414S5WNTP21ykNU-xZ3hWUxgeXShf1rlIo,188
3
+ openshock_autoflasher/cli.py,sha256=ubjLXqu3lRsYtREhsp3lXnH4NPOTojO_meXqW5YfqzA,3646
4
+ openshock_autoflasher/constants.py,sha256=FVj6Tk_kKzubEi7wpL-rpKWpgPHDkvRM-HjRn2towV8,553
5
+ openshock_autoflasher/flasher.py,sha256=3DBAEQjLvfJFlHqP1KEmUmkiZ2tLXbexphwOlSHomhE,16089
6
+ openshock_autoflasher/py.typed,sha256=kO13kg6OXApIRwKRcPpEOL09GZHx2Pk8Rp2KZpxv0lw,63
7
+ openshock_autoflasher/styles.py,sha256=JLvtptGk6h3aVoD5iYVkfGmID3zt6PU3lBZaMdSOHnI,575
8
+ openshock_autoflasher-0.0.1.dist-info/licenses/LICENSE,sha256=hIahDEOTzuHCU5J2nd07LWwkLW7Hko4UFO__ffsvB-8,34523
9
+ openshock_autoflasher-0.0.1.dist-info/METADATA,sha256=Lly_UDZYpXQpLMbfyedM5r5UVeBO7ttziegZ-O0MK4k,9464
10
+ openshock_autoflasher-0.0.1.dist-info/WHEEL,sha256=YCfwYGOYMi5Jhw2fU4yNgwErybb2IX5PEwBKV4ZbdBo,91
11
+ openshock_autoflasher-0.0.1.dist-info/entry_points.txt,sha256=o7sTGRS_1IwYCne-CL5lAkB6QUNW7PWOsp42nWiW0cw,66
12
+ openshock_autoflasher-0.0.1.dist-info/top_level.txt,sha256=T3qrJ7CtQqm7FAh_kHzlDcVEkNeYlB4Q6NUoSjPZNF0,22
13
+ openshock_autoflasher-0.0.1.dist-info/RECORD,,
@@ -0,0 +1,5 @@
1
+ Wheel-Version: 1.0
2
+ Generator: setuptools (82.0.0)
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
5
+
@@ -0,0 +1,2 @@
1
+ [console_scripts]
2
+ OPSH-AutoFlash = openshock_autoflasher.cli:main