Open happz opened 1 year ago
@psss @martinhoyer FYI, I'll try to enforce Python 3.9+
Aha, might be my local system, with python3
being Python 3.8. I suppose forcing Python in pre-commit could break it for others, e.g. enforcing python3.9
when it's not installed on users' system...
@happz This is a pre-commit virtualenv, not hatch. This does not seem like a regression introduced by the packaging changes?
For what you're doing, check out matrix, like it's being used in test env:
[[tool.hatch.envs.test.matrix]]
python = ["3.9", "3.11"]
so if you add something like this there..
diff --git a/pyproject.toml b/pyproject.toml
index 18a95e0b..c246ec2f 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -139,6 +139,7 @@ description = "Testing environment"
system-packages = true # Install python3-nitrate to skip building psycopg2
dependencies = [
"pytest",
+ "typing-extensions>=4.4.0; python_version < '3.10'",
"python-coveralls",
"requre",
"yq==3.1.1",
@@ -161,6 +162,7 @@ requre = [
"pytest -vvv -ra --showlocals",
"requre-patch purge --replaces :milestone_url:str:SomeText --replaces :latency:float:0 tests/integration/test_data/test_nitrate/*",
]
+tmt-lint = "python3 -V; python3 -m tmt lint --failed-only"
(typing-extensions needed by pint on 3.9)
[mhoyer@x1 tmt]$ hatch run test:tmt-lint
──────────────────────────────────────────── test.py3.9 ────────────────────────────────────────────
Python 3.9.18
─────────────────────────────────────────── test.py3.11 ────────────────────────────────────────────
Python 3.11.5
Might be worth bumping the high version to 3.12 for F39 and add both to make develop
.
Yeah, this is indeed the virtualenv spawned by pre-commit
. I "resolved" this by getting rid of Python 3.8, but I wonder whether we can enforce pre-commit
to install a minimal Python version. IIUIC, we can't - we can ask it to install a specific Python version, but that will break down once it's missing on one's workstation, that's hardly an improvement...
I'm dropping this from 1.28, I'll let it open for a while, but I suspect no silver bullet to be readily available.
I think so, yeah. Only specific version can be specified, not minimal.
Not sure if using hatch envs in pre-commit is the way. Maybe.
Just realized this is probably was probably due to importlib_resources vs importlib.resources, i.e. we should use importlib_resources on Python 3.9, like in https://github.com/teemtee/tmt/pull/294
Looks like
importlib.resources
of unexpected version? Python version mismatch?files
is available since Python 3.9, what version ispre-commit
using?