1
0

optional_features.py 478 B

12345678910111213141516171819202122232425
  1. from typing import Literal, Set
  2. _optional_features: Set[str] = set()
  3. FEATURE = Literal[
  4. 'highcharts',
  5. 'matplotlib',
  6. 'pandas',
  7. 'pillow',
  8. 'plotly',
  9. 'polars',
  10. 'pyecharts',
  11. 'webview',
  12. 'sass',
  13. ]
  14. def register(feature: FEATURE) -> None:
  15. """Register an optional feature."""
  16. _optional_features.add(feature)
  17. def has(feature: FEATURE) -> bool:
  18. """Check if an optional feature is registered."""
  19. return feature in _optional_features