Skip to content

[envpool] Upgrade tests to Python 3.12 and MuJoCo 3.x - #333

Merged
Trinkle23897 merged 7 commits into
mainfrom
jiayi/python-3-10-3-13
Mar 20, 2026
Merged

[envpool] Upgrade tests to Python 3.12 and MuJoCo 3.x#333
Trinkle23897 merged 7 commits into
mainfrom
jiayi/python-3-10-3-13

Conversation

@Trinkle23897

Copy link
Copy Markdown
Collaborator

Summary

  • Problem: Bazel test and dependency plumbing was still anchored to Python 3.10 and MuJoCo 2.2.x, which blocked Python 3.12 coverage and newer Gymnasium MuJoCo env ids.
  • Scope: Upgrade the Bazel Python toolchain and pip dependency plumbing for 3.12, expand declared support to 3.10-3.13, migrate MuJoCo gym coverage to v5/3.x, and keep existing tests running without introducing new skip/xfail paths.
  • Outcome: The runtime/toolchain updates and test fixes are in this PR; the GitHub workflow YAML edits are parked under manual_restore/workflows/ so they can be moved back from a machine with workflow scope.

This keeps the Python 3.12 bring-up and the MuJoCo 3.x migration in one coherent update, while preserving the existing test surface instead of hiding failures behind new skips.

Technical Details

  • Approach: Bump rules_python to a WORKSPACE-compatible 0.27 release, switch Bazel pip setup from pip_install to pip_parse with dev/release lockfiles, vendor MuJoCo 3.3.4 plus Gymnasium v5 XML overlays, and update the MuJoCo/VizDoom tests so they still exercise the same paths under the newer dependencies.
  • Code pointers:
    • WORKSPACE, envpool/workspace0.bzl, envpool/workspace1.bzl, envpool/pip.bzl: Python 3.12 toolchain registration, rules_python upgrade, and lockfile-based pip setup.
    • envpool/mujoco/gym/registration.py, envpool/mujoco/gym/*.h, third_party/mujoco_gym_xml_patches/*: MuJoCo 3.x backend updates and Gymnasium v5 env/XML alignment.
    • envpool/mujoco/*align*_test.py, envpool/vizdoom/vizdoom_pretrain_test.py: test updates; no new skip/xfail markers were introduced, and test_d3 keeps its quality gate while running in a subprocess.
    • manual_restore/workflows/*: workflow YAML parked here after PushPatrol rejected direct .github/workflows/* updates without workflow scope.
  • Notes: The repo already had separate dev/release requirements; the new requirements-dev-lock.txt and requirements-release-lock.txt files preserve that split under newer rules_python.

Test Plan

Automated

  • git diff --unified=0 origin/main -- . ':!third_party/pip_requirements/requirements-*-lock.txt' | rg -n "skip|xfail|pytest\.mark\.skip|self\.skipTest|@unittest\.skip|absltest\.skip": no new skip/xfail markers
  • git diff --check: pass
  • brix ssh dev -C -- 'cd /root/code/envpool && bazel test //envpool/mujoco:mujoco_gym_align_test //envpool/mujoco:mujoco_gym_deterministic_test //envpool/vizdoom:vizdoom_pretrain_test --test_output=errors --cache_test_results=no --config=test': pass
  • brix ssh dev -C -- 'cd /root/code/envpool && bazel test //envpool/vizdoom:vizdoom_pretrain_test --test_output=errors --cache_test_results=no --config=test': pass after restoring the D3 quality gate
  • brix ssh dev -C -- 'cd /root/code/envpool && make bazel-test': pass (30/30)

Suggested Manual

  • Move manual_restore/workflows/lint.yml -> .github/workflows/lint.yml and manual_restore/workflows/release.yml -> .github/workflows/release.yml from a machine with workflow scope, then push the branch again
  • make bazel-build: recheck the build path separately, since this series focused on test/runtime compatibility and not the wheel build path

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 99b6e27b9b

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread envpool/mujoco/gym/registration.py
Comment on lines +82 to +87
if task == "Pusher" and version == "v5":
extra_args.update(
{
"xml_file": "pusher_v5.xml",
"reward_after_step": True,
"weighted_reward_info": True,

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Thread xml_file through the other v5 MuJoCo envs

Gymnasium v5 restored the xml_file kwarg across the MuJoCo suite, but here only Pusher and Walker2d get it. HopperEnv, AntEnv, HumanoidEnv, HumanoidStandupEnv, Inverted*, Reacher, HalfCheetah, and Swimmer still hard-code their asset path, so calls like make_gymnasium('Hopper-v5', xml_file='custom.xml') will fail during config generation instead of loading the custom model. That blocks one of the main v5 features for most of the newly added env IDs.

Useful? React with 👍 / 👎.

Comment on lines 145 to 148
++elapsed_step_;
done_ = (terminate_when_unhealthy_ ? !IsHealthy() : false) ||
done_ = (terminate_when_unhealthy_ ? !is_healthy : false) ||
(elapsed_step_ >= max_episode_steps_);
WriteState(reward, xv, x_after);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Emit the Gymnasium v5 info fields for Hopper/Walker2d

This upgrades Hopper/Walker2d to the v5 reward semantics, but WriteState() still only exports x_position and x_velocity. Gymnasium v5's info for these envs also includes the reward breakdown (reward_forward, reward_ctrl, reward_survive) plus z_distance_from_origin, so downstream logging and wrappers that expect the standard v5 info dict will silently lose those fields when switching to EnvPool's -v5 registrations. envpool/mujoco/gym/walker2d.h has the same WriteState(reward, xv, x_after) pattern.

Useful? React with 👍 / 👎.

@Trinkle23897
Trinkle23897 merged commit 40cc309 into main Mar 20, 2026
2 of 4 checks passed
@Trinkle23897
Trinkle23897 deleted the jiayi/python-3-10-3-13 branch March 20, 2026 20:03
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.

1 participant