Skip to content

Conversation

@guitargeek
Copy link
Contributor

The setup of the ROOT module roughly works like this:

  1. The ROOT module imports cppyy modules
  2. It then creates the ROOT Facade, which keeps a handle to the original
    ROOT module
  3. It replaces itself with the facade

The facade module also import cppyy.

In the future, we want to have cppyy as an internal submodule of
ROOT to separate the ROOT package cleanly from other cppyy packages.

That means, the facade module will have to import something like
ROOT._cppyy, which implies the import of the ROOT module, which
imports the facade, and that's infinite recursion.

So one prerequisite for moving the cppyy module inside ROOT is that
the facade module doesn't import cppyy in its global scope, which is
implemented in this commit.

Fortunately, this can easily be avoided by re-using the handle to the
cppyy module that ROOT/__init__.py has originally imported, which is
set as an attribute of the facade.

This commit also takes the opportunity to fixup one design flaw in
e9fe075: the handle to the original ROOT module in the facade
should not be public, because this is an implementation detail of the
was the ROOT module is constructed.

So essentially, the ROOT.module attribute is replaced with a new
ROOT._cppyy attribute.

The setup of the ROOT module roughly works like this:

1. The ROOT module imports `cppyy` modules
2. It then creates the ROOT Facade, which keeps a handle to the original
   ROOT module
3. It replaces itself with the facade

The facade module also import cppyy.

In the future, we want to have `cppyy` as an internal submodule of
`ROOT` to separate the ROOT package cleanly from other cppyy packages.

That means, the facade module will have to import something like
`ROOT._cppyy`, which implies the import of the ROOT module, which
imports the facade, and that's infinite recursion.

So one prerequisite for moving the `cppyy` module inside `ROOT` is that
the facade module doesn't import `cppyy` in its global scope, which is
implemented in this commit.

Fortunately, this can easily be avoided by re-using the handle to the
cppyy module that `ROOT/__init__.py` has originally imported, which is
set as an attribute of the facade.

This commit also takes the opportunity to fixup one design flaw in
e9fe075: the handle to the original ROOT module in the facade
should not be public, because this is an implementation detail of the
was the ROOT module is constructed.

So essentially, the `ROOT.module` attribute is replaced with a new
`ROOT._cppyy` attribute.
In the future, we don't want to rely on ROOT also shipping the `cppyy`
package. It should be a ROOT implementation detail instead.
@guitargeek guitargeek self-assigned this Feb 1, 2026
@guitargeek guitargeek force-pushed the root_facade branch 3 times, most recently from 4ccd44d to 1fa26bd Compare February 1, 2026 16:21
@github-actions
Copy link

github-actions bot commented Feb 1, 2026

Test Results

    22 files      22 suites   3d 7h 53m 51s ⏱️
 3 772 tests  3 772 ✅ 0 💤 0 ❌
75 037 runs  75 037 ✅ 0 💤 0 ❌

Results for commit d8c87c5.

Copy link
Member

@vepadulano vepadulano left a comment

Choose a reason for hiding this comment

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

Great!!!

@guitargeek guitargeek merged commit 11d29d9 into root-project:master Feb 2, 2026
30 checks passed
@guitargeek guitargeek deleted the root_facade branch February 2, 2026 10:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants