Skip to content

Commit 40a595b

Browse files
committed
fix: change manifest priority for uv workflow
1 parent 1d8c992 commit 40a595b

2 files changed

Lines changed: 10 additions & 8 deletions

File tree

aws_lambda_builders/workflows/python_uv/utils.py

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -37,20 +37,17 @@ def detect_uv_manifest(source_dir: str) -> Optional[str]:
3737
3838
Note: uv.lock is NOT a manifest - it's a lock file that accompanies pyproject.toml.
3939
UV workflows support these manifest types:
40-
1. pyproject.toml (preferred) - may have accompanying uv.lock
41-
2. requirements.txt and variants - traditional pip-style manifests
40+
1. requirements.txt and variants - traditional pip-style manifests
41+
2. pyproject.toml (preferred) - may have accompanying uv.lock
42+
43+
We favor requirements.txt because it is possible to have both, but the pyproject could just be project metadata.
4244
4345
Args:
4446
source_dir: Directory to search for manifest files
4547
4648
Returns:
4749
Path to the detected manifest file, or None if not found
4850
"""
49-
# Check for pyproject.toml first (preferred manifest)
50-
pyproject_path = os.path.join(source_dir, "pyproject.toml")
51-
if os.path.isfile(pyproject_path):
52-
return pyproject_path
53-
5451
# Check for requirements.txt variants (in order of preference)
5552
requirements_variants = [
5653
"requirements.txt",
@@ -64,6 +61,11 @@ def detect_uv_manifest(source_dir: str) -> Optional[str]:
6461
if os.path.isfile(requirements_path):
6562
return requirements_path
6663

64+
# Check for pyproject.toml first (preferred manifest)
65+
pyproject_path = os.path.join(source_dir, "pyproject.toml")
66+
if os.path.isfile(pyproject_path):
67+
return pyproject_path
68+
6769
return None
6870

6971

tests/unit/workflows/python_uv/test_utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ def test_detect_uv_manifest_pyproject_priority(self):
7373

7474
result = detect_uv_manifest(temp_dir)
7575
# pyproject.toml should have priority over requirements.txt
76-
self.assertEqual(result, pyproject_path)
76+
self.assertEqual(result, req_path)
7777

7878
def test_detect_uv_manifest_requirements_variants(self):
7979
with tempfile.TemporaryDirectory() as temp_dir:

0 commit comments

Comments
 (0)