Skip to content

Raise an error if someone tries to run code from metatomic_torch.documentation#182

Open
Luthaf wants to merge 1 commit intometatensor:mainfrom
Luthaf:do-not-run-docs-classes
Open

Raise an error if someone tries to run code from metatomic_torch.documentation#182
Luthaf wants to merge 1 commit intometatensor:mainfrom
Luthaf:do-not-run-docs-classes

Conversation

@Luthaf
Copy link
Member

@Luthaf Luthaf commented Mar 18, 2026

Typically this only happens in sphinx-gallery, when trying to re-execute an example that failed with the actual code, so we also point the user to that.

This is the same as metatensor/metatensor#1074, and would have helped find the issue in metatensor/metatrain#1077 a lot earlier.

Contributor (creator of pull-request) checklist

  • Tests updated (for new features and bugfixes)?
  • Documentation updated (for new features)?
  • Issue referenced (for PRs that solve an issue)?

Reviewer checklist

  • CHANGELOG updated with public API or any other important changes?

…mentation

Typically this only happens in sphinx-gallery, when trying to re-execute an
example that failed with the actual code, so we also point the user to that
@Luthaf Luthaf requested a review from pfebrer March 18, 2026 15:22
THIS_CODE_SHOULD_NOT_RUN = RuntimeError(
"you are using the documentation-only version of this class, "
"this is usually sign of an earlier problem when running examples"
)
Copy link

Choose a reason for hiding this comment

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

I think the second sentence is not necessary, or at least we could say:

"If this error is happening when running examples..."

Copy link
Contributor

Choose a reason for hiding this comment

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

Hmm I thoght I also left a comment. Seems not. I was thinking if we should inform people they should maybe reinstall something... Otherwise it feels like more an "something went wrong" error message.

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