Skip to content

Commit c0e42d2

Browse files
committed
Migrate refactor of catalog to rust
wip
1 parent 8083561 commit c0e42d2

File tree

61 files changed

+8489
-1403
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

61 files changed

+8489
-1403
lines changed

.docker/DockerfileUbuntu

Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
# Dockerfile to reproduce locally an environment similar to what is run on the github runner
2+
#
3+
# From nautilus' MAIN directory:
4+
#
5+
# Build the image:
6+
# docker build -f .docker/DockerfileUbuntu -t nautilus-dev .
7+
#
8+
# Run interactively with local directory mounted:
9+
# docker run -it --rm -v "$(pwd)":/workspace nautilus-dev bash
10+
#
11+
# Or run the default entrypoint:
12+
# docker run --rm -v "$(pwd)":/workspace nautilus-dev
13+
#
14+
# Remove the image
15+
# docker image rm nautilus-dev
16+
17+
FROM ubuntu:22.04
18+
19+
# Set environment variables
20+
ENV DEBIAN_FRONTEND=noninteractive
21+
ENV BUILD_MODE=release
22+
ENV RUST_BACKTRACE=1
23+
ENV CARGO_INCREMENTAL=1
24+
ENV CC="clang"
25+
ENV CXX="clang++"
26+
27+
# Install system dependencies
28+
RUN apt-get update && apt-get install -y \
29+
curl \
30+
clang \
31+
git \
32+
libssl-dev \
33+
libssl3 \
34+
pkg-config \
35+
make \
36+
capnproto \
37+
libcapnp-dev \
38+
gcc-aarch64-linux-gnu \
39+
&& rm -rf /var/lib/apt/lists/*
40+
41+
# Install Rust
42+
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --default-toolchain stable
43+
ENV PATH="/root/.cargo/bin:${PATH}"
44+
45+
# Install mold linker
46+
RUN curl -L https://github.com/rui314/mold/releases/download/v2.35.1/mold-2.35.1-x86_64-linux.tar.gz | tar -xz -C /usr/local --strip-components=1
47+
48+
# Install uv
49+
RUN curl -LsSf https://astral.sh/uv/install.sh | sh
50+
ENV PATH="/root/.cargo/bin:/root/.local/bin:${PATH}"
51+
52+
# Install Python 3.13
53+
RUN uv python install
54+
55+
# Set working directory
56+
WORKDIR /workspace
57+
58+
# Copy only necessary files for dependency setup
59+
# The actual source code will be mounted as a volume
60+
COPY ../scripts/rust-toolchain.sh scripts/
61+
COPY ../Cargo.toml Cargo.lock pyproject.toml rust-toolchain.toml ./
62+
63+
# Set up Rust toolchain based on project requirements
64+
RUN bash scripts/rust-toolchain.sh > /tmp/toolchain.txt && \
65+
TOOLCHAIN=$(cat /tmp/toolchain.txt) && \
66+
rustup toolchain install $TOOLCHAIN && \
67+
rustup default $TOOLCHAIN && \
68+
rustup component add clippy rustfmt
69+
70+
# Create entrypoint script for interactive development
71+
RUN echo '#!/bin/bash\n\
72+
set -e\n\
73+
echo "=== Nautilus Trader Development Environment ==="\n\
74+
echo "Python version: $(python --version)"\n\
75+
echo "Rust version: $(rustc --version)"\n\
76+
echo "UV version: $(uv --version)"\n\
77+
echo "Working directory: $(pwd)"\n\
78+
echo\n\
79+
echo "=== Setting PyO3 environment ==="\n\
80+
export PYO3_PYTHON=/workspace/.venv/bin/python3\n\
81+
echo "PYO3_PYTHON: $PYO3_PYTHON"\n\
82+
echo\n\
83+
echo "=== Development environment ready! ==="\n\
84+
echo "You can now run for example:"\n\
85+
echo " make install-debug # Install nautilus in debug mode"\n\
86+
echo " make cargo-test # Test Rust code"\n\
87+
echo " make pytest # Run Python tests"\n\
88+
echo " uv run python -c \"import nautilus_trader.backtest.engine;\" # Run a Python instruction"\n\
89+
echo\n\
90+
# If no command is provided, start an interactive bash shell\n\
91+
if [ $# -eq 0 ]; then\n\
92+
exec bash -i\n\
93+
else\n\
94+
exec "$@"\n\
95+
fi\n\
96+
' > /entrypoint.sh && chmod +x /entrypoint.sh
97+
98+
ENTRYPOINT ["/entrypoint.sh"]

0 commit comments

Comments
 (0)