Skip to content
Open
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
Original file line number Diff line number Diff line change
@@ -0,0 +1,146 @@
# Exclude files from Docker build context. This prevents unnecessary files from
# being sent to Docker daemon, reducing build time and image size.

# Python artifacts
__pycache__/
*.pyc
*.pyo
*.pyd
*.egg-info/

# Virtual environments
venv/
.venv/
env/
.env
.envrc
client_venv.helpers/
ENV/

# Jupyter
.ipynb_checkpoints/
.jupyter/

# Build artifacts
build/
dist/
*.eggs/
.eggs/

# Cache and temporary files
*.log
*.tmp
*.cache
.pytest_cache/
.mypy_cache/
.coverage
htmlcov/

# Git and version control
.git/
.gitignore
.gitattributes
.github/

# Docker build scripts (not needed at runtime)
docker_build.sh
docker_push.sh
docker_clean.sh
docker_exec.sh
docker_cmd.sh
docker_bash.sh
docker_jupyter.sh
docker_name.sh
run_jupyter.sh
Dockerfile.*
.dockerignore

# Documentation
docker_scripts.README.md
README.admin.md
docs/
*.md
CHANGELOG.md
LICENSE

# Configuration and secrets
.env.*
.env.local
.env.development
.env.production
.DS_Store
Thumbs.db

# Shell configuration
.bashrc
.bash_history
.zshrc

# Large data files (mount via volume instead)
data/
*.csv
*.pkl
*.h5
*.parquet
*.feather
*.arrow
*.npy
*.npz

# Generated images
*.png
*.jpg
*.jpeg
*.gif
*.svg
*.pdf

# Test files and examples
tests/
test_*
*_test.py
tutorials/
examples/

# IDE and editor files
.vscode/
.idea/
*.swp
*.swo
*~
.project
.pydevproject
.settings/
*.iml
.sublime-project
.sublime-workspace

# Node and frontend (if applicable)
node_modules/
npm-debug.log
yarn-error.log
.npm

# Requirements management
requirements.in
Pipfile
Pipfile.lock
poetry.lock
setup.py
setup.cfg

# CI/CD configuration
.gitlab-ci.yml
.travis.yml
Jenkinsfile
.circleci/

# Miscellaneous
*.bak
.venv.bak/
*.whl
*.tar.gz
*.zip

# Data (large; mounted at run time, not baked into the image)
data/
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Downloaded and generated data must not be committed (see GP note 6).
data/
Original file line number Diff line number Diff line change
@@ -0,0 +1,142 @@
# Copy one of the Dockerfile style and customize it.

# #############################################################################
# Python 3.12 slim (already has Python and pip).
# #############################################################################

FROM python:3.12-slim

# Avoid interactive prompts during apt operations.
ENV DEBIAN_FRONTEND=noninteractive

