Skip to content

Commit 013ddcb

Browse files
committed
Convert from Poetry to PEP standard pyproject.toml for uv
- Replace Poetry-specific configuration with PEP 621 project metadata - Convert dependency groups to optional-dependencies - Update build system to use hatchling instead of poetry-core - Remove poetry.toml and poetry.lock files - Update all documentation to reference uv instead of Poetry - Test package building with standard tools This change makes the project compatible with modern Python packaging tools like uv while maintaining all functionality.
1 parent 40d2719 commit 013ddcb

File tree

8 files changed

+2766
-3292
lines changed

8 files changed

+2766
-3292
lines changed

.github/copilot-instructions.md

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,9 @@ MPFlash is a command-line tool and Python library for managing MicroPython firmw
3232

3333
# dependencies
3434

35-
- Use uv pip for package management
36-
- the project is handled by poetry and all dependencies should be added to the pyproject.toml file
37-
- minimize the number of dependencies
38-
-
35+
- Use uv for package management
36+
- The project uses PEP standard pyproject.toml format and all dependencies should be added to the dependencies or optional-dependencies sections
37+
- Minimize the number of dependencies
3938

4039
# Writing tests
4140
- when asked to create an MVP - keep the number of tests to a minimum

docs/contributing.md

Lines changed: 24 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ Thank you for your interest in contributing to MPFlash! This guide will help you
1818
### Prerequisites
1919

2020
- Python 3.9.2 or later
21-
- Poetry for dependency management
21+
- uv for dependency management (recommended) or pip
2222
- Git for version control
2323
- A MicroPython board for testing (optional but recommended)
2424

@@ -42,10 +42,10 @@ Thank you for your interest in contributing to MPFlash! This guide will help you
4242

4343
```bash
4444
# Install development dependencies
45-
poetry install
45+
uv sync --all-extras
4646

47-
# Activate virtual environment
48-
poetry shell
47+
# Or using pip (if uv not available)
48+
pip install -e ".[dev,test,perf]"
4949
```
5050

5151
### Environment Configuration
@@ -66,10 +66,10 @@ PYTHONPATH=src # For development
6666

6767
```bash
6868
# Run MPFlash to verify installation
69-
poetry run mpflash --help
69+
uv run mpflash --help
7070

7171
# Run tests to ensure everything works
72-
poetry run pytest
72+
uv run pytest
7373
```
7474

7575
## Code Style Guidelines
@@ -171,16 +171,13 @@ Use these tools to maintain code quality:
171171

172172
```bash
173173
# Format code
174-
poetry run black mpflash/
174+
uv run ruff format mpflash/
175175

176-
# Sort imports
177-
poetry run isort mpflash/
176+
# Lint and fix code
177+
uv run ruff check --fix mpflash/
178178

179-
# Remove unused imports
180-
poetry run autoflake mpflash/ -r --in-place --remove-all-unused-imports
181-
182-
# Type checking
183-
poetry run mypy mpflash/
179+
# Type checking (if mypy is installed)
180+
uv run mypy mpflash/
184181
```
185182

186183
## Testing
@@ -306,22 +303,22 @@ def test_list_command():
306303

307304
```bash
308305
# Run all tests
309-
poetry run pytest
306+
uv run pytest
310307

311308
# Run specific test file
312-
poetry run pytest tests/test_download.py
309+
uv run pytest tests/test_download.py
313310

314311
# Run tests with coverage
315-
poetry run pytest --cov=mpflash
312+
uv run pytest --cov=mpflash
316313

317314
# Run tests with verbose output
318-
poetry run pytest -v
315+
uv run pytest -v
319316

320317
# Run tests excluding slow tests
321-
poetry run pytest -m "not basicgit"
318+
uv run pytest -m "not basicgit"
322319

323320
# Run tests for specific functionality
324-
poetry run pytest -k "flash"
321+
uv run pytest -k "flash"
325322
```
326323

327324
### Test Coverage
@@ -330,8 +327,8 @@ Maintain high test coverage:
330327

