Modernize setup, switch to Python 3.12, and migrate to uv

PiperOrigin-RevId: 856564478
Change-Id: I31af1c170846fb787235dfc03b3a6da0464f51be
This commit is contained in:
Augustin Zidek
2026-01-15 02:13:49 -08:00
committed by Copybara-Service
parent 2f40800a3a
commit 8d37fc1cb9
6 changed files with 2786 additions and 5381 deletions

View File

@@ -1,7 +1,6 @@
name: Continuous Integration
on:
# Trigger the workflow on push or pull request, only on the main branch.
push:
branches:
- main
@@ -18,21 +17,28 @@ jobs:
matrix:
include:
- name-prefix: "all tests"
python-version: '3.11'
python-version: '3.12'
os: ubuntu-latest
steps:
- uses: actions/checkout@v6
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v6
- name: Set up uv
uses: astral-sh/setup-uv@v7
with:
python-version: ${{ matrix.python-version }}
enable-cache: true
cache-dependency-glob: "uv.lock"
- name: Set up Python ${{ matrix.python-version }}
run: uv python install ${{ matrix.python-version }}
- name: Install dependencies
run: |
sudo apt-get install -y hmmer
pip install --upgrade pip
pip install -r dev-requirements.txt
pip install --no-deps .
build_data
run: sudo apt-get install -y hmmer
- name: Install Python dependencies
run: uv sync --frozen --all-groups
- name: Build data
run: uv run build_data
- name: Run CPU-only tests
run: |
python run_alphafold_data_test.py
run: uv run python run_alphafold_data_test.py

File diff suppressed because it is too large Load Diff

View File

@@ -16,17 +16,21 @@ FROM nvidia/cuda:12.6.3-base-ubuntu24.04
# * gcc, g++, make are required for compiling HMMER and AlphaFold 3 libaries.
# * zlib is a required dependency of AlphaFold 3.
RUN DEBIAN_FRONTEND=noninteractive \
apt-get update --quiet \
&& apt-get install --yes --quiet python3.12 python3-pip python3.12-venv python3.12-dev \
&& apt-get install --yes --quiet git wget gcc g++ make zlib1g-dev zstd
apt-get update --quiet \
&& apt-get install --yes --quiet python3.12 python3.12-dev \
&& apt-get install --yes --quiet git wget gcc g++ make zlib1g-dev zstd
# Install uv from the official repository. The version is pinned for
# reproducibility.
COPY --from=ghcr.io/astral-sh/uv:0.9.24 /uv /uvx /bin/
# UV_COMPILE_BYTECODE=1 speeds up future container starts.
# UV_PROJECT_ENVIRONMENT explicitly sets the virtual environment location.
ENV UV_COMPILE_BYTECODE=1
ENV UV_PROJECT_ENVIRONMENT=/alphafold3_venv
RUN uv venv $UV_PROJECT_ENVIRONMENT
# The base image uses Python 3.12. For local installation use 3.11 or greater.
RUN python3 -m venv /alphafold3_venv
ENV PATH="/hmmer/bin:/alphafold3_venv/bin:$PATH"
# Update pip to the latest version. Not necessary in Docker, but good to do when
# this is used as a recipe for local installation since we rely on new pip
# features for secure installs.
RUN pip3 install --no-cache-dir --upgrade pip
# Install HMMER. Do so before copying the source code, so that docker can cache
# the image layer containing HMMER. Alternatively, you could also install it
@@ -58,13 +62,18 @@ RUN (cd /hmmer_build/hmmer-3.4 && ./configure --prefix /hmmer) ; \
COPY . /app/alphafold
WORKDIR /app/alphafold
# Install setuptools (removed in Python 3.12) which some libraries still need.
# Then install the Python dependencies of AlphaFold 3.
RUN pip3 install --no-cache-dir setuptools \
&& pip3 install --no-cache-dir -r dev-requirements.txt \
&& pip3 install --no-cache-dir --no-deps .
# Build chemical components database (this binary was installed by pip).
RUN build_data
# Install the exact dependency tree using uv and cache the build artifacts.
# --frozen: do not update the lockfile during build.
# --all-groups: install development/test dependencies defined in pyproject.toml.
# --no-editable: install as a static package.
# If using this as a recipe for local installation and you want to modify
# AlphaFold 3 code and change its dependencies, remove the --frozen and
# --no-editable flags.
RUN --mount=type=cache,target=/root/.cache/uv \
uv sync --frozen --all-groups --no-editable
# Build chemical components database (this binary was installed by uv sync).
RUN uv run build_data
# To work around a known XLA issue causing the compilation time to greatly
# increase, the following environment variable setting XLA flags must be enabled
@@ -77,4 +86,4 @@ ENV XLA_FLAGS="--xla_gpu_enable_triton_gemm=false"
ENV XLA_PYTHON_CLIENT_PREALLOCATE=true
ENV XLA_CLIENT_MEM_FRACTION=0.95
CMD ["python3", "run_alphafold.py"]
CMD ["uv", "run", "python3", "run_alphafold.py"]

View File

@@ -11,7 +11,7 @@ build-backend = "scikit_build_core.build"
[project]
name = "alphafold3"
version = "3.0.1"
requires-python = ">=3.11"
requires-python = ">=3.12"
readme = "README.md"
license = {file = "LICENSE"}
dependencies = [
@@ -27,8 +27,13 @@ dependencies = [
"zstandard",
]
[project.optional-dependencies]
test = ["pytest>=6.0"]
[dependency-groups]
dev = [
"pytest>=6.0",
]
[tool.uv]
package = true
[tool.scikit-build]
wheel.exclude = [

File diff suppressed because it is too large Load Diff

2733
uv.lock generated Normal file

File diff suppressed because it is too large Load Diff