# Install CA certificates (needed for HTTPS), git, and basic build tools.
RUN apt-get update && apt-get install -y \
build-essential \
ca-certificates \
git \
graphviz \
&& rm -rf /var/lib/apt/lists/*

# The repo is mounted from the host with a different owner, so let git run on
# it (needed by `hintros.print_obj_info()` to link to the source code).
RUN git config --system --add safe.directory '*'

# Install project specific packages. Pin jupytext to avoid jitter in the
# notebook files due to changing version. Pin ipykernel below 7 since 7.3.0
# randomly stops answering execute requests, which hangs `jupyter nbconvert
# --execute` forever.
RUN mkdir -p /install
COPY requirements.txt /install/requirements.txt
RUN pip install --upgrade pip && \
pip install --no-cache-dir jupyterlab jupyterlab_vim "ipykernel<7" jupytext==1.19.3 -r /install/requirements.txt

# Config.
COPY etc_sudoers /install/
COPY etc_sudoers /etc/sudoers
COPY bashrc /root/.bashrc

# Report package versions.
COPY version.sh /install/
RUN /install/version.sh 2>&1 | tee version.log

# Jupyter.
EXPOSE 8888

# #############################################################################
# Ubuntu 24.04 + pip to install.
# #############################################################################

# FROM ubuntu:24.04
# ENV DEBIAN_FRONTEND noninteractive

# # Install system utilities and Python in a single layer.
# RUN apt-get update && \
# apt-get upgrade -y && \
# apt-get install -y --no-install-recommends \
# sudo \
# curl \
# git \
# build-essential \
# python3 \
# python3-pip \
# python3-dev \
# python3-venv \
# && rm -rf /var/lib/apt/lists/*

# # Create virtual environment.
# RUN python3 -m venv /opt/venv

# # Make the venv the default Python.
# ENV PATH="/opt/venv/bin:$PATH"

# # Install project specific packages.
# RUN mkdir /install
# COPY requirements.txt /install/requirements.txt
# RUN pip install --upgrade pip && \
# pip install --no-cache-dir jupyterlab jupyterlab_vim jupytext -r /install/requirements.txt

# # Config.
# COPY etc_sudoers /install/
# COPY etc_sudoers /etc/sudoers
# COPY bashrc /root/.bashrc

# # Report package versions.
# COPY version.sh /install/
# RUN /install/version.sh 2>&1 | tee version.log

# # Jupyter.
# EXPOSE 8888

# #############################################################################
# Ubuntu 24.04 + uv.
# #############################################################################

# FROM ubuntu:24.04
# ENV DEBIAN_FRONTEND noninteractive

# # Install system utilities and Python in a single layer.
# RUN apt-get update && \
# apt-get upgrade -y && \
# apt-get install -y --no-install-recommends \
# sudo \
# curl \
# git \
# build-essential \
# python3 \
# python3-pip \
# python3-dev \
# python3-venv \
# libgomp1 \
# g++ \
# && rm -rf /var/lib/apt/lists/*

# # Install uv for package management.
# RUN curl -LsSf https://astral.sh/uv/install.sh | sh
# ENV PATH="/root/.local/bin:$PATH"

# # Install project specific packages using uv.
# COPY pyproject.toml uv.lock /app/
# WORKDIR /app
# RUN uv sync
# ENV PATH="/app/.venv/bin:$PATH"

# # Install Jupyter.
# RUN pip install --upgrade pip && \
# pip install --no-cache-dir jupyterlab jupyterlab_vim jupytext

# # Copy project files.
# COPY . /app

# RUN mkdir /install

# # Config.
# COPY etc_sudoers /install/
# COPY etc_sudoers /etc/sudoers
# COPY bashrc /root/.bashrc

# # Report package versions.
# COPY version.sh /install/
# RUN /install/version.sh 2>&1 | tee version.log

# # Jupyter.
# EXPOSE 8888
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# Polars Tutorial: Pandas vs Polars on Crypto Trade Data

- Benchmark pandas and Polars on a month of Binance ETHUSDT trades (16.6M rows),
from simple filters to as-of joins, and process data larger than the memory
budget with the Polars streaming engine

## Quick Start

- From the root of the repository, go to this directory:
```bash
> cd class_project/msml610/Fall2026/projects/UmdTask751_MSML610_Fall2026_Polars_Pandas_vs_Polars_Benchmark_on_Crypto_Trade_Data
```
- Build the Docker image:
```bash
> ./docker_build.sh
```
- Start Jupyter in the container and open the notebooks in order:
```bash
> ./docker_jupyter.sh
```
1. [`polars.API.ipynb`](polars.API.ipynb): expressions, contexts, time-series
operations, lazy queries, streaming, and SQL on a toy table of 8 trades
2. [`polars.example.ipynb`](polars.example.ipynb): the benchmark, in 4 parts:
ingest, pandas hitting a 1 GB memory budget, 8 workloads on 1 to 7 days,
and the full month with Polars streaming
- The example notebook downloads about 400 MB from
[Binance public data](https://data.binance.vision/) into `data/` (not
committed) and then runs in a few minutes
- [`polars_utils.py`](polars_utils.py): the workloads in pandas and Polars, and
the helpers used by both notebooks
- For more information on the Docker build system refer to the
[Project template readme](/class_project/project_template/docker_scripts.README.md)
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
set -o vi
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
#!/bin/bash
# """
# This script launches a Docker container with an interactive bash shell for
# development.
# """

# Exit immediately if any command exits with a non-zero status.
set -e

# Import the utility functions from the project template.
GIT_ROOT=$(git rev-parse --show-toplevel)
source $GIT_ROOT/class_project/project_template/utils.sh

# Parse default args (-h, -v) and enable set -x if -v is passed.
parse_default_args "$@"

# Load Docker configuration variables for this script.
get_docker_vars_script ${BASH_SOURCE[0]}
source $DOCKER_NAME
print_docker_vars

# List the available Docker images matching the expected image name.
DOCKER_CMD=$(get_docker_cmd)
run "$DOCKER_CMD image ls | grep '$FULL_IMAGE_NAME' || true"

# Configure and run the Docker container with interactive bash shell.
# - Container is removed automatically on exit (--rm)
# - Interactive mode with TTY allocation (-ti)
# - Port forwarding for Jupyter or other services
# - Git root mounted to /git_root inside container
CONTAINER_NAME="${IMAGE_NAME}.bash"
PORT=
DOCKER_CMD=$(get_docker_bash_command)
DOCKER_CMD_OPTS=$(get_docker_bash_options $CONTAINER_NAME $PORT)
# Remove a stale container from an interrupted run and clean up on exit.
kill_existing_container
cleanup_container_on_exit
run "$DOCKER_CMD $DOCKER_CMD_OPTS $FULL_IMAGE_NAME bash"
Loading