Details
-
Type:
Improvement
-
Status: Won't Fix
-
Resolution: Done
-
Fix Version/s: None
-
Component/s: pex_config
-
Labels:None
-
Epic Link:
-
Team:Data Access and Database
Description
Config fields support type int but not int-valued enums. With SWIG this was only a mild nuisance because it treated enums as ints, but pybind11 is more careful. This leads to a need to explicitly cast values for enum fields to int (in the field) and from int to the enum type (when passed to pybind11-wrapped code), which is messy.
I suggest that enum types be explicitly supported. I suspect the only tricky part will be persistence (which may require casting from between int and the enum type) and specifying arguments on the command line. For single-valued enums one can might be able to persist by name (with an appropriate include at the top of the file) but that would be harder for mask fields (where various enum constants are "or"ed together).
Attachments
Issue Links
- mentioned in
-
Page Loading...
It might be tricky because config fields do run-time type checking, and AFAIK there is no easy way to identify a Python class as a pybind11 wrapper for an enum, e.g. there is no "enum" base class to test for.