Skip to content

mesa: mako, yaml and packaging come from build deps, not from PyPI at build time (+ py-mako, py-markupsafe, py-pyyaml) - #1664

Open
bryan-minimal wants to merge 3 commits into
mainfrom
pip-no-network
Open

bryan-minimal wants to merge 3 commits into
mainfrom
pip-no-network

Conversation

@bryan-minimal

@bryan-minimal bryan-minimal commented Nov 23, 2026 •

Copy link
Copy Markdown
Member

Fixes the mesa half of #1663.

mesa's build ran pip3 install packaging mako pyyaml with errors hidden: unpinned, unhashed code from PyPI, run during the build to generate sources. mesa declares no network, so this only worked because every build on the build service gets the host's network today.

  • py-mako 1.4.3, py-markupsafe 3.0.4 (mako's one runtime dependency) and py-pyyaml 6.0.4 are new packages, each from its PyPI sdist with a pinned sha256, built with --no-index.
  • mesa takes py-mako, py-pyyaml and the existing py-packaging as build deps. build.sh no longer calls pip. It imports the three modules first, so a missing one fails at once with a clear error.

Choices worth a look:

  • py-pyyaml and py-markupsafe are pure Python. pyyaml's libyaml extension is turned off with PYYAML_FORCE_LIBYAML=0. markupsafe's optional speedups are left out by its own fallback, because the build has no C compiler.

Not built locally. This PR's build is the test: the three new packages on both architectures, and mesa configuring against them.

🤖 Generated with Claude Code

Summary by CodeRabbit

  • New Features
    • Added support for building Mesa with its required Python packages, including template rendering, markup safety, and YAML processing.
    • Added package checks that stop the build if required Python modules are unavailable.

…yPI at build time

Adds py-mako 1.4.3, py-markupsafe 3.0.4 and py-pyyaml 6.0.3.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Nov 23, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

The change adds build definitions for Mako, MarkupSafe, and PyYAML. Mesa now declares Mako, packaging, and PyYAML as build dependencies and checks that the required modules can be imported.

Changes: Mesa Python build dependencies

Layer / File(s) Summary
Add Python package definitions
packages/py-markupsafe/build.ncl, packages/py-markupsafe/build.sh, packages/py-mako/build.ncl, packages/py-mako/build.sh, packages/py-pyyaml/build.ncl, packages/py-pyyaml/build.sh
Adds package specifications with pinned source archives, build scripts, declared outputs, metadata, and smoke tests for MarkupSafe, Mako, and PyYAML.
Wire Python packages into Mesa
packages/mesa/build.ncl, packages/mesa/build.sh
Adds Mako, packaging, and PyYAML as Mesa build dependencies. Replaces pip installation fallbacks with Python import checks.

Estimated code review effort: 3 (Moderate) | ~25 minutes

Possibly related issues

  • Issue 1663: The PR removes the Mesa pip installation call identified by the issue and adds pinned package definitions for Mako and PyYAML.

Suggested reviewers: jakeyrg

Merge Risk: Minimal · up to 59232

This change removes Mesa's build-time download of unpinned Python packages and replaces it with pinned, locally built dependencies. No concrete problem was found. The PR's own CI build should confirm that the new packages build on both architectures.

Pre-merge checks: Passed 4

Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title names the main change: Mesa's mako, yaml, and packaging now come from build dependencies rather than PyPI at build time. It also lists the added py-mako, py-markupsafe, and py-pyyaml package…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Title check

Explanation

The title names the main change: Mesa's mako, yaml, and packaging now come from build dependencies rather than PyPI at build time. It also lists the added py-mako, py-markupsafe, and py-pyyaml packages. The changeset matches this. Mesa's build.ncl adds these dependencies, build.sh replaces the pip3 install with import checks, and the three new package specs are added. The title is long (19 words) but specific and accurate.

Finishing Touches

Generate unit tests (beta)

  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Recent review info

Run configuration

Commits

Reviewing files that changed from the base of the PR and between 211d755 and 59232d6.

Files selected for processing: 8

  • packages/mesa/build.ncl
  • packages/mesa/build.sh
  • packages/py-mako/build.ncl
  • packages/py-mako/build.sh
  • packages/py-markupsafe/build.ncl
  • packages/py-markupsafe/build.sh
  • packages/py-pyyaml/build.ncl
  • packages/py-pyyaml/build.sh

Included review availability: This review used your included allowance. 1 included review remains after this review. Your included PR review attempts over the past 7 days set your current allowance at 2 reviews per hour.

bryan-minimal and others added 2 commits November 23, 2026 20:36
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Build on the latest release. The sha256 is PyPI's published digest for the
pyyaml-6.0.4.tar.gz sdist, checked against a local download. 6.0.4 changes
merge-key performance and adds a libyaml recursion-control API; the
PYYAML_FORCE_LIBYAML=0 switch build.sh uses is unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@bryan-minimal
bryan-minimal marked this pull request as ready for review November 27, 2026 21:06
@bryan-minimal
bryan-minimal requested a review from a team as a code owner November 27, 2026 21:06

@norrietaylor norrietaylor left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Scope matches the title. The diff removes the pip3 install from packages/mesa/build.sh, adds three packages, and adds three build deps to mesa. Every hunk traces to that intent.

Clobber none. git log on packages/mesa shows only version updates before this change. The three py-* directories are new.

Correctness The three new packages follow the shape of packages/py-pyparsing and packages/ddgr. packages/setuptools is 84.2.1, so the lowercase mako-*.dist-info and markupsafe-*.dist-info globs match the normalized names. py-mako declares py-markupsafe in runtime_deps, so mesa gets it through the closure. The one finding is a comment nit.

Not checked. The sandbox denied network access, so I did not verify the three sdist sha256 values, or that versions 1.4.3, 3.0.4 and 6.0.4 exist on PyPI. I did not read the three setup.py files. The claims that PYYAML_FORCE_LIBYAML=0 turns off the extension, and that markupsafe falls back to pure Python with no compiler, agree with my memory of earlier releases only. The PR build is the test for both. I did not run gitleaks. The diff shows no credential on a read.

One design note, not a finding: py-pyyaml ships without CSafeLoader, and packages/libyaml and packages/cython both exist. The PR body states this choice.


# Template library. mesa needs it at BUILD time: its meson.build refuses to
# configure without the `mako` module, which generates C sources from
# templates. mesa's build used to fetch it from PyPI, unpinned.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

nit · The last sentence tells the history of the mesa build, not the state of this package. After the merge, no reader of this file can see the old pip3 install. Delete the sentence and keep the reason mesa needs the module. The same sentence is at packages/py-pyyaml/build.ncl:9. No other py-* package has one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants