PROSTLE commited on
Commit
f9ceb68
·
1 Parent(s): e7d92b2

fix: attain OpenEnv multi-mode compliance (server/app.py, uv.lock, dependencies)

Browse files
Files changed (6) hide show
  1. Dockerfile +12 -11
  2. backend/__init__.py +0 -0
  3. pyproject.toml +11 -2
  4. server/__init__.py +0 -0
  5. server/app.py +12 -0
  6. uv.lock +0 -0
Dockerfile CHANGED
@@ -16,25 +16,26 @@ RUN apt-get update && apt-get install -y \
16
  && rm -rf /var/lib/apt/lists/*
17
 
18
  # Install Python dependencies
19
- RUN pip install --no-cache-dir --upgrade pip
20
- COPY backend/requirements.txt /app/backend/requirements.txt
21
- RUN pip install --no-cache-dir -r /app/backend/requirements.txt
22
- # PyTroch CPU-only
23
- RUN pip install --no-cache-dir torch --index-url https://download.pytorch.org/whl/cpu
24
 
25
- # Download NLTK data (VADER lexicon) during build so we don't download at runtime
26
- RUN python -c "import nltk; nltk.download('vader_lexicon')"
 
 
 
27
 
28
  # Copy the code
29
  COPY backend/ /app/backend/
30
  COPY frontend/ /app/frontend/
 
31
  # Root-level entry points required by the OpenEnv grader
32
  COPY inference.py /app/inference.py
33
 
34
  # Expose the port
35
  EXPOSE 8000
36
 
37
- # Run the application
38
- # We use /app/backend as part of pythonpath to find modules
39
- ENV PYTHONPATH=/app/backend
40
- CMD ["uvicorn", "backend.app:app", "--host", "0.0.0.0", "--port", "8000"]
 
16
  && rm -rf /var/lib/apt/lists/*
17
 
18
  # Install Python dependencies
19
+ # Install Python dependencies using uv for reproducible builds
20
+ RUN curl -LsSf https://astral.sh/uv/install.sh | sh
21
+ ENV PATH="/root/.cargo/bin:${PATH}"
 
 
22
 
23
+ # Copy all metadata and manifests
24
+ COPY pyproject.toml uv.lock openenv.yaml ./
25
+
26
+ # Sync dependencies (this creates a .venv we'll use)
27
+ RUN uv sync --no-dev
28
 
29
  # Copy the code
30
  COPY backend/ /app/backend/
31
  COPY frontend/ /app/frontend/
32
+ COPY server/ /app/server/
33
  # Root-level entry points required by the OpenEnv grader
34
  COPY inference.py /app/inference.py
35
 
36
  # Expose the port
37
  EXPOSE 8000
38
 
39
+ # Run the application via the uv-managed server script
40
+ # This ensures all compliance checks (uv.lock, [project.scripts]) are utilized
41
+ CMD ["uv", "run", "server"]
 
backend/__init__.py ADDED
File without changes
pyproject.toml CHANGED
@@ -7,6 +7,7 @@ name = "stocksense-ai"
7
  version = "3.0.0"
8
  description = "Enterprise-grade AI trading engine for Indian markets (NSE/BSE)"
9
  readme = "README.md"
 
10
  authors = [{ name = "Prostle Team" }]
11
  dependencies = [
12
  "fastapi",
@@ -24,8 +25,16 @@ dependencies = [
24
  "nltk",
25
  "google-generativeai",
26
  "python-dotenv",
27
- "matplotlib"
 
 
28
  ]
29
 
 
 
 
 
 
 
30
  [tool.setuptools]
31
- packages = ["backend"]
 
7
  version = "3.0.0"
8
  description = "Enterprise-grade AI trading engine for Indian markets (NSE/BSE)"
9
  readme = "README.md"
10
+ requires-python = ">=3.10"
11
  authors = [{ name = "Prostle Team" }]
12
  dependencies = [
13
  "fastapi",
 
25
  "nltk",
26
  "google-generativeai",
27
  "python-dotenv",
28
+ "matplotlib",
29
+ "openenv-core>=0.2.0",
30
+ "torch>=2.11.0",
31
  ]
32
 
33
+ [project.scripts]
34
+ server = "server.app:app"
35
+
36
+ [[tool.uv.index]]
37
+ url = "https://download.pytorch.org/whl/cpu"
38
+
39
  [tool.setuptools]
40
+ packages = ["backend", "server"]
server/__init__.py ADDED
File without changes
server/app.py ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import sys
2
+ import os
3
+
4
+ # Ensure the root directory is in the path so we can find the 'backend' package
5
+ sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
6
+
7
+ from backend.app import app
8
+
9
+ # This entry point satisfies OpenEnv and uv requirements
10
+ if __name__ == "__main__":
11
+ import uvicorn
12
+ uvicorn.run(app, host="0.0.0.0", port=8000)
uv.lock ADDED
The diff for this file is too large to render. See raw diff