Skip to content

Make Docker build and upload scripts runnable through pip#3359

Merged
copybara-service[bot] merged 1 commit intomainfrom
bvandermoon-docker-builds
Mar 11, 2026
Merged

Make Docker build and upload scripts runnable through pip#3359
copybara-service[bot] merged 1 commit intomainfrom
bvandermoon-docker-builds

Conversation

@bvandermoon
Copy link
Copy Markdown
Collaborator

@bvandermoon bvandermoon commented Mar 10, 2026

Description

  • Move the /dependencies directory to src/dependencies. This allows the docker build/upload scripts to be included in the pip package
  • Create Python wrappers over docker_build_dependency_image.sh and docker_upload_runner.sh
  • Create new scripts in pyproject.toml for these Python wrappers. This lets users run these scripts directly after pip installing MaxText

Next steps:

  • Add new installation option to pyproject.toml so users can run these scripts without installing unecessary dependencies
  • Update tutorials/docs that pip install maxtext to use the new script
  • We should probably convert the shell scripts to Python scripts to get rid of the Python wrappers in the long-term. This is lower priority right now

Note: This changes the location the script is run from. We will update existing references we find and notify as many users as we can

FIXES: b/490520594

Tests

Setup with uv pip install -e .[tpu] --resolution=lowest

Built stable image through pip script + bash:

docker_build_dependency_image
bash src/dependencies/scripts/docker_build_dependency_image.sh

Built nightly image:

docker_build_dependency_image MODE=nightly

Ran successful workload for both builds with:

python3 -m benchmarks.benchmark_runner xpk \
    --project=$PROJECT \
    --zone=$ZONE \
    --device_type=v6e-256 \
    --num_slices=1 \
    --cluster_name=${CLUSTER_NAME} \
    --base_output_directory=${OUTPUT_DIR} \
    --model_name="llama3_1_70b_8192" \
    --base_docker_image=maxtext_base_image \
    --priority=high
docker_upload_runner CLOUD_IMAGE_NAME=<cloud_image_name>

Checklist

Before submitting this PR, please make sure (put X in square brackets):

  • I have performed a self-review of my code. For an optional AI review, add the gemini-review label.
  • I have necessary comments in my code, particularly in hard-to-understand areas.
  • I have run end-to-end tests tests and provided workload links above if applicable.
  • I have made or will make corresponding changes to the doc if needed, including adding new documentation pages to the relevant Table of Contents (toctree directive) as explained in our documentation.

@codecov
Copy link
Copy Markdown

codecov Bot commented Mar 10, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@bvandermoon bvandermoon force-pushed the bvandermoon-docker-builds branch 3 times, most recently from d15b54b to 219cfc2 Compare March 10, 2026 23:13
@bvandermoon bvandermoon changed the title Move dependencies to src so we can build images through pip Make Docker build and upload scripts runnable through pip Mar 10, 2026
@bvandermoon bvandermoon force-pushed the bvandermoon-docker-builds branch from 219cfc2 to 4adb621 Compare March 11, 2026 00:56
Copy link
Copy Markdown
Collaborator

@richjames0 richjames0 left a comment

Choose a reason for hiding this comment

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

lgtm

@bvandermoon bvandermoon force-pushed the bvandermoon-docker-builds branch from 4adb621 to 9fa9e9c Compare March 11, 2026 18:04
@bvandermoon bvandermoon force-pushed the bvandermoon-docker-builds branch from 9fa9e9c to 6ad79a9 Compare March 11, 2026 18:11
bvandermoon added a commit that referenced this pull request Mar 11, 2026
Imported from GitHub PR #3359

# Description

* Move the `/dependencies` directory to `src/dependencies`. This allows the docker build/upload scripts to be included in the pip package
* Create Python wrappers over `docker_build_dependency_image.sh` and `docker_upload_runner.sh`
* Create new scripts in `pyproject.toml` for these Python wrappers. This lets users run these scripts directly after pip installing MaxText

Next steps:
* Add new installation option to `pyproject.toml` so users can run these scripts without installing unecessary dependencies
* Update tutorials/docs that pip install maxtext to use the new script
* We should probably convert the shell scripts to Python scripts to get rid of the Python wrappers in the long-term. This is lower priority right now

Note: This changes the location the script is run from. We will update existing references we find and notify as many users as we can

FIXES: b/490520594

# Tests

Setup with `uv pip install -e .[tpu] --resolution=lowest`

Built stable image through pip script + bash:
```
docker_build_dependency_image
bash src/dependencies/scripts/docker_build_dependency_image.sh
```

Built nightly image:
```
docker_build_dependency_image MODE=nightly
```

Ran successful workload for both builds with:
```
python3 -m benchmarks.benchmark_runner xpk \
    --project=$PROJECT \
    --zone=$ZONE \
    --device_type=v6e-256 \
    --num_slices=1 \
    --cluster_name=${CLUSTER_NAME} \
    --base_output_directory=${OUTPUT_DIR} \
    --model_name="llama3_1_70b_8192" \
    --base_docker_image=maxtext_base_image \
    --priority=high
```

```
docker_upload_runner CLOUD_IMAGE_NAME=<cloud_image_name>
```

# Checklist

Before submitting this PR, please make sure (put X in square brackets):
- [x] I have performed a self-review of my code. For an optional AI review, add the `gemini-review` label.
- [x] I have necessary comments in my code, particularly in hard-to-understand areas.
- [x] I have run end-to-end tests tests and provided workload links above if applicable.
- [x] I have made or will make corresponding changes to the doc if needed, including adding new documentation pages to the relevant Table of Contents (toctree directive) as explained in [our documentation](https://maxtext.readthedocs.io/en/latest/development.html#adding-new-documentation-files).

Copybara import of the project:

--
6ad79a9 by Branden Vandermoon <bvandermoon@google.com>:

Make Docker build and upload scripts runnable through pip

Merging this change closes #3359

FUTURE_COPYBARA_INTEGRATE_REVIEW=#3359 from AI-Hypercomputer:bvandermoon-docker-builds 6ad79a9
PiperOrigin-RevId: 882116463
@copybara-service copybara-service Bot merged commit d561ad4 into main Mar 11, 2026
29 of 30 checks passed
@copybara-service copybara-service Bot deleted the bvandermoon-docker-builds branch March 11, 2026 19:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants