Skip to content

Phase 2: Migrate to StrEnum#4868

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

Phase 2: Migrate to StrEnum#4868
Balandat wants to merge 1 commit intofacebook:mainfrom
Balandat:export-D91648882

Conversation

@Balandat
Copy link
Contributor

@Balandat Balandat commented Feb 8, 2026

Summary:
Convert (str, Enum) and Enum patterns to Python 3.11's built-in StrEnum class.
This removes the need for the dual inheritance pattern and removes pyre-fixme
annotations that were needed to annotate enum values with str type.

Files changed:

  • ax/utils/common/constants.py - Keys(str, Enum) -> Keys(StrEnum)
  • ax/storage/utils.py - MetricIntent(enum.Enum) -> MetricIntent(StrEnum)
  • ax/core/auxiliary.py - AuxiliaryExperimentPurpose(Enum) -> AuxiliaryExperimentPurpose(StrEnum)
  • ax/utils/stats/model_fit_stats.py - ModelFitMetricDirection(Enum) -> ModelFitMetricDirection(StrEnum)
  • ax/metrics/chemistry.py - ChemistryProblemType(Enum) -> ChemistryProblemType(StrEnum)
  • ax/metrics/sklearn.py - SklearnModelType(Enum), SklearnDataset(Enum) -> StrEnum

Differential Revision: D91648882

Summary:
Convert (str, Enum) and Enum patterns to Python 3.11's built-in StrEnum class.
This removes the need for the dual inheritance pattern and removes pyre-fixme
annotations that were needed to annotate enum values with str type.

Files changed:
- ax/utils/common/constants.py - Keys(str, Enum) -> Keys(StrEnum)
- ax/storage/utils.py - MetricIntent(enum.Enum) -> MetricIntent(StrEnum)
- ax/core/auxiliary.py - AuxiliaryExperimentPurpose(Enum) -> AuxiliaryExperimentPurpose(StrEnum)
- ax/utils/stats/model_fit_stats.py - ModelFitMetricDirection(Enum) -> ModelFitMetricDirection(StrEnum)
- ax/metrics/chemistry.py - ChemistryProblemType(Enum) -> ChemistryProblemType(StrEnum)
- ax/metrics/sklearn.py - SklearnModelType(Enum), SklearnDataset(Enum) -> StrEnum

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

meta-codesync bot commented Feb 8, 2026

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

@codecov-commenter
Copy link

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 96.75%. Comparing base (4761470) to head (79166e4).

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #4868   +/-   ##
=======================================
  Coverage   96.75%   96.75%           
=======================================
  Files         589      589           
  Lines       61835    61836    +1     
=======================================
+ Hits        59830    59831    +1     
  Misses       2005     2005           

☔ 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