Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add missing attributes for python package #363

Merged
merged 4 commits into from
Sep 16, 2024
Merged

Conversation

m-fila
Copy link
Contributor

@m-fila m-fila commented Sep 13, 2024

BEGINRELEASENOTES

  • Added missing attributes for python package

ENDRELEASENOTES

The package attributes from the import system were missing since the edm4hep is rebound to the edm4hep submodule created with ROOT/cppyy. Similarly __version__ was set in the __init__.py but then lost

Having missing attributes shouldn't be a problem as we didn't experience it yet. But I think there was an intention to have edm4hep.__version__ available

Import system docs

@m-fila m-fila changed the title Added missing attributes for python package Add missing attributes for python package Sep 13, 2024
Copy link
Contributor

@tmadlener tmadlener left a comment

Choose a reason for hiding this comment

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

Do we have to do a similar thing to podio?

test/test_module.py Outdated Show resolved Hide resolved
@m-fila
Copy link
Contributor Author

m-fila commented Sep 13, 2024

Do we have to do a similar thing to podio?

No, podio is fine. In podio we use in wrappers or bring elements from the cppyy created module to the __init__.py.

Here we instruct the system to put under the name edm4hep the cppyy created module (normaly would be called edm4hep.edm4hep) instead of the edm4hep module from edm4hep/__inity__.py

sys.modules['edm4hep'] = edm4hep

Comment on lines 19 to 23
expected_origin = str(Path(__file__).parent.parent / "python" / "edm4hep" / "__init__.py")
assert edm4hep.__file__ == expected_origin
# __path__
expected_path = [str(Path(expected_origin).parent)]
assert edm4hep.__path__ == expected_path
Copy link
Contributor

Choose a reason for hiding this comment

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

These will obviously be different after installation, but I don't see an easy way to check them without doing an install first. Anyhow, there is no reason to expect this to not work after installation, unless I am missing something?

Copy link
Contributor Author

@m-fila m-fila Sep 16, 2024

Choose a reason for hiding this comment

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

I didn't think about it. I think it should be possible to find package without importing it and then check if the attributes' values are the same on the imported module. That should work for testing both in build environment and after install

But I don't expect that there should be any issues after installation

@tmadlener tmadlener enabled auto-merge (squash) September 16, 2024 15:22
@tmadlener tmadlener merged commit 6d785eb into key4hep:main Sep 16, 2024
7 of 10 checks passed
@m-fila m-fila deleted the version_py branch September 16, 2024 15:35
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