element-hq / element-hq/synapse
Script to check that all dependencies have `sdists` in the uv lock file
- Dominant language
- Python
- Stars
- 4.6k
- Forks
- 600
- Avg merge
- 5d 22h
- Merged PRs (30d)
- 51
Description
*See [parent issue](https://github.com/element-hq/synapse/issues/19566) for more context*
We currently have two scripts that validate the Poetry lockfile in CI:
### 1. `scripts-dev/check_locked_deps_have_sdists.py`
Parses `poetry.lock` (via `tomli`) and checks that every locked package has at least one `.tar.gz` (source distribution) file. This runs in the `poetry_lockfile.yaml` workflow, triggered on `poetry.lock` changes.
In `uv.lock`, each `[[package]]` has an explicit `sdist = { ... }` field (or it's absent). The check becomes: verify every package (except the project itself) has an `sdist` key.
### 2. `.ci/scripts/check_lockfile.py`
Parses `poetry.lock` and asserts `metadata.lock-version == "2.1"`. Runs in the `check-lockfile` job of `tests.yml`.
For uv, this would check the `version` field at the top of `uv.lock` (currently `1`).
### 3. `.github/workflows/poetry_lockfile.yaml`
Triggers on `poetry.lock` changes — needs to trigger on `uv.lock` changes instead, and run the adapted script.
### Changes needed
- Rewrite `check_locked_deps_have_sdists.py` to parse `uv.lock` (TOML format, look for missing `sdist` keys on `[[package]]` entries)
- Rewrite or remove `check_lockfile.py` (the version check is less critical for uv since the format is simpler, but could still validate `version = 1`)
- Update `poetry_lockfile.yaml` to trigger on `uv.lock` and rename the workflow
Contributor guide
Assessment
This issue has not been assessed yet.