Skip to content

Phase 3: Add Self type annotations to fluent/clone methods#4907

Open
Balandat wants to merge 1 commit intofacebook:mainfrom
Balandat:export-D93186334
Open

Phase 3: Add Self type annotations to fluent/clone methods#4907
Balandat wants to merge 1 commit intofacebook:mainfrom
Balandat:export-D93186334

Conversation

@Balandat
Copy link
Contributor

Summary:
Add Self type annotation from typing module to methods that return self
or cloned instances of the same class. This enables better type inference
for subclasses and improves IDE support.

Files changed:

  • ax/core/base_trial.py - run(), stop(), complete(), mark_*() methods
  • ax/core/batch_trial.py - mark_arm_abandoned()
  • ax/core/experiment.py - add_tracking_metric(), update_tracking_metric(), etc.
  • ax/core/multi_type_experiment.py - add_trial_type(), update_runner(), metric methods
  • ax/core/arm.py - clone()
  • ax/core/objective.py - clone() on Objective, MultiObjective, ScalarizedObjective
  • ax/core/optimization_config.py - clone()
  • ax/core/runner.py - clone()
  • ax/core/parameter.py - clone() abstract method

Differential Revision: D93186334

Summary:
Add Self type annotation from typing module to methods that return self
or cloned instances of the same class. This enables better type inference
for subclasses and improves IDE support.

Files changed:
- ax/core/base_trial.py - run(), stop(), complete(), mark_*() methods
- ax/core/batch_trial.py - mark_arm_abandoned()
- ax/core/experiment.py - add_tracking_metric(), update_tracking_metric(), etc.
- ax/core/multi_type_experiment.py - add_trial_type(), update_runner(), metric methods
- ax/core/arm.py - clone()
- ax/core/objective.py - clone() on Objective, MultiObjective, ScalarizedObjective
- ax/core/optimization_config.py - clone()
- ax/core/runner.py - clone()
- ax/core/parameter.py - clone() abstract method

Differential Revision: D93186334
@meta-cla meta-cla bot added the CLA Signed Do not delete this pull request or issue due to inactivity. label Feb 13, 2026
@meta-codesync
Copy link

meta-codesync bot commented Feb 13, 2026

@Balandat has exported this pull request. If you are a Meta employee, you can view the originating Diff in D93186334.

@codecov-commenter
Copy link

Codecov Report

❌ Patch coverage is 97.50000% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 96.78%. Comparing base (d8a75c0) to head (83f550a).

Files with missing lines Patch % Lines
ax/core/multi_type_experiment.py 85.71% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #4907      +/-   ##
==========================================
- Coverage   96.78%   96.78%   -0.01%     
==========================================
  Files         593      593              
  Lines       62284    62289       +5     
==========================================
+ Hits        60282    60286       +4     
- Misses       2002     2003       +1     

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

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed Do not delete this pull request or issue due to inactivity. fb-exported meta-exported

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants