Skip to content

Commit 89253a1

Browse files
authored
Merge pull request #35 from andrewleech/convert-to-uv
Convert from Poetry to PEP standard pyproject.toml for uv
2 parents 40d2719 + d5ae078 commit 89253a1

File tree

10 files changed

+2786
-3301
lines changed

10 files changed

+2786
-3301
lines changed

.all-contributorsrc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,8 @@
7070
"profile": "https://www.gitlab.com/alelec",
7171
"contributions": [
7272
"mpflash",
73-
"test"
73+
"test",
74+
"tooling"
7475
]
7576
},
7677
{

.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

.github/workflows/pytest_mpflash.yml

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -48,11 +48,12 @@ jobs:
4848
fetch-tags: true
4949

5050
#----------------------------------------------
51-
# poetry is not in the default image
51+
# uv is not in the default image
5252
#----------------------------------------------
53-
- name: Install poetry and codecov
54-
run: |
55-
pipx install poetry
53+
- name: Install the latest version of uv
54+
uses: astral-sh/setup-uv@v6
55+
with:
56+
version: "latest"
5657

5758
- name: Set up Python ${{ matrix.python-version }}
5859
uses: actions/setup-python@v5
@@ -64,13 +65,13 @@ jobs:
6465
# install project
6566
#----------------------------------------------
6667
- name: Install mpflash & test dependencies
67-
run: poetry install --with test
68+
run: uv sync --extra test
6869

6970
- name: Test mpflash
7071
run: |
7172
# run once to bootstrap database (test hack)
72-
poetry run mpflash download --board RPI_PICO
73-
poetry run pytest --cov --cov-branch --cov-report=xml
73+
uv run mpflash download --board RPI_PICO
74+
uv run pytest --cov --cov-branch --cov-report=xml
7475
7576
#----------------------------------------------
7677
# upload coverage stats

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: 16 additions & 11 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,17 @@ Use the configured tasks for development:
355355

356356
### Version Management
357357
```bash
358-
# Update version in pyproject.toml
359-
poetry version patch|minor|major
360-
361-
# Build and publish
362-
poetry build
363-
poetry publish
358+
# Update version in pyproject.toml using either
359+
uv version <new_version>
360+
uv version --bump patch
361+
# Build package
362+
uv build
363+
364+
# Publish to PyPI
365+
# set token in environment variable
366+
export UV_PUBLISH_TOKEN="pypi-123456789abcdef"
367+
# uv publish --index testpypi # optionally
368+
uv publish #
364369
```
365370

366371
### Documentation Updates

0 commit comments

Comments
 (0)