File tree Expand file tree Collapse file tree 4 files changed +16
-29
lines changed Expand file tree Collapse file tree 4 files changed +16
-29
lines changed Original file line number Diff line number Diff line change 80
80
- name : Install Python dependencies
81
81
run : |
82
82
pipx install --python ${{ matrix.python-version }} poetry
83
+ # This forces poetry to use specific Python version when installing a project.
84
+ # Raises error, if this Python version does not match project specific Python constraints.
85
+ poetry config virtualenvs.use-poetry-python true
86
+ poetry env use ${{ matrix.python-version }}
83
87
make install-dev
84
88
85
89
- name : Run integration tests
Original file line number Diff line number Diff line change 23
23
- name : Install Python dependencies
24
24
run : |
25
25
pipx install --python ${{ matrix.python-version }} poetry
26
+ # This forces poetry to use specific Python version when installing a project.
27
+ # Raises error, if this Python version does not match project specific Python constraints.
28
+ poetry config virtualenvs.use-poetry-python true
29
+ poetry env use ${{ matrix.python-version }}
26
30
make install-dev
27
31
28
32
- name : Run lint check
Original file line number Diff line number Diff line change 23
23
- name : Install Python dependencies
24
24
run : |
25
25
pipx install --python ${{ matrix.python-version }} poetry
26
+ # This forces poetry to use specific Python version when installing a project.
27
+ # Raises error, if this Python version does not match project specific Python constraints.
28
+ poetry config virtualenvs.use-poetry-python true
29
+ poetry env use ${{ matrix.python-version }}
26
30
make install-dev
27
31
28
32
- name : Run type check
Original file line number Diff line number Diff line change @@ -32,38 +32,13 @@ jobs:
32
32
run : |
33
33
pip install poetry
34
34
35
- - name : Check Python version against project requirements
36
- shell : python
37
- run : |
38
- import sys
39
- from contextlib import suppress
40
- from poetry.core.constraints.version import parse_constraint
41
-
42
- try:
43
- import tomllib
44
- except ImportError:
45
- import tomli as tomllib
46
-
47
- config = tomllib.load(open('pyproject.toml', 'rb'))
48
- constraints = []
49
-
50
- with suppress(KeyError):
51
- constraints.append(parse_constraint(config['tool']['poetry']['dependencies']['python']))
52
- with suppress(KeyError):
53
- constraints.append(parse_constraint(config['project']['requires-python']))
54
-
55
- python_version = parse_constraint('${{ matrix.python-version }}')
56
- if not all(con.allows(python_version) for con in constraints):
57
- print(f'Python version {str(python_version)} is not allowed by project settings', file=sys.stderr)
58
- sys.exit(1)
59
-
60
- - name : Uninstall global poetry again
61
- run : |
62
- pip uninstall -y poetry
63
-
64
35
- name : Install Python dependencies
65
36
run : |
66
37
pipx install --python ${{ matrix.python-version }} poetry
38
+ # This forces poetry to use specific Python version when installing a project.
39
+ # Raises error, if this Python version does not match project specific Python constraints.
40
+ poetry config virtualenvs.use-poetry-python true
41
+ poetry env use ${{ matrix.python-version }}
67
42
make install-dev
68
43
69
44
- name : Run unit tests
You can’t perform that action at this time.
0 commit comments