data-apis / array-api-strict

Strict implementation of the Python array API (previously numpy.array_api)
http://data-apis.org/array-api-strict/
Other
7 stars 4 forks source link

array-api-strict flags #30

Closed asmeurer closed 4 months ago

asmeurer commented 5 months ago

Flags are global variables that set array-api-strict in a specific mode. Currently support flags change the support array API standard version, enable or disable data-dependent shapes, and enable or disable optional extensions.

So far I have only set up the structure for setting and getting these flags. Let me know if this seems like a good API layout or not.

I plan to add functionality to the various functions to enable/disable behaviors depending on what flags are set.

Fixes #8 Fixes #7

rgommers commented 5 months ago

@asmeurer I think the get_/reset_/set_array_api_strict_flags API is easy to understand, seems perfectly fine to me.

asmeurer commented 4 months ago

This is ready to go. I'm not going to implement anything for 2021.12 unless someone requests it. But using this, I can add preliminary support for 2023.12.

One thing I'm not completely sure about is if someone sets a flag using an environment variable, like ARRAY_API_STRICT_DEPENDENT_SHAPES=False, and then calls reset_array_api_strict_flags(), should that reset the flags back to what was set by the environment variables, or back to the default values? Right now I have it so that they are reset back to the default values.