331328
```bash
332329
# Generate coverage report
333-
poetry run coverage run -m pytest
334-
poetry run coverage html
330+
uv run coverage run -m pytest
331+
uv run coverage html
335332

336333
# View coverage report
337334
open htmlcov/index.html
@@ -528,14 +525,11 @@ To add support for a new hardware platform:
528525
MPFlash uses semantic versioning:
529526

530527
```bash
531-
# Patch version (bug fixes)
532-
poetry version patch
533-
534-
# Minor version (new features)
535-
poetry version minor
536-
537-
# Major version (breaking changes)
538-
poetry version major
528+
# Update version in pyproject.toml manually
529+
# Or use a tool like bump2version:
530+
# bump2version patch # for bug fixes
531+
# bump2version minor # for new features
532+
# bump2version major # for breaking changes
539533
```
540534

541535
### Changelog

docs/developer.md

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -87,14 +87,14 @@ CREATE TABLE firmwares (
8787

8888
### Prerequisites
8989
- Python 3.9.2+
90-
- Poetry for dependency management
90+
- uv for dependency management (or pip)
9191
- Git for version control
9292

9393
### Installation
9494
```bash
9595
git clone https://github.com/Josverl/mpflash.git
9696
cd mpflash
97-
poetry install
97+
uv sync --all-extras
9898
```
9999

100100
### Environment Variables
@@ -111,13 +111,13 @@ PYTHONPATH=src # Test source path
111111
### Running Tests
112112
```bash
113113
# Run all tests
114-
poetry run pytest
114+
uv run pytest
115115

116116
# Run with coverage
117-
poetry run pytest --cov=mpflash
117+
uv run pytest --cov=mpflash
118118

119119
# Run specific test categories
120-
poetry run pytest -m "not basicgit"
120+
uv run pytest -m "not basicgit"
121121
```
122122

123123
## Code Standards
@@ -355,12 +355,12 @@ Use the configured tasks for development:
355355

356356
### Version Management
357357
```bash
358-
# Update version in pyproject.toml
359-
poetry version patch|minor|major
358+
# Update version in pyproject.toml manually or with tools like bump2version
359+
# Build package
360+
uv build
360361

