-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
14 changed files
with
2,561 additions
and
4,424 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
_commit: v1.1.0 | ||
_src_path: gh:superlinear-ai/substrate | ||
author_email: [email protected] | ||
author_name: Laurent Sorber | ||
project_description: A Python package that adds conformal prediction of coherent quantiles | ||
and intervals to any scikit-learn regressor or Darts forecaster. | ||
project_name: Conformal Tights | ||
project_type: package | ||
project_url: https://github.com/superlinear-ai/conformal-tights | ||
python_version: '3.10' | ||
typing: strict | ||
with_conventional_commits: true | ||
with_typer_cli: false |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,3 +3,6 @@ | |
|
||
# Git | ||
.git/ | ||
|
||
# Python | ||
.venv/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,101 +1,17 @@ | ||
# syntax=docker/dockerfile:1 | ||
ARG PYTHON_VERSION=3.10 | ||
FROM python:$PYTHON_VERSION-slim AS base | ||
FROM ghcr.io/astral-sh/uv:python3.10-bookworm AS dev | ||
|
||
# Remove docker-clean so we can keep the apt cache in Docker build cache. | ||
RUN rm /etc/apt/apt.conf.d/docker-clean | ||
# Create and activate a virtual environment [1]. | ||
# [1] https://docs.astral.sh/uv/concepts/projects/config/#project-environment-path | ||
ENV VIRTUAL_ENV=/opt/venv | ||
ENV PATH=$VIRTUAL_ENV/bin:$PATH | ||
ENV UV_PROJECT_ENVIRONMENT=$VIRTUAL_ENV | ||
|
||
# Configure Python to print tracebacks on crash [1], and to not buffer stdout and stderr [2]. | ||
# [1] https://docs.python.org/3/using/cmdline.html#envvar-PYTHONFAULTHANDLER | ||
# [2] https://docs.python.org/3/using/cmdline.html#envvar-PYTHONUNBUFFERED | ||
ENV PYTHONFAULTHANDLER 1 | ||
ENV PYTHONUNBUFFERED 1 | ||
|
||
# Create a non-root user and switch to it [1]. | ||
# [1] https://code.visualstudio.com/remote/advancedcontainers/add-nonroot-user | ||
ARG UID=1000 | ||
ARG GID=$UID | ||
RUN groupadd --gid $GID user && \ | ||
useradd --create-home --gid $GID --uid $UID user --no-log-init && \ | ||
chown user /opt/ | ||
USER user | ||
|
||
# Create and activate a virtual environment. | ||
ENV VIRTUAL_ENV /opt/conformal-tights-env | ||
ENV PATH $VIRTUAL_ENV/bin:$PATH | ||
RUN python -m venv $VIRTUAL_ENV | ||
|
||
# Set the working directory. | ||
WORKDIR /workspaces/conformal-tights/ | ||
|
||
|
||
|
||
FROM base AS poetry | ||
|
||
USER root | ||
|
||
# Install Poetry in separate venv so it doesn't pollute the main venv. | ||
ENV POETRY_VERSION 1.8.0 | ||
ENV POETRY_VIRTUAL_ENV /opt/poetry-env | ||
RUN --mount=type=cache,target=/root/.cache/pip/ \ | ||
python -m venv $POETRY_VIRTUAL_ENV && \ | ||
$POETRY_VIRTUAL_ENV/bin/pip install poetry~=$POETRY_VERSION && \ | ||
ln -s $POETRY_VIRTUAL_ENV/bin/poetry /usr/local/bin/poetry | ||
|
||
# Install compilers that may be required for certain packages or platforms. | ||
RUN --mount=type=cache,target=/var/cache/apt/ \ | ||
--mount=type=cache,target=/var/lib/apt/ \ | ||
apt-get update && \ | ||
apt-get install --no-install-recommends --yes build-essential | ||
|
||
USER user | ||
|
||
# Install the run time Python dependencies in the virtual environment. | ||
COPY --chown=user:user poetry.lock* pyproject.toml /workspaces/conformal-tights/ | ||
RUN mkdir -p /home/user/.cache/pypoetry/ && mkdir -p /home/user/.config/pypoetry/ && \ | ||
mkdir -p src/conformal_tights/ && touch src/conformal_tights/__init__.py && touch README.md | ||
RUN --mount=type=cache,uid=$UID,gid=$GID,target=/home/user/.cache/pypoetry/ \ | ||
poetry install --only main --all-extras --no-interaction | ||
|
||
|
||
|
||
FROM poetry AS dev | ||
|
||
# Install development tools: curl, git, gpg, ssh, starship, sudo, vim, and zsh. | ||
USER root | ||
RUN --mount=type=cache,target=/var/cache/apt/ \ | ||
--mount=type=cache,target=/var/lib/apt/ \ | ||
apt-get update && \ | ||
apt-get install --no-install-recommends --yes curl git gnupg ssh sudo vim zsh && \ | ||
sh -c "$(curl -fsSL https://starship.rs/install.sh)" -- "--yes" && \ | ||
usermod --shell /usr/bin/zsh user && \ | ||
echo 'user ALL=(root) NOPASSWD:ALL' > /etc/sudoers.d/user && chmod 0440 /etc/sudoers.d/user | ||
# Tell Git that the workspace is safe to avoid 'detected dubious ownership in repository' warnings. | ||
RUN git config --system --add safe.directory '*' | ||
USER user | ||
|
||
# Install the development Python dependencies in the virtual environment. | ||
RUN --mount=type=cache,uid=$UID,gid=$GID,target=/home/user/.cache/pypoetry/ \ | ||
poetry install --all-extras --no-interaction | ||
|
||
# Persist output generated during docker build so that we can restore it in the dev container. | ||
COPY --chown=user:user .pre-commit-config.yaml /workspaces/conformal-tights/ | ||
RUN mkdir -p /opt/build/poetry/ && cp poetry.lock /opt/build/poetry/ && \ | ||
git init && pre-commit install --install-hooks && \ | ||
mkdir -p /opt/build/git/ && cp .git/hooks/commit-msg .git/hooks/pre-commit /opt/build/git/ | ||
|
||
# Configure the non-root user's shell. | ||
ENV ANTIDOTE_VERSION 1.8.6 | ||
RUN git clone --branch v$ANTIDOTE_VERSION --depth=1 https://github.com/mattmc3/antidote.git ~/.antidote/ && \ | ||
echo 'zsh-users/zsh-syntax-highlighting' >> ~/.zsh_plugins.txt && \ | ||
echo 'zsh-users/zsh-autosuggestions' >> ~/.zsh_plugins.txt && \ | ||
echo 'source ~/.antidote/antidote.zsh' >> ~/.zshrc && \ | ||
echo 'antidote load' >> ~/.zshrc && \ | ||
echo 'eval "$(starship init zsh)"' >> ~/.zshrc && \ | ||
echo 'HISTFILE=~/.history/.zsh_history' >> ~/.zshrc && \ | ||
echo 'HISTSIZE=1000' >> ~/.zshrc && \ | ||
echo 'SAVEHIST=1000' >> ~/.zshrc && \ | ||
echo 'setopt share_history' >> ~/.zshrc && \ | ||
echo 'bindkey "^[[A" history-beginning-search-backward' >> ~/.zshrc && \ | ||
echo 'bindkey "^[[B" history-beginning-search-forward' >> ~/.zshrc && \ | ||
mkdir ~/.history/ && \ | ||
zsh -c 'source ~/.zshrc' | ||
# Configure the user's shell. | ||
RUN echo 'HISTFILE=~/.history/.bash_history' >> ~/.bashrc && \ | ||
echo 'bind "\"\e[A\": history-search-backward"' >> ~/.bashrc && \ | ||
echo 'bind "\"\e[B\": history-search-forward"' >> ~/.bashrc && \ | ||
mkdir ~/.history/ |
Oops, something went wrong.