MAINT: Create CircleCI job to test against wheels (binary distributions)#310
MAINT: Create CircleCI job to test against wheels (binary distributions)#310
Conversation
There was a problem hiding this comment.
Pull request overview
Updates the CircleCI pipeline to add test coverage for installed wheel distributions and to reuse built dist/ artifacts across subsequent jobs via the workspace, helping detect packaging issues like missing non-Python files.
Changes:
- Added a
build_distributionjob that builds sdist/wheel artifacts and persistsdist/to the workspace. - Added a
test_wheeljob that installs the built wheel into an isolated venv and runs the test suite against the installed distribution. - Rewired publish/check jobs and workflow dependencies to consume
dist/from the workspace; removed commented-out system dependency install steps.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
ahms5
left a comment
There was a problem hiding this comment.
I love it. I wonder if we really need to test_source, as test_wheel should also fail in case test_source fails.
| at: /tmp/workspace | ||
| - run: | ||
| name: install dependencies | ||
| command: pip install ".[deploy]" |
There was a problem hiding this comment.
| command: pip install ".[deploy]" | |
| command: pip install twine |
woudnt this be sufficiant?
There was a problem hiding this comment.
In theory yes, but I'd like to avoid managing dependencies in the CircleCI config and the pyproject.toml. This way it's always sufficient to extend and update in a single place.
There was a problem hiding this comment.
I see your point. My thinking here is that this job is only invoking twine, which doesn’t depend on our project’s dependencies or anything that could vary with the package—it’s just a standalone tool.
We could compare it to ruff, but in that case we pin a specific version and install it via the project configuration. Imo this makes sence here, but we dont have this requriedment for twine.
If we want to change the dependency of twine we also need to change this workflow here.
Right now, installing all packages takes about 29 seconds in CI. Installing only twine should be significantly faster. This also scales better, since this job will run for every package on each pull request.
There was a problem hiding this comment.
Sorry, I still don't really get the point. You could also pin to a specific version within the CircleCI config. My point is more about central management of dependencies in the toml, instead of individual management of dependencies in different places.
I realized though, that its probably more useful to check the binary distribution within the built job instead of creating a new job. This probably saves more time than the 29 secs you mentioned.
There was a problem hiding this comment.
To be honest, I think this job can be removed altogether.
It only checks if the meta-data provided in the pyproject.toml is according to what PyPI expects. More specifically, it only checks the content of the item long_description.
I think it's sufficient to check this before truly releasing a new version and remove the check in PRs, etc.
There was a problem hiding this comment.
| @@ -150,18 +190,17 @@ jobs: | |||
| command: pip install ".[deploy]" | |||
There was a problem hiding this comment.
| command: pip install ".[deploy]" | |
| command: pip install twine |
same here.
.circleci/config.yml
Outdated
| name: Install wheel in isolated venv and run tests | ||
| command: | | ||
| python -m venv .wheeltest | ||
| WHEEL=$(ls -1 /tmp/workspace/dist/*.whl | head -n 1) | ||
| .wheeltest/bin/python -m pip install "${WHEEL}[tests]" | ||
| TEST_PYTHON="$(pwd)/.wheeltest/bin/python" | ||
| rm -rf /tmp/spharpy-wheel-tests | ||
| mkdir -p /tmp/spharpy-wheel-tests | ||
| cp -r tests /tmp/spharpy-wheel-tests/ | ||
| cd /tmp/spharpy-wheel-tests | ||
| "$TEST_PYTHON" -m pytest tests | ||
|
|
There was a problem hiding this comment.
this is not that easy to read, maybe we can spit this into 3 blocks, sth like create environment, move files, and test. In this way the maintainance would be easier.
There was a problem hiding this comment.
I think it's plenty easy to read 💩
... I'll update :)
In general I agree, my first draft of this did exactly that. |
| at: /tmp/workspace | ||
| - run: | ||
| name: install dependencies | ||
| command: pip install ".[deploy]" |
There was a problem hiding this comment.
I see your point. My thinking here is that this job is only invoking twine, which doesn’t depend on our project’s dependencies or anything that could vary with the package—it’s just a standalone tool.
We could compare it to ruff, but in that case we pin a specific version and install it via the project configuration. Imo this makes sence here, but we dont have this requriedment for twine.
If we want to change the dependency of twine we also need to change this workflow here.
Right now, installing all packages takes about 29 seconds in CI. Installing only twine should be significantly faster. This also scales better, since this job will run for every package on each pull request.
.circleci/config.yml
Outdated
| - run: | ||
| name: Install System Dependencies | ||
| command: sudo apt-get update && sudo apt-get install -y libsndfile1 |
There was a problem hiding this comment.
| - run: | |
| name: Install System Dependencies | |
| command: sudo apt-get update && sudo apt-get install -y libsndfile1 |
I think this is nor required here, isnt it?
| - test_source | ||
|
|
||
| - test_wheel: | ||
| matrix: |
There was a problem hiding this comment.
to reduce redandency we could also jsut run test_wheel on main and develop and not for each pull in a pr
There was a problem hiding this comment.
I'll update that at the end, to make sure it still triggers as long as work on this PR is ongoing
Which issue(s) are closed by this pull request?
Closes #309
Changes proposed in this pull request:
Note: tests are expected to fail, since this PR helps to detect issues such as reported in #308, see #309 for further info.