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

Prototype of @experimental #430

Draft
wants to merge 1 commit into
base: develop
Choose a base branch
from
Draft

Conversation

davidorme
Copy link
Collaborator

@davidorme davidorme commented Feb 18, 2025

Description

This PR:

  • Introduces the new pyrealm.core.experimental module, which provides the @experimental decorator and ExperimentalFeatureWarning2 (so called because we already have pyrealm.ExperimentalFeatureWarning, although this would be replaced if we get this working.

Tests show it works, but there is an issue with building the docs - somehow this interferes with autodoc in a way that breaks the links to experimental objects - if you ignore errors when building, the build succeeds and it looks good but the link in the side menu is broken and the links to the object fail:

See here:

https://pyrealm.readthedocs.io/en/429-experimental-decorator/api/pmodel_api.html#module-pyrealm.pmodel.quantum_yield

The QuantumYieldSandoval() appears differently in the menu and the attributes are not autogenerated.

Fixes #429

Type of change

  • New feature (non-breaking change which adds functionality)
  • Optimization (back-end change that speeds up the code)
  • Bug fix (non-breaking change which fixes an issue)

Key checklist

  • Make sure you've run the pre-commit checks: $ pre-commit run -a
  • All tests pass: $ poetry run pytest

Further checks

  • Code is commented, particularly in hard-to-understand areas
  • Tests added that prove fix is effective or that feature works

@davidorme davidorme linked an issue Feb 18, 2025 that may be closed by this pull request
@davidorme davidorme changed the base branch from develop to 383-meta-release-200 February 18, 2025 13:46
@codecov-commenter
Copy link

Codecov Report

All modified and coverable lines are covered by tests ✅

Please upload report for BASE (383-meta-release-200@2462f8a). Learn more about missing BASE report.

Additional details and impacted files
@@                   Coverage Diff                   @@
##             383-meta-release-200     #430   +/-   ##
=======================================================
  Coverage                        ?   96.54%           
=======================================================
  Files                           ?       37           
  Lines                           ?     2775           
  Branches                        ?        0           
=======================================================
  Hits                            ?     2679           
  Misses                          ?       96           
  Partials                        ?        0           

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

@davidorme
Copy link
Collaborator Author

Ohhhh. It's also listed as a function at the top of the page. Something bad is happening.

It may be that there is a better sphinx side way to do this as @j-emberton suggested. Might be worth implementing both approaches in this PR and comparing side by side.

@davidorme davidorme requested a review from j-emberton February 18, 2025 15:34
@MarionBWeinzierl
Copy link
Collaborator

Ohhhh. It's also listed as a function at the top of the page. Something bad is happening.

It may be that there is a better sphinx side way to do this as @j-emberton suggested. Might be worth implementing both approaches in this PR and comparing side by side.

Do you mean this? https://deprecated.readthedocs.io/en/latest/sphinx_deco.html

@davidorme
Copy link
Collaborator Author

I've basically followed the internals out of:

https://github.com/briancurtin/deprecation/blob/master/deprecation.py
https://pypi.org/project/deprecation/

The actual docstring manipulation works but something interferes with the autodoc handling. I'll have a look at the internals of that Deprecated package and see if it is different

Base automatically changed from 383-meta-release-200 to develop March 4, 2025 14:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Review
Development

Successfully merging this pull request may close these issues.

Look at experimental decorator.
3 participants