mpbuild 1.0.0__tar.gz → 1.2.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.
- mpbuild-1.2.0/.github/workflows/release.yml +77 -0
- {mpbuild-1.0.0 → mpbuild-1.2.0}/PKG-INFO +1 -1
- mpbuild-1.2.0/RELEASE.md +128 -0
- {mpbuild-1.0.0 → mpbuild-1.2.0}/pyproject.toml +1 -1
- {mpbuild-1.0.0 → mpbuild-1.2.0}/src/mpbuild/__init__.py +10 -3
- {mpbuild-1.0.0 → mpbuild-1.2.0}/src/mpbuild/build.py +2 -0
- {mpbuild-1.0.0 → mpbuild-1.2.0}/tests/test_build_container.py +2 -0
- {mpbuild-1.0.0 → mpbuild-1.2.0}/uv.lock +1 -1
- {mpbuild-1.0.0 → mpbuild-1.2.0}/.github/workflows/test.yml +0 -0
- {mpbuild-1.0.0 → mpbuild-1.2.0}/.gitignore +0 -0
- {mpbuild-1.0.0 → mpbuild-1.2.0}/.pre-commit-config.yaml +0 -0
- {mpbuild-1.0.0 → mpbuild-1.2.0}/.python-version +0 -0
- {mpbuild-1.0.0 → mpbuild-1.2.0}/LICENSE +0 -0
- {mpbuild-1.0.0 → mpbuild-1.2.0}/README.md +0 -0
- {mpbuild-1.0.0 → mpbuild-1.2.0}/docs/mpbuild_interactive_screenshot.png +0 -0
- {mpbuild-1.0.0 → mpbuild-1.2.0}/requirements-dev.lock +0 -0
- {mpbuild-1.0.0 → mpbuild-1.2.0}/requirements.lock +0 -0
- {mpbuild-1.0.0 → mpbuild-1.2.0}/src/mpbuild/__main__.py +0 -0
- {mpbuild-1.0.0 → mpbuild-1.2.0}/src/mpbuild/board_database.py +0 -0
- {mpbuild-1.0.0 → mpbuild-1.2.0}/src/mpbuild/check_images.py +0 -0
- {mpbuild-1.0.0 → mpbuild-1.2.0}/src/mpbuild/cli.py +0 -0
- {mpbuild-1.0.0 → mpbuild-1.2.0}/src/mpbuild/completions.py +0 -0
- {mpbuild-1.0.0 → mpbuild-1.2.0}/src/mpbuild/find_boards.py +0 -0
- {mpbuild-1.0.0 → mpbuild-1.2.0}/src/mpbuild/interactive.py +0 -0
- {mpbuild-1.0.0 → mpbuild-1.2.0}/src/mpbuild/interactive.tcss +0 -0
- {mpbuild-1.0.0 → mpbuild-1.2.0}/src/mpbuild/list_boards.py +0 -0
- {mpbuild-1.0.0 → mpbuild-1.2.0}/src/mpbuild/py.typed +0 -0
- {mpbuild-1.0.0 → mpbuild-1.2.0}/tests/__init__.py +0 -0
- {mpbuild-1.0.0 → mpbuild-1.2.0}/tests/conftest.py +0 -0
- {mpbuild-1.0.0 → mpbuild-1.2.0}/tests/test_board_database.py +0 -0
- {mpbuild-1.0.0 → mpbuild-1.2.0}/tests/test_cli.py +0 -0
- {mpbuild-1.0.0 → mpbuild-1.2.0}/tests/test_detect_idf_version.py +0 -0
- {mpbuild-1.0.0 → mpbuild-1.2.0}/tests/test_docker_build_cmd.py +0 -0
- {mpbuild-1.0.0 → mpbuild-1.2.0}/tests/test_find_boards.py +0 -0
- {mpbuild-1.0.0 → mpbuild-1.2.0}/tests/test_interactive.py +0 -0
- {mpbuild-1.0.0 → mpbuild-1.2.0}/tests/test_worktrees.py +0 -0
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
name: release
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
tags:
|
|
6
|
+
- "v*"
|
|
7
|
+
|
|
8
|
+
# A tag push triggers a single release; cancelling on a duplicate tag push
|
|
9
|
+
# would be unusual, so no concurrency group needed.
|
|
10
|
+
|
|
11
|
+
jobs:
|
|
12
|
+
build:
|
|
13
|
+
runs-on: ubuntu-latest
|
|
14
|
+
steps:
|
|
15
|
+
- uses: actions/checkout@v4
|
|
16
|
+
|
|
17
|
+
- name: Install uv
|
|
18
|
+
uses: astral-sh/setup-uv@v6
|
|
19
|
+
with:
|
|
20
|
+
python-version: "3.12"
|
|
21
|
+
enable-cache: true
|
|
22
|
+
|
|
23
|
+
- name: Build sdist and wheel
|
|
24
|
+
run: uv build
|
|
25
|
+
|
|
26
|
+
- name: Upload distribution artefacts
|
|
27
|
+
uses: actions/upload-artifact@v4
|
|
28
|
+
with:
|
|
29
|
+
name: dist
|
|
30
|
+
path: dist/
|
|
31
|
+
|
|
32
|
+
publish-pypi:
|
|
33
|
+
needs: build
|
|
34
|
+
runs-on: ubuntu-latest
|
|
35
|
+
# The `pypi` environment matches the trusted-publisher config on PyPI.
|
|
36
|
+
# Pair this with an environment protection rule (Settings -> Environments
|
|
37
|
+
# -> pypi -> Required reviewers) for a manual approval gate.
|
|
38
|
+
environment:
|
|
39
|
+
name: pypi
|
|
40
|
+
url: https://pypi.org/project/mpbuild/
|
|
41
|
+
permissions:
|
|
42
|
+
# Required for PyPI trusted publishing via OIDC. No PyPI token needed.
|
|
43
|
+
id-token: write
|
|
44
|
+
steps:
|
|
45
|
+
- name: Download distribution artefacts
|
|
46
|
+
uses: actions/download-artifact@v4
|
|
47
|
+
with:
|
|
48
|
+
name: dist
|
|
49
|
+
path: dist/
|
|
50
|
+
|
|
51
|
+
- name: Publish to PyPI
|
|
52
|
+
uses: pypa/gh-action-pypi-publish@release/v1
|
|
53
|
+
|
|
54
|
+
github-release:
|
|
55
|
+
needs: publish-pypi
|
|
56
|
+
runs-on: ubuntu-latest
|
|
57
|
+
permissions:
|
|
58
|
+
contents: write
|
|
59
|
+
steps:
|
|
60
|
+
- uses: actions/checkout@v4
|
|
61
|
+
with:
|
|
62
|
+
# Full history so --generate-notes can resolve the previous tag.
|
|
63
|
+
fetch-depth: 0
|
|
64
|
+
|
|
65
|
+
- name: Download distribution artefacts
|
|
66
|
+
uses: actions/download-artifact@v4
|
|
67
|
+
with:
|
|
68
|
+
name: dist
|
|
69
|
+
path: dist/
|
|
70
|
+
|
|
71
|
+
- name: Create GitHub release
|
|
72
|
+
env:
|
|
73
|
+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
74
|
+
run: |
|
|
75
|
+
gh release create "${GITHUB_REF_NAME}" dist/* \
|
|
76
|
+
--generate-notes \
|
|
77
|
+
--title "${GITHUB_REF_NAME}"
|
mpbuild-1.2.0/RELEASE.md
ADDED
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
# Releasing mpbuild
|
|
2
|
+
|
|
3
|
+
Cutting a release is two steps: merge a version-bump PR, then push a tag. Everything else (build, PyPI upload, GitHub release) happens automatically via `.github/workflows/release.yml`.
|
|
4
|
+
|
|
5
|
+
## TL;DR
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
# 1. Open + merge a "Release vX.Y.Z" PR that bumps:
|
|
9
|
+
# - pyproject.toml (project.version)
|
|
10
|
+
# - uv.lock (uv lock)
|
|
11
|
+
#
|
|
12
|
+
# 2. Tag the merged commit on main and push:
|
|
13
|
+
git checkout main
|
|
14
|
+
git pull --ff-only
|
|
15
|
+
git tag -a vX.Y.Z -m "vX.Y.Z"
|
|
16
|
+
git push origin vX.Y.Z
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
The tag push triggers the release workflow. Done.
|
|
20
|
+
|
|
21
|
+
## What a release produces
|
|
22
|
+
|
|
23
|
+
| Artefact | Where |
|
|
24
|
+
|---|---|
|
|
25
|
+
| New version | https://pypi.org/project/mpbuild/ |
|
|
26
|
+
| Git tag `vX.Y.Z` | https://github.com/mattytrentini/mpbuild/tags |
|
|
27
|
+
| GitHub release with auto-generated notes + wheel/sdist | https://github.com/mattytrentini/mpbuild/releases |
|
|
28
|
+
|
|
29
|
+
## Step-by-step
|
|
30
|
+
|
|
31
|
+
### 1. Decide the version
|
|
32
|
+
|
|
33
|
+
[SemVer](https://semver.org/):
|
|
34
|
+
|
|
35
|
+
- **Patch** (`1.0.X`) — bug fixes only.
|
|
36
|
+
- **Minor** (`1.X.0`) — backwards-compatible new behaviour.
|
|
37
|
+
- **Major** (`X.0.0`) — breaking change to the CLI.
|
|
38
|
+
|
|
39
|
+
The CLI is the stable surface that SemVer applies to. The Python module API (`import mpbuild`) is documented as a work in progress; treat changes there as out of band.
|
|
40
|
+
|
|
41
|
+
### 2. Open a release PR
|
|
42
|
+
|
|
43
|
+
Bump these two files in a single PR titled "Release vX.Y.Z":
|
|
44
|
+
|
|
45
|
+
- `pyproject.toml` — `project.version = "X.Y.Z"`
|
|
46
|
+
- `uv.lock` — run `uv lock` after the bump to keep it in sync
|
|
47
|
+
|
|
48
|
+
`pyproject.toml` is the single source of truth for the version string; `src/mpbuild/__init__.py` reads it at runtime via `importlib.metadata.version("mpbuild")`, so `mpbuild --version` stays in sync automatically.
|
|
49
|
+
|
|
50
|
+
If anything user-visible changed since the last release (new commands, key bindings, behaviour, etc.), update `README.md` in the same PR.
|
|
51
|
+
|
|
52
|
+
Branch protection requires CI to pass: `test`, `lint`, and `typecheck` all run automatically. The PR's CI must be green before merge.
|
|
53
|
+
|
|
54
|
+
### 3. Tag the merged commit and push
|
|
55
|
+
|
|
56
|
+
```bash
|
|
57
|
+
git checkout main
|
|
58
|
+
git pull --ff-only # picks up the merged release PR
|
|
59
|
+
git tag -a vX.Y.Z -m "vX.Y.Z"
|
|
60
|
+
git push origin vX.Y.Z
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
Annotated tags (`-a -m`) record the tagger and a tag message, which downstream tooling (e.g. release notes, `git describe`) prefers over lightweight tags.
|
|
64
|
+
|
|
65
|
+
### 4. Watch the workflow
|
|
66
|
+
|
|
67
|
+
```bash
|
|
68
|
+
gh run watch
|
|
69
|
+
# or browse https://github.com/mattytrentini/mpbuild/actions
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
Three sequential jobs:
|
|
73
|
+
|
|
74
|
+
1. **`build`** — `uv build` creates the wheel + sdist and uploads them as a workflow artefact.
|
|
75
|
+
2. **`publish-pypi`** — uploads to PyPI via OIDC trusted publishing.
|
|
76
|
+
3. **`github-release`** — creates the GitHub release with `--generate-notes`, attaching the wheel + sdist as assets.
|
|
77
|
+
|
|
78
|
+
If the `pypi` GitHub Environment has "Required reviewers" enabled, `publish-pypi` waits for an approval click — that's the chance to download the artefact from the `build` job and sanity-check it before it hits PyPI.
|
|
79
|
+
|
|
80
|
+
### 5. Verify
|
|
81
|
+
|
|
82
|
+
After the workflow goes green (~1 minute for PyPI to index, in addition to the workflow time):
|
|
83
|
+
|
|
84
|
+
```bash
|
|
85
|
+
uv tool install --python 3.12 --force mpbuild==X.Y.Z
|
|
86
|
+
mpbuild --version # expect: mpbuild vX.Y.Z
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
Then eyeball the GitHub release page at `https://github.com/mattytrentini/mpbuild/releases/tag/vX.Y.Z` — auto-generated notes can be edited via the UI if you want a "Highlights" section above the PR list.
|
|
90
|
+
|
|
91
|
+
## One-off setup (already done; here for reference)
|
|
92
|
+
|
|
93
|
+
PyPI trusted publishing must be configured at https://pypi.org/manage/project/mpbuild/settings/publishing/ with:
|
|
94
|
+
|
|
95
|
+
- **Owner**: `mattytrentini`
|
|
96
|
+
- **Repository name**: `mpbuild`
|
|
97
|
+
- **Workflow name**: `release.yml`
|
|
98
|
+
- **Environment name**: `pypi`
|
|
99
|
+
|
|
100
|
+
This is what makes "publish without a long-lived PyPI token" work: PyPI trusts the GitHub Actions OIDC identity for that exact workflow file in that exact repo's `pypi` environment. If any of those four fields don't match between PyPI and the workflow, the upload step fails with an OIDC token error.
|
|
101
|
+
|
|
102
|
+
## Troubleshooting
|
|
103
|
+
|
|
104
|
+
**`publish-pypi` fails with "OIDC token" / "trusted publishing" error.**
|
|
105
|
+
The PyPI trusted-publisher record doesn't match the workflow. Re-check the four fields under "One-off setup" above — the workflow filename and environment name are the usual culprits.
|
|
106
|
+
|
|
107
|
+
**`publish-pypi` fails with "filename already exists" / "version already exists".**
|
|
108
|
+
PyPI doesn't allow overwriting a version. Bump to the next patch (e.g., if `1.0.1` already exists, release `1.0.2`). You can *yank* a broken release on PyPI (`pip` won't install yanked versions unless explicitly pinned) but you can't re-upload the same version number.
|
|
109
|
+
|
|
110
|
+
**Tag points at the wrong commit.**
|
|
111
|
+
If the workflow hasn't run yet (or hasn't reached `publish-pypi`):
|
|
112
|
+
|
|
113
|
+
```bash
|
|
114
|
+
git tag -d vX.Y.Z
|
|
115
|
+
git push origin :refs/tags/vX.Y.Z
|
|
116
|
+
# Then re-tag from the correct SHA and push.
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
If `publish-pypi` already succeeded, the PyPI upload is final — see "yank" above and bump to the next patch.
|
|
120
|
+
|
|
121
|
+
**You need to undo a release after it shipped.**
|
|
122
|
+
- *PyPI*: yank the version (Manage → Releases → Options → Yank). Don't delete — that breaks reproducibility of anyone who pinned it.
|
|
123
|
+
- *GitHub release*: delete or convert to a pre-release via the UI.
|
|
124
|
+
- *Git tag*: leave it in place. Tags should be immutable once published; deleting them confuses anyone who fetched the repo while the tag existed.
|
|
125
|
+
|
|
126
|
+
## Why tag-driven?
|
|
127
|
+
|
|
128
|
+
The tag is the source of truth for what got released. Alternatives (e.g. triggering on PR merge, on a release-please bot) couple "I want to merge a PR" with "I want to publish" — which doesn't always line up. Pushing the tag is an explicit "release this now" gesture and lets the release PR sit on main for a while if you want to bundle several merges into one release.
|
|
@@ -1,13 +1,20 @@
|
|
|
1
|
-
__app_name__ = "mpbuild"
|
|
2
|
-
__version__ = "1.0.0"
|
|
3
|
-
|
|
4
1
|
from enum import StrEnum
|
|
5
2
|
from functools import cache
|
|
3
|
+
from importlib.metadata import PackageNotFoundError, version
|
|
6
4
|
from pathlib import Path
|
|
7
5
|
|
|
8
6
|
from .board_database import Database
|
|
9
7
|
from .find_boards import find_mpy_root
|
|
10
8
|
|
|
9
|
+
__app_name__ = "mpbuild"
|
|
10
|
+
|
|
11
|
+
try:
|
|
12
|
+
__version__ = version(__app_name__)
|
|
13
|
+
except PackageNotFoundError:
|
|
14
|
+
# Running from a source checkout without an installation (e.g. uv tool ran
|
|
15
|
+
# directly against the repo). Fall back to a sentinel rather than crashing.
|
|
16
|
+
__version__ = "0.0.0+local"
|
|
17
|
+
|
|
11
18
|
|
|
12
19
|
@cache
|
|
13
20
|
def board_database(mpy_dir: Path | None = None, port: str | None = None) -> Database:
|
|
@@ -77,11 +77,13 @@ BUILD_CONTAINERS = {
|
|
|
77
77
|
"renesas-ra": ARM_BUILD_CONTAINER,
|
|
78
78
|
"samd": ARM_BUILD_CONTAINER,
|
|
79
79
|
"psoc6": "ifxmakers/mpy-mtb-ci",
|
|
80
|
+
"psoc-edge": "micropython/build-micropython-psoc-edge", # arm-none-eabi + edgeprotecttools
|
|
80
81
|
"esp32": f"{ESP_IDF_CONTAINER}:{ESP_IDF_FALLBACK_VERSION}",
|
|
81
82
|
"esp8266": "larsks/esp-open-sdk",
|
|
82
83
|
"unix": "gcc:12-bookworm", # Special, doesn't have boards
|
|
83
84
|
"webassembly": ARM_BUILD_CONTAINER, # installs emsdk on first build
|
|
84
85
|
"windows": WIN_BUILD_CONTAINER, # cross compile linux to windows
|
|
86
|
+
"baochip": "micropython/build-micropython-baochip", # xPack RISC-V + pure25519
|
|
85
87
|
}
|
|
86
88
|
|
|
87
89
|
|
|
@@ -39,7 +39,9 @@ class TestSimplePorts:
|
|
|
39
39
|
("renesas-ra", ARM_BUILD_CONTAINER),
|
|
40
40
|
("samd", ARM_BUILD_CONTAINER),
|
|
41
41
|
("psoc6", "ifxmakers/mpy-mtb-ci"),
|
|
42
|
+
("psoc-edge", "micropython/build-micropython-psoc-edge"),
|
|
42
43
|
("esp8266", "larsks/esp-open-sdk"),
|
|
44
|
+
("baochip", "micropython/build-micropython-baochip"),
|
|
43
45
|
],
|
|
44
46
|
)
|
|
45
47
|
def test_physical_port_maps_to_container(self, mpy_root, make_board, port_name, expected):
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|