361-
# Build and publish
362-
poetry build
363-
poetry publish
362+
# Publish to PyPI
363+
uv publish
364364
```
365365

366366
### Documentation Updates

poetry.lock

Lines changed: 0 additions & 3173 deletions
This file was deleted.

poetry.toml

Lines changed: 0 additions & 6 deletions
This file was deleted.

pyproject.toml

Lines changed: 75 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -1,86 +1,96 @@
11

22
############################################################
3-
# POETRY #
3+
# PROJECT METADATA #
44
############################################################
55

6-
[tool.poetry]
6+
[project]
77
name = "mpflash"
88
version = "1.26.0"
99
description = "Flash and download tool for MicroPython firmwares"
10-
authors = ["Jos Verlinde <[email protected]>"]
11-
license = "MIT"
10+
authors = [
11+
{name = "Jos Verlinde", email = "[email protected]"}
12+
]
13+
license = {text = "MIT"}
1214
readme = "README.md"
1315
keywords = ["MicroPython", "firmware", "flash", "download", "UF2", "esptool"]
14-
homepage = "https://github.com/Josverl/mpflash/blob/main/README.md"
15-
repository = "https://github.com/Josverl/mpflash"
1616
classifiers = [
17-
"Programming Language :: Python :: Implementation :: MicroPython",
17+
"Development Status :: 5 - Production/Stable",
18+
"Intended Audience :: Developers",
19+
"License :: OSI Approved :: MIT License",
20+
"Programming Language :: Python :: 3",
21+
"Programming Language :: Python :: 3.9",
22+
"Programming Language :: Python :: 3.10",
23+
"Programming Language :: Python :: 3.11",
24+
"Programming Language :: Python :: 3.12",
1825
"Programming Language :: Python :: Implementation :: CPython",
26+
"Programming Language :: Python :: Implementation :: MicroPython",
1927
"Topic :: Software Development :: Build Tools",
28+
"Topic :: System :: Hardware",
29+
"Topic :: Utilities",
30+
]
31+
requires-python = ">=3.9.2"
32+
dependencies = [
33+
"beautifulsoup4>=4.12.3",
34+
"bincopy>=20.0.0",
35+
"blkinfo>=0.2.0",
36+
"cachetools>=5.3.0",
37+
"esptool>=4.7.0",
38+
"inquirer>=3.2.4",
39+
"jsonlines>=4.0.0",
40+
"jsons>=1.6.3",
41+
"libusb>=1.0.27; sys_platform == 'win32'",
42+
"pywin32>=310; sys_platform == 'win32'",
43+
"loguru>=0.7.2",
44+
"mpremote>=1.22.0",
45+
"packaging>=24.2",
46+
"platformdirs>=4.2.0",
47+
"psutil>=7.0.0,<8.0.0",
48+
"pygithub>=2.1.1",
49+
"pyusb>=1.2.1",
50+
"requests>=2.31.0",
51+
"rich-click>=1.8.1",
52+
"tenacity==9.0.0",
53+
"cache-to-disk>=2.0.0",
54+
"sqlalchemy>=2.0.41",
55+
"tomli-w>=1.2.0",
56+
"tomli>=2.2.1",
57+
]
58+
59+
[project.optional-dependencies]
60+
dev = [
61+
"ipykernel>=6.29.5",
62+
"tornado>=6.5",
63+
"pandas>=2.2.3",
64+
]
65+
test = [
66+
"pandas>=2.2.3",
67+
"pytest>=7.1.2,<9.0.0",
68+
"pytest-cov>=6.0.0",
69+
"pytest-github-actions-annotate-failures>=0.1.7,<0.4.0",
70+
"pytest-json-report>=1.5.0",
71+
"pytest-metadata>=2.0.2,<4.0.0",
72+
"pytest-mock>=3.10.0",
73+
"coverage>=6.4.3,<8.0.0",
74+
"distro>=1.8.0",
75+
"fasteners>=0.19",
76+
"mock>=4.0.3,<6.0.0",
77+
]
78+
perf = [
79+
"scalene>=1.5.51",
2080
]
2181

22-
[tool.poetry.scripts]
82+
[project.scripts]
2383
mpflash = "mpflash.cli_main:mpflash"
2484

25-
[tool.poetry.dependencies]
26-
python = ">=3.9.2,<3.11.0 || >3.11.0,<4.0"
27-
beautifulsoup4 = "^4.12.3"
28-
bincopy = "^20.0.0"
29-
blkinfo = "^0.2.0"
30-
cachetools = "^5.3.0"
31-
esptool = "^4.7.0"
32-
inquirer = "^3.2.4"
33-
jsonlines = "^4.0.0"
34-
jsons = "^1.6.3"
35-
libusb = { version = "^1.0.27", platform = "win32" }
36-
pywin32 = { version = "^310", platform = "win32" }
37-
loguru = "^0.7.2"
38-
mpremote = "^1.22.0"
39-
packaging = "^24.2"
40-
platformdirs = "^4.2.0"
41-
psutil = ">=7.0.0,<8.0.0"
42-
pygithub = "^2.1.1"
43-
pyusb = "^1.2.1"
44-
requests = "^2.31.0"
45-
rich-click = "^1.8.1"
46-
tenacity = "9.0.0"
47-
cache-to-disk = "^2.0.0"
48-
sqlalchemy = "^2.0.41"
49-
tomli-w = "^1.2.0"
50-
51-
52-
[tool.poetry.group.dev]
53-
optional = true
54-
[tool.poetry.group.dev.dependencies]
55-
ipykernel = "^6.29.5"
56-
tornado = "^6.5" # fix
57-
pandas = "^2.2.3"
58-
59-
[tool.poetry.group.test]
60-
optional = true
61-
[tool.poetry.group.test.dependencies]
62-
pandas = "^2.2.3"
63-
pytest = ">=7.1.2,<9.0.0"
64-
pytest-cov = "^6.0.0"
65-
pytest-github-actions-annotate-failures = ">=0.1.7,<0.4.0"
66-
pytest-json-report = "^1.5.0"
67-
pytest-metadata = ">=2.0.2,<4.0.0"
68-
pytest-mock = "^3.10.0"
69-
#
70-
coverage = ">=6.4.3,<8.0.0"
71-
distro = "^1.8.0"
72-
fasteners = "^0.19"
73-
mock = ">=4.0.3,<6.0.0"
74-
75-
76-
[tool.poetry.group.perf]
77-
optional = true
78-
[tool.poetry.group.perf.dependencies]
79-
scalene = "^1.5.51"
85+
[project.urls]
86+
Homepage = "https://github.com/Josverl/mpflash"
87+
Documentation = "https://github.com/Josverl/mpflash/blob/main/README.md"
88+
Repository = "https://github.com/Josverl/mpflash"
89+
"Bug Tracker" = "https://github.com/Josverl/mpflash/issues"
8090

8191
[build-system]
82-
requires = ["poetry-core"]
83-
build-backend = "poetry.core.masonry.api"
92+
requires = ["hatchling"]
93+
build-backend = "hatchling.build"
8494

8595
############################################################
8696
# PYTEST #

tests.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,22 +2,22 @@
22

33
To install test dependencies, use:
44
```
5-
poetry install --with test
5+
uv sync --extra test
66
```
77

88
To run all tests, use:
99
```
10-
pytest
10+
uv run pytest
1111
```
1212

1313
To run tests with coverage report:
1414
```
15-
pytest --cov
15+
uv run pytest --cov
1616
```
1717

1818
To generate an HTML coverage report:
1919
```
20-
pytest --cov=mpflash --cov-report=html
20+
uv run pytest --cov=mpflash --cov-report=html
2121
```
2222
Open the generated `htmlcov/index.html` in your browser to view the coverage report.
2323

0 commit comments

Comments
 (0)