Skip to content

rmg_env: build it from one pinned spec in the installer, the docs and CI - #231

Draft
alongd wants to merge 2 commits into
mainfrom
i082-rmg-pin
Draft

alongd wants to merge 2 commits into
mainfrom
i082-rmg-pin

Conversation

@alongd

@alongd alongd commented Nov 28, 2026

Copy link
Copy Markdown
Member

Summary

rmg_env stops being built from a source checkout of RMG-Py's default branch and becomes one
pinned spec that the installer, CI and a new assertion all read from the same file.

 devtools/
+├── rmg_env.yml          # the one statement: python=3.11, rmg=4.0.0, rmgdatabase=4.0.0,
+│                        #   conda-forge::numdifftools>=0.9.41
+├── check_rmg_env.py     # asserts a built rmg_env matches that file
 └── install_all.sh       # creates rmg_env from the spec; no RMG-Py/RMG-database clone, no `make`

 .github/workflows/ci.yml
-  - Checkout RMG Database (ref: main)
-  - Checkout RMG-Py (ref: main)
-  - environment-file: RMG-Py/environment.yml
-  - Compute RMG-Py build cache key / Cache Cython build / Compile RMG-Py
+  - environment-file: T3/devtools/rmg_env.yml
+  - Verify rmg_env matches devtools/rmg_env.yml

Package mode: rmgpy, arkane and the RMG database come from the pinned conda packages, so
nothing is compiled and RMG_PATH stays unset. numdifftools>=0.9.41 is a floor, not a
preference — the rmg channel ships 0.9.39, which calls np.finfo().machar, and the numpy that
rmg 4.0.0 needs no longer has it, so import arkane fails without it.

Evidence

Before: every CI result was a claim about three unpinned dependencies at the instant it ran.
The checkout steps pulled ARC, RMG-Py and RMG-database at ref: main, so a commit in any of them
could turn this repository's suite red without a commit here — which is exactly what happened on
2026-11-15.

After: python devtools/check_rmg_env.py asserts the environment, reached the way T3 reaches
it (through ARC's rmg_env_command, with a decoy rmgpy on the parent's PYTHONPATH):

pins:                 numdifftools>=0.9.41, python=3.11, rmg=4.0.0, rmgdatabase=4.0.0
sys.version:          3.11.18
rmgpy.__file__:       …/rmg_pin_b/lib/python3.11/site-packages/rmgpy/__init__.py
installed (pinned):   numdifftools=0.9.42, python=3.11.18, rmg=4.0.0, rmgdatabase=4.0.0
ARC RMG_PATH:         None
with decoy PYTHONPATH: rmgpy.__file__ = …/site-packages/rmgpy/__init__.py
imports checked:      21 (21 ok)
arkane --help:        exit 0
rmg_env matches …/devtools/rmg_env.yml (package mode).

The failing direction was tested too: with RMG_DB_PATH unset it flagged the database mismatch;
with RMG_PATH pointed at a stand-in source tree it flagged the path, the decoy, the
site-packages location and the imports. A mutated spec (rmg=4.0.1) exited 1 with
pin rmg=4.0.1 does not hold: installed rmg is 4.0.0.

tests/test_check_rmg_env.py: 31 passed. Mutating pin_holds so = always returns True makes 3
of them fail, including the conda =-prefix case where 3.1 must not satisfy 3.11.18 — the
tests assert rather than merely cover.

Merge Danger

Door: two-way. Reverting restores the checkout-and-compile steps verbatim.

Blast Radius: install.

This changes what make install builds and what CI gates on, so it is the whole install surface
and nothing else — no t3/ behaviour changes beyond removing two unused RMG_DB_PATH-derived
attributes.

One known condition, measured and out of scope. Under the pin, Arkane fails on a conda-only
host: ARC's direct-interpreter launcher (taken by any host without MAMBA_EXE) unsets
CONDA_PREFIX, Arkane's get_conda_package then runs conda list -f rmg against the base prefix,
and conda's error text reaches stderr, which T3 reads as a failed run. CI uses micromamba and stays
green, so this will not show here. The root cause is in ARC or RMG-Py, with a T3-side option
(extend the existing Arkane-stderr classifier); it is tracked separately and is not fixed by this
PR.

rmg_env is pinned to rmg=4.0.0 on Python 3.11. Five places still said
Python 3.9; they now say 3.11. None is read by code, and the fixture
path in test_me_success is matched only by the warning-line regex, not
parsed for a version.

docs/installation.md now warns at the manual rmg_env step that Arkane
needs conda-forge numdifftools>=0.9.41: the rmg channel's 0.9.39 calls
np.finfo().machar and `import arkane` fails.

