Skip to content

Commit 5ce9ee0

Browse files
authored
Detect required-version from config file (#233)
1. If defined use version input 2. If defined use uv-file input 3. If defined use pyproject-file input 4. Search for required-version in uv.toml in repo root 5. Search for required-version in pyproject.toml in repo root 6. Use latest Closes: #215
1 parent d577e74 commit 5ce9ee0

File tree

18 files changed

+2436
-19
lines changed

18 files changed

+2436
-19
lines changed

.github/workflows/test.yml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,39 @@ jobs:
6464
fi
6565
env:
6666
UV_VERSION: ${{ steps.setup-uv.outputs.uv-version }}
67+
test-pyproject-file-version:
68+
runs-on: ubuntu-latest
69+
steps:
70+
- uses: actions/checkout@v4
71+
- name: Install version 0.5.14
72+
id: setup-uv
73+
uses: ./
74+
with:
75+
pyproject-file: "__tests__/fixtures/pyproject-toml-project/pyproject.toml"
76+
- name: Correct version gets installed
77+
run: |
78+
if [ "$UV_VERSION" != "0.5.14" ]; then
79+
exit 1
80+
fi
81+
env:
82+
UV_VERSION: ${{ steps.setup-uv.outputs.uv-version }}
83+
test-uv-file-version:
84+
runs-on: ubuntu-latest
85+
steps:
86+
- uses: actions/checkout@v4
87+
- name: Install version 0.5.15
88+
id: setup-uv
89+
uses: ./
90+
with:
91+
pyproject-file: "__tests__/fixtures/uv-toml-project/pyproject.toml"
92+
uv-file: "__tests__/fixtures/uv-toml-project/uv.toml"
93+
- name: Correct version gets installed
94+
run: |
95+
if [ "$UV_VERSION" != "0.5.15" ]; then
96+
exit 1
97+
fi
98+
env:
99+
UV_VERSION: ${{ steps.setup-uv.outputs.uv-version }}
67100
test-checksum:
68101
runs-on: ${{ matrix.os }}
69102
strategy:
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
3.11

__tests__/fixtures/pyproject-toml-project/README.md

Whitespace-only changes.
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
def main():
2+
print("Hello from pyproject-toml-project!")
3+
4+
5+
if __name__ == "__main__":
6+
main()
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
[project]
2+
name = "pyproject-toml-project"
3+
version = "0.1.0"
4+
description = "Add your description here"
5+
readme = "README.md"
6+
requires-python = ">=3.11"
7+
dependencies = []
8+
9+
[tool.uv]
10+
required-version = "==0.5.14"
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
3.11

__tests__/fixtures/uv-toml-project/README.md

Whitespace-only changes.
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
def main():
2+
print("Hello from uv-toml-project!")
3+
4+
5+
if __name__ == "__main__":
6+
main()
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
[project]
2+
name = "uv-toml-project"
3+
version = "0.1.0"
4+
description = "Add your description here"
5+
readme = "README.md"
6+
requires-python = ">=3.11"
7+
dependencies = []
8+
9+
[tool.uv]
10+
required-version = "==0.5.14"
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
required-version = "==0.5.15"

0 commit comments

Comments
 (0)