Skip to content

Commit 9c587ec

Browse files
Copilotpamelafox
andcommitted
Simplify to minimal uvicorn upgrade without [standard] extra to avoid Flask conflicts
Co-authored-by: pamelafox <297042+pamelafox@users.noreply.github.com>
1 parent f9b76d9 commit 9c587ec

File tree

2 files changed

+78
-6
lines changed

2 files changed

+78
-6
lines changed

src/requirements.txt

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,3 @@
11
fastapi==0.111.0
22
uvicorn==0.30.6
3-
uvloop>=0.15.0
4-
httptools>=0.4.0
5-
python-dotenv>=0.13.0
6-
pyyaml>=5.1
7-
watchfiles>=0.13
8-
websockets>=10.0
93
gunicorn==22.0.0

test_requirements.py

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
#!/usr/bin/env python3
2+
"""
3+
Test script to validate uvicorn upgrade requirements.
4+
Run this script to verify the dependency installation works.
5+
"""
6+
7+
import subprocess
8+
import sys
9+
import tempfile
10+
import os
11+
12+
def test_requirements_installation():
13+
"""Test if the updated requirements can be installed successfully."""
14+
print("Testing uvicorn upgrade requirements installation...")
15+
16+
# Create a temporary virtual environment
17+
with tempfile.TemporaryDirectory() as temp_dir:
18+
venv_path = os.path.join(temp_dir, "test_venv")
19+
20+
try:
21+
# Create virtual environment
22+
print("Creating test virtual environment...")
23+
subprocess.run([sys.executable, "-m", "venv", venv_path], check=True)
24+
25+
# Get pip path
26+
if os.name == "nt": # Windows
27+
pip_path = os.path.join(venv_path, "Scripts", "pip")
28+
python_path = os.path.join(venv_path, "Scripts", "python")
29+
else: # Unix/Linux/Mac
30+
pip_path = os.path.join(venv_path, "bin", "pip")
31+
python_path = os.path.join(venv_path, "bin", "python")
32+
33+
# Upgrade pip
34+
print("Upgrading pip...")
35+
subprocess.run([python_path, "-m", "pip", "install", "--upgrade", "pip"],
36+
check=True, capture_output=True)
37+
38+
# Install requirements
39+
print("Installing requirements...")
40+
subprocess.run([pip_path, "install", "-r", "src/requirements.txt"],
41+
check=True, capture_output=True)
42+
43+
# Test import
44+
print("Testing imports...")
45+
result = subprocess.run([
46+
python_path, "-c",
47+
"import fastapi; import uvicorn; import gunicorn; print('✓ All imports successful')"
48+
], capture_output=True, text=True)
49+
50+
if result.returncode == 0:
51+
print("✓ Requirements installation test PASSED")
52+
print(result.stdout)
53+
return True
54+
else:
55+
print("✗ Import test failed:")
56+
print(result.stderr)
57+
return False
58+
59+
except subprocess.CalledProcessError as e:
60+
print(f"✗ Installation failed: {e}")
61+
return False
62+
except Exception as e:
63+
print(f"✗ Unexpected error: {e}")
64+
return False
65+
66+
if __name__ == "__main__":
67+
print("=" * 50)
68+
print("Uvicorn Upgrade Requirements Test")
69+
print("=" * 50)
70+
71+
success = test_requirements_installation()
72+
73+
if success:
74+
print("\n✓ SUCCESS: Requirements can be installed without conflicts!")
75+
sys.exit(0)
76+
else:
77+
print("\n✗ FAILURE: Requirements installation failed!")
78+
sys.exit(1)

0 commit comments

Comments
 (0)