Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 2 additions & 14 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,25 +4,13 @@ on:
push
jobs:
python_test_and_coverage:
name: Run Python tests (${{ matrix.os }})
runs-on: ${{ matrix.os }}
strategy:
matrix:
# os: [macos-latest] # ubuntu-latest should be included once C++ dependencies are fixed
os: [ubuntu-latest] # ubuntu-latest should be included once C++ dependencies are fixed
name: Run Python tests
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Install Flox
uses: flox/install-flox-action@v2
# - name: Install libstdc++
# run: |
# sudo apt-get update
# sudo apt-get install -y lib32stdc++6
- name: Install Python dependencies
uses: flox/activate-action@v1
with:
command: mise tasks run python:install
- name: Run unit tests with coverage
uses: flox/activate-action@v1
with:
Expand Down
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,7 @@
.python_coverage.*
__pycache__/
infrastructure/Pulumi.infrastructure.yaml
.coverage*
.coverage/
coverage.xml
.python_coverage.xml
20 changes: 2 additions & 18 deletions .mise.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tasks."python:install"]
description = "Install Python dependencies"
run = "uv sync --all-packages"
run = "uv sync --all-groups"

[tasks."python:format"]
description = "Format Python code"
Expand All @@ -27,23 +27,7 @@ ruff check \

[tasks."python:test"]
description = "Run Python tests"
run = """
uv run coverage run \
--parallel-mode \
--omit '*/__init__.py,**/test_*.py' \
--data-file .python_coverage.output \
--module pytest

uv run coverage combine \
--data-file .python_coverage.output

uv run coverage report \
--data-file .python_coverage.output

uv run coverage xml \
--data-file .python_coverage.output \
-o .python_coverage.xml
"""
run = "docker compose run tests"

[tasks."application:service:build"]
description = "Build the application service"
Expand Down
9 changes: 9 additions & 0 deletions Dockerfile.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
FROM python:3.13
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is version 3.13 whereas you've set the pyproject.toml to 3.12. Intentional?

COPY --from=ghcr.io/astral-sh/uv:latest /uv /bin/uv
Comment thread
chrisaddy marked this conversation as resolved.

ENV PYTEST_ADDOPTS="--rootdir=/tests"

WORKDIR /tests

COPY pyproject.toml uv.lock .
Comment thread
chrisaddy marked this conversation as resolved.
RUN uv sync --all-groups
14 changes: 7 additions & 7 deletions application/datamanager/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
FROM python:3.13-slim

COPY --from=ghcr.io/astral-sh/uv:latest /uv /bin/uv

ENV PYTHONPATH=/app/src

RUN apt-get update && \
apt-get install -y --no-install-recommends libgomp1 \
apt-get install -y --no-install-recommends libgomp1 curl \
&& rm -rf /var/lib/apt/lists/*

WORKDIR /app

COPY pyproject.toml ./
RUN uv sync --no-dev

COPY application/datamanager/ ./application/datamanager/

RUN uv sync --all-packages
COPY ./src ./src

EXPOSE 8000
EXPOSE 8080

ENTRYPOINT ["uv", "run", "uvicorn", "application.datamanager.src.datamanager.main:application", "--host", "0.0.0.0", "--port", "8080"]
ENTRYPOINT ["uv", "run", "uvicorn", "datamanager.main:application", "--host", "0.0.0.0", "--port", "8080", "--app-dir", "src"]
3 changes: 2 additions & 1 deletion application/datamanager/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,14 @@
name = "datamanager"
version = "0.1.0"
description = "Data management service"
requires-python = ">=3.13"
requires-python = ">=3.12"
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues just checking we're okay downgrading to 3.12.

dependencies = [
"fastapi>=0.115.12",
"uvicorn>=0.34.2",
"duckdb>=1.2.2",
"polars>=1.29.0",
"pyarrow>=20.0.0",
"datamanager"
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this actually needed now?

]

[tool.hatch.build.targets.wheel]
Expand Down
12 changes: 6 additions & 6 deletions application/positionmanager/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
FROM python:3.13-slim

FROM python:3.13
COPY --from=ghcr.io/astral-sh/uv:latest /uv /bin/uv

ENV PYTHONPATH=/app/src

WORKDIR /app

COPY pyproject.toml ./
RUN uv sync --no-dev

COPY application/positionmanager/ ./application/positionmanager/

RUN uv sync --all-packages
COPY ./src ./src

EXPOSE 8080

ENTRYPOINT ["uv", "run", "uvicorn", "application.positionmanager.src.positionmanager.main:application", "--host", "0.0.0.0", "--port", "8080"]
ENTRYPOINT ["uv", "run", "uvicorn", "positionmanager.main:application", "--host", "0.0.0.0", "--port", "8080", "--app-dir", "src"]
16 changes: 16 additions & 0 deletions compose.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removing leading empty line.

services:
tests:
build:
context: .
dockerfile: Dockerfile.test
volumes:
- .:/tests
command:
- /bin/sh
- -euxc
- |
uv run coverage run --parallel-mode -m pytest && \
uv run coverage combine && \
uv run coverage report && \
uv run coverage xml
37 changes: 34 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,9 @@
name = "pocketsizefund"
version = "0.1.0"
description = "Open source quantitative hedge fund 🍊"
requires-python = ">=3.13"
requires-python = ">=3.12"
Comment thread
chrisaddy marked this conversation as resolved.
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same question.

dependencies = [
"pytest>=8.3.5",
"httpx>=0.28.1",
"coverage>=7.6.1",
]

[tool.uv.workspace]
Expand All @@ -26,3 +24,36 @@ packages = ["pocketsizefund"]
[build-system]
requires = ["hatchling"]
build-backend = "hatchling.build"

[dependency-groups]
dev = [
"alpaca-py>=0.40.1",
"coverage>=7.8.0",
"duckdb>=1.2.2",
"ecos>=2.0.14",
"fastapi>=0.115.12",
"polars>=1.29.0",
"pyarrow>=20.0.0",
"pyportfolioopt>=1.5.6",
"pytest>=8.3.5",
"requests>=2.32.3",
]


[tool.pytest.ini_options]
testpaths = [
"/tests/",
"application/datamanager/tests",
"application/positionmanager/tests",
]

[tool.coverage.run]
parallel = true
omit = ["*/__init__.py", "**/test_*.py"]

[tool.coverage.report]
show_missing = true
skip_covered = true

[tool.coverage.xml]
output = ".python_coverage.xml"
67 changes: 30 additions & 37 deletions uv.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.