T3.thermo_lib_base_path and kinetics_lib_base_path were assigned from
ARC's RMG_DB_PATH and never read. T3 adds its libraries by path, so drop
them and the import.
devtools/rmg_env.yml is now the one statement of rmg_env: rmg=4.0.0 on
Python 3.11, its rmgdatabase=4.0.0, and conda-forge numdifftools>=0.9.41,
in package mode. make install, the manual install docs and the gating
CI job all create rmg_env from it. Nothing clones or compiles RMG-Py or
RMG-database any more; the database is the one rmgdatabase installs,
which is what ARC and rmgpy both read.

devtools/check_rmg_env.py asserts that a built rmg_env matches the
spec, reached through ARC's rmg_env_command as T3 reaches it: the pins,
Python, rmgpy version, rmgpy/arkane loading from site-packages, ARC's
RMG_PATH unset, a decoy rmgpy on the parent PYTHONPATH not reaching the
child, ARC and rmgpy on the same database, the imports of T3's rmg_env
scripts, and `python -m arkane --help`. CI runs it before the tests;
make install runs it last.

ARC sets RMG_PATH on its own when it finds an RMG-Py checkout (on
sys.path, $GITHUB_WORKSPACE/RMG-Py or ~/Code/RMG-Py), which would put a
source tree in front of the package. The docs say how to keep it unset.
@github-actions
github-actions Bot requested a balanced review from Copilot November 28, 2026 06:57
@codecov-commenter

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 81.90%. Comparing base (4043bb9) to head (4fb96cb).

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #231      +/-   ##
==========================================
- Coverage   81.92%   81.90%   -0.02%     
==========================================
  Files          78       78              
  Lines       12947    12944       -3     
  Branches     2732     2732              
==========================================
- Hits        10607    10602       -5     
- Misses       1694     1695       +1     
- Partials      646      647       +1     
Flag Coverage Δ
unittests 81.90% <ø> (-0.02%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

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

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copilot AI 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.

🟡 Changes recommended

Automated installation can re-solve the RMG environment with conflicting ARC constraints, while verification misses external database use, T3 launcher import contamination, and sensitivity-analysis dependencies.

4 open issues
What changed in this PR

This PR replaces source-built RMG dependencies with pinned conda packages and introduces a shared environment specification for installation and CI.

Changes:

  • Adds devtools/rmg_env.yml and removes direct RMG checkout, compilation, and build-cache steps.
  • Adds an environment checker and tests for version pins, package locations, imports, and launcher isolation.
  • Updates installation guidance and Python-version references, and removes unused database-path attributes.
File Description
tests/​test_pdep/​test_round1_regression.py Updates the Python version in the test documentation.
tests/​test_pdep/​test_me_success.py Updates a warning fixture’s Python path.
tests/​test_check_rmg_env.py Tests environment-checking logic and failure cases.
t3/​runners/​statmech_conformer_extract.py Updates the documented runner Python version.
t3/​runners/​pdep_source_seed.py Updates the documented runner Python version.
t3/​pdep/​dof_conformers.py Updates the documented Arkane environment version.
t3/​main.py Removes unused database-library path attributes and import.
README.md Describes the package-based RMG installation.
docs/​installation.md Documents pinned installation, path settings, and verification.
devtools/​rmg_env.yml Defines the shared RMG environment requirements.
devtools/​install_all.sh Creates RMG from the spec and runs verification.
devtools/​check_rmg_env.py Checks environment pins and package-mode behavior.
.github/​workflows/​ci.yml Uses the shared spec and checker instead of compiling RMG.

Review effort: Balanced

Comment thread devtools/check_rmg_env.py
# The scripts T3 executes under rmg_env's Python. Their import statements are the set rmg_env must
# satisfy; the t3_env modules that launch them import nothing from rmgpy themselves.
RMG_ENV_SCRIPTS = (
os.path.join('t3', 'runners', 'rmg_incore_script.py'),
Comment thread devtools/check_rmg_env.py
Comment on lines +268 to +269
if not same_directory(arc_rmg_db_path, report.get('database')):
failures.append(f"ARC's RMG_DB_PATH is {arc_rmg_db_path} but rmgpy in rmg_env reads {report.get('database')}")
Comment thread devtools/check_rmg_env.py
Comment on lines +291 to +292
return subprocess.run(['bash', '-c', rmg_env_command(py_args=py_args)],
capture_output=True, text=True, env=env, timeout=600)
Comment thread devtools/install_all.sh
Comment on lines +37 to +39
$COMMAND_PKG env update -n rmg_env -f devtools/rmg_env.yml
else
$COMMAND_PKG env create -f environment.yml
$COMMAND_PKG env create -f devtools/rmg_env.yml

This branch has not been deployed

No deployments
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.

3 participants