square-nail-98606
07/23/2025, 5:47 PMbootstrap-cache-key while using PANTS_BOOTSTRAP_VERSION=2. Is there anything we missed?fast-nail-55400
07/23/2025, 6:37 PMsquare-nail-98606
07/23/2025, 6:41 PMfast-nail-55400
07/23/2025, 6:44 PM./pants package src/python/pants:pants-pex or the wheel built by ./pants package src/python/pants:pants-packaged?fast-nail-55400
07/23/2025, 6:45 PMfast-nail-55400
07/23/2025, 6:47 PMinit-pants GHA action is interacting with it.fast-nail-55400
07/23/2025, 6:49 PMsquare-nail-98606
07/23/2025, 6:55 PM# Install Pants
RUN curl --proto '=https' --tlsv1.2 -fsSL <https://static.pantsbuild.org/setup/get-pants.sh|https://static.pantsbuild.org/setup/get-pants.sh> | bash
# Add Pants to PATH
ENV PATH="${HOME}/.local/bin:${PATH}"
# Create directory for Pants named caches
RUN mkdir -p ~/.cache/pants/named_caches
# Set default environment variables for Pants and Cloud SDK
ENV PANTS_PANTSD="True"
ENV PANTS_CACHE_DIR="${HOME}/.cache/pants"
ENV PANTS_NAMED_CACHES_DIR="${HOME}/.cache/pants/named_caches"
# Add pants source
COPY --chown=runner:runner third-party/infra/pants /third-party/infra/pants
# Pants requires a .git directory to function properly
# This is to handle the fact that we use a submodule for Pants
RUN rm /third-party/infra/pants/.git
COPY --chown=runner:runner .git/modules/third-party/infra/pants /third-party/infra/pants/.git
ENV PANTS_SOURCE=/third-party/infra/pantssquare-nail-98606
07/23/2025, 6:55 PMfast-nail-55400
07/23/2025, 7:00 PMpants.pex and just bundle that in the container. You can point the Pants launcher at it by setting PANTS_BOOTSTRAP_URLS as per https://github.com/pantsbuild/scie-pants?tab=readme-ov-file#firewall-support and using a file:// URL.fast-nail-55400
07/23/2025, 7:02 PMpants.pex directly as I do for example in this plugin's integration tests: https://github.com/shoalsoft/shoalsoft-pants-opentelemetry-plugin/blob/main/src/py[…]ft/pants_opentelemetry_plugin/opentelemetry_integration_test.py, but a big downside is it forgoes using the scie-pants launcher to supply a Python Build Standalone interpreter (but I decided that was fine for my plugin's tests).fast-nail-55400
07/23/2025, 7:20 PMpants.pex for a release from GitHub Releases.fast-nail-55400
07/23/2025, 7:21 PMpants.pex with ./pants package src/python/pants:pants-pex in the Pants repository. Look in dist/ for the output.square-nail-98606
07/24/2025, 8:24 PMRUN curl --proto '=https' --tlsv1.2 -fsSL <https://static.pantsbuild.org/setup/get-pants.sh> | bash
COPY third-party/infra/pants/dist/src.python.pants/pants-pex.pex /opt/pants/pants.pex
RUN sudo chmod +x /opt/pants/pants.pex && \
sudo chown coder:coder /opt/pants/pants.pex
RUN sudo mkdir -p /opt/pants/.config
RUN echo '{\
"ptex": {\
"cpython-3.10.18+20250612-x86_64-unknown-linux-gnu-install_only.tar.gz": "<https://github.com/astral-sh/python-build-standalone/releases/download/20250612/cpython-3.10.18%2B20250612-x86_64-unknown-linux-gnu-install_only.tar.gz>",\
"cpython-3.11.13+20250612-x86_64-unknown-linux-gnu-install_only.tar.gz": "<https://github.com/astral-sh/python-build-standalone/releases/download/20250612/cpython-3.11.13%2B20250612-x86_64-unknown-linux-gnu-install_only.tar.gz>",\
"cpython-3.12.11+20250612-x86_64-unknown-linux-gnu-install_only.tar.gz": "<https://github.com/astral-sh/python-build-standalone/releases/download/20250612/cpython-3.12.11%2B20250612-x86_64-unknown-linux-gnu-install_only.tar.gz>",\
"cpython-3.13.5+20250612-x86_64-unknown-linux-gnu-install_only.tar.gz": "<https://github.com/astral-sh/python-build-standalone/releases/download/20250612/cpython-3.13.5%2B20250612-x86_64-unknown-linux-gnu-install_only.tar.gz>",\
"cpython-3.8.20+20241002-x86_64-unknown-linux-gnu-install_only.tar.gz": "<https://github.com/astral-sh/python-build-standalone/releases/download/20241002/cpython-3.8.20%2B20241002-x86_64-unknown-linux-gnu-install_only.tar.gz>",\
"cpython-3.9.23+20250612-x86_64-unknown-linux-gnu-install_only.tar.gz": "<https://github.com/astral-sh/python-build-standalone/releases/download/20250612/cpython-3.9.23%2B20250612-x86_64-unknown-linux-gnu-install_only.tar.gz>",\
"pants.2.61.1-cp12-linux_x86_64.pex": "file:///opt/pants/pants.pex"\
}\
}' | sudo tee /opt/pants/.config/ptex.json > /dev/null
RUN sudo chown coder:coder /opt/pants/.config/ptex.json && \
sudo chmod 644 /opt/pants/.config/ptex.json
# Set PANTS_BOOTSTRAP_URLS to use local ptex json
ENV PANTS_BOOTSTRAP_URLS="/opt/pants/.config/ptex.json"fast-nail-55400
07/24/2025, 8:30 PMpants.2.61.1-cp12-linux_x86_64.pex, you are building the pex with Python 3.12? Pants is on Python 3.11, so you should set interpreter constraints to Python 3.11 (the cp12 is what I'm reacting to, although shouldn't that be cp312 then?)fast-nail-55400
07/24/2025, 8:31 PMfast-nail-55400
07/24/2025, 8:32 PMpants --version as a test and, as a side effect, force the Pants launcher to unpack the Pants venv from the pex which will then be cached in your Docker image.curved-manchester-66006
07/25/2025, 5:25 PMsquare-nail-98606
07/31/2025, 8:19 AMsquare-nail-98606
07/31/2025, 8:19 AM