Skip to content

Conversation

@CompRhys
Copy link
Member

@CompRhys CompRhys commented Apr 25, 2025

Summary

Attempt to explore if lazy imports can help with the metatensor import issues.

Import errors being suppressed by the try-except-pass caused a misleading error message about MetatensorModel being unimportable. see #178

@cla-bot cla-bot bot added the cla-signed Contributor license agreement signed label Apr 25, 2025
@janosh
Copy link
Collaborator

janosh commented Apr 25, 2025

given that these changes, don't surface better error messages on failed imports and it looks a bit over-engineered, i suggest we remove the imports in torch_sim/models/__init__.py and just leave the file blank

Copy link
Collaborator

@orionarcher orionarcher left a comment

Choose a reason for hiding this comment

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

I am fine removing the imports, can we put [breaking] in the PR title so I can track it in the next changelog?

@CompRhys CompRhys changed the title Try lazy imports add pyi file for type checking [BREAKING] Remove higher level model imports Apr 25, 2025
@janosh
Copy link
Collaborator

janosh commented Apr 28, 2025

@orionarcher the recommended way to highlight breaking changes in github's auto-generated release notes is to have a release.yml file like this one https://github.com/janosh/pymatviz/blob/main/.github/release.yml and assign the breaking label to this PR (no harm having it in the PR title as well ofc except you should remove it in the auto-generated release notes to avoid redundancy). based on the labels, you then get these kinds of release notes with a single click from github https://github.com/janosh/pymatviz/releases/tag/v0.15.0

@janosh janosh merged commit de05e04 into main Apr 28, 2025
87 of 91 checks passed
@janosh janosh deleted the lazy-imports-178 branch April 28, 2025 18:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

breaking Breaking changes cla-signed Contributor license agreement signed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Metatensor models have import error due to 2.7 PyTorch but we get an uninformative error message.

3 participants