Skip to content

[plugins] env: Forward PYTHONPATH and plugins definitions in rez subrequires' environment - #3178

Draft
cbentejac wants to merge 2 commits into
developfrom
dev/globalRezEnv
Draft

[plugins] env: Forward PYTHONPATH and plugins definitions in rez subrequires' environment#3178
cbentejac wants to merge 2 commits into
developfrom
dev/globalRezEnv

Conversation

@cbentejac

@cbentejac cbentejac commented Aug 14, 2026

Copy link
Copy Markdown
Contributor

Description

This PR addresses two specific issues related to the resolution of Rez environments during node computations.
Up until now, when resolving a processing environment with Rez (using the plugin's declared "subrequires"), the only thing that was done besides resolving the listed packages was reinjecting Meshroom's folder (to have access to meshroom_compute) and the plugin's folder (to have access to local imports made in the node descriptions) to the PYTHONPATH. Environment variables that describe which plugins and nodes to load were assumed to be correctly inherited in the subrequires' environment.

Although it was minimalist and easy to read (and consequently, easier to debug), the problems that came with that were:

  1. If any local import is made at the global level in a node description that came from another plugin, this import cannot be resolved (as the corresponding plugin's folder is not part of the PYTHONPATH), and the node description is rejected. In return, when meshroom_compute is loading the graph to evaluate the executed node's dependencies, if such a node is part of it, it is marked as "Unknown node type", which causes the executed node's UID to evaluate differently. As a consequence, the executed node cannot be processed.
  2. If any of the "subrequires" packages appends or edits a (or several) variable related to the loading of plugins/nodes (MESHROOM_PLUGINS_PATH, MESHROOM_USER_PLUGINS_PATH, MESHROOM_REZ_PLUGINS, MESHROOM_USER_REZ_PLUGINS, MESHROOM_NODES_PATH), it automatically resets it in the subrequires' environment, meaning the other plugins/nodes that were contained in it will be lost, causing the node descriptions not to be found, leading to the same erroneous UID evaluation.

This PR solves those by reinjecting all the content of the PYTHONPATH into the subrequires' environment, as well as all the plugins/nodes-related variables. It ensures all imports are always accessible, and no node description is lost because the plugin was not correctly loaded (or because its description was rejected due to the global imports of local modules).

The trade-off is that it makes the subprocess' command line extremely verbose and harder to understand, and it might additionally overload the PYTHONPATH with unnecessary modules.

@codecov

codecov Bot commented Aug 14, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 0% with 17 lines in your changes missing coverage. Please review.
✅ Project coverage is 86.20%. Comparing base (643231f) to head (8c397dc).
⚠️ Report is 32 commits behind head on develop.
✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
meshroom/core/plugins/env.py 0.00% 17 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #3178      +/-   ##
===========================================
- Coverage    86.27%   86.20%   -0.08%     
===========================================
  Files           81       83       +2     
  Lines        12367    12492     +125     
===========================================
+ Hits         10670    10769      +99     
- Misses        1697     1723      +26     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Comment thread meshroom/core/plugins/env.py Fixed
Comment thread meshroom/core/plugins/env.py Fixed
Comment thread meshroom/core/plugins/env.py Fixed
Comment thread meshroom/core/plugins/env.py Fixed
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