Repository navigation
Conversation
|
A PR has been generated to the instance repo: You can check out the PR to preview your changes |
| run: uvx hatch test --cover --python ${{ matrix.python }} --include deps=${{ matrix.deps }} | ||
| - name: generate coverage report | ||
| run: uvx hatch run hatch-test.py${{ matrix.python }}:coverage xml | ||
| run: uvx hatch run hatch-test.py${{ matrix.python }}-${{ matrix.deps }}:coverage xml |
There was a problem hiding this comment.
Is there a better way to get the env name? Basically this action breaks whenever someone makes changes to the test matrix in pyproject.toml.
The alternative would be to just run uvx coverage, but @flying-sheep you had concerns about edge cases where that could break?
There was a problem hiding this comment.
-
HATCH_ENV, but idk if that also makeshatch testselect this one -
The
+selection syntax, maybe like this? I’d try locally first thoughSuggested changerun: uvx hatch run hatch-test.py${{ matrix.python }}-${{ matrix.deps }}:coverage xml run: uvx hatch run +py=${{ matrix.python }} +deps=${{ matrix.deps }} hatch-test:coverage xml
There was a problem hiding this comment.
This fails for me with Variable selection is unsupported for non-matrix environments: hatch-test
There was a problem hiding this comment.
I think #390 is the most elegant way here anyway.
hatch env create ${{ matrix.env_name }}
hatch run ${{ matrix.env_name }}:run-cov
hatch run ${{ matrix.env_name }}:coverage xml|
|
||
| [[tool.hatch.envs.hatch-test.matrix]] | ||
| deps = [ "stable", "pre" ] | ||
| python = [ "3.10", "3.13" ] |
There was a problem hiding this comment.
I had the impression that when overriding the default matrix, I also need to manually specify which python versions to test here.
There was a problem hiding this comment.
Right now we are only testing pre-release deps for the latest python. This matrix would test it for any python specified.
Is this what we want, or is there a way to keep the current behaviour with hatch?
There was a problem hiding this comment.
I think the current behavior is sufficient. The idea is that we’re testing the bleeding edge, and one job is sufficient for that.
There was a problem hiding this comment.
ok, do you know how to set that up using the hatch-test.matrix?
There was a problem hiding this comment.
I asked people on discord to please answer this: pypa/hatch#1923
There was a problem hiding this comment.
I couldn't make it work, see also my comment in the discussion! If you have an idea, please go for it!
There was a problem hiding this comment.
… and 15 minutes after this comment, ofek solved it:
[[tool.hatch.envs.hatch-test.matrix]]
deps = ["stable", "pre"]
python = ["3.13"]
[[tool.hatch.envs.hatch-test.matrix]]
deps = ["stable"]
python = ["3.10", "3.11", "3.12"]
[tool.hatch.envs.hatch-test.overrides]
matrix.deps.env-vars = [
{ key = "UV_PRERELEASE", value = "allow", if = [ "pre" ] },
]| - os: ubuntu-latest | ||
| python: "3.10" | ||
| deps: stable | ||
| - os: ubuntu-latest | ||
| python: "3.12" | ||
| python: "3.13" | ||
| deps: stable | ||
| - os: ubuntu-latest | ||
| python: "3.12" | ||
| pip-flags: "--pre" | ||
| python: "3.13" | ||
| deps: pre | ||
| name: PRE-RELEASE DEPENDENCIES |
There was a problem hiding this comment.
To keep that in sync with pyproject.toml, maybe we could get this from hatch env show --json?
|
Not super happy with the changes. I feel things are getting complicated. Alternatively we could just set the |
I think the complexity matches exactly what we’re doing here. So for people who want to test with pre-releases, exposing all that makes sense.
Which would mean that we make things more complicated for users who see that job breaking and don’t know how run tests in an environment like that locally. So IMHO the question is: do we want users to have the pre-release job or not? If yes, as said, I feel like the configuration complexity matches the complexity of what’s being done, which isn’t a bad thing. |
Ideally, yes. It could be useful for debugging locally and apart from that I don't think there's any good reason for the CI doing different things than the local test job. |
|
Oh, I meant in general. I fully agree with what you said, so the only alternative to the complexity added here is not having pre-release jobs at all. |
|
Yeah, let's add it to hatch. |
|
Should we merge #390 first and then redo this PR based on it? |
|
Better to start from scratch |
Close #379