Skip to content

Commit

Permalink
Require truthy/falsy values for BAYBE_DEACTIVATE_POLARS
Browse files Browse the repository at this point in the history
  • Loading branch information
AdrianSosic committed Nov 12, 2024
1 parent 63fdaff commit 34def91
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
traditional mixture example
- Memory caching is now non-verbose
- `CustomDiscreteParameter` does not allow duplicated rows in `data` anymore
- De-/activating Polars via `BAYBE_DEACTIVATE_POLARS` now requires passing values
compatible with `strtobool`

### Fixed
- Rare bug arising from degenerate `SubstanceParameter.comp_df` rows that caused
Expand Down
4 changes: 2 additions & 2 deletions baybe/searchspace/discrete.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
)
from baybe.serialization import SerialMixin, converter, select_constructor_hook
from baybe.utils.basic import to_tuple
from baybe.utils.boolean import eq_dataframe
from baybe.utils.boolean import eq_dataframe, strtobool
from baybe.utils.dataframe import (
df_drop_single_value_columns,
fuzzy_row_match,
Expand Down Expand Up @@ -296,7 +296,7 @@ def from_product(

try:
# Check for manual deactivation of polars
if os.environ.get("BAYBE_DEACTIVATE_POLARS", None) is not None:
if not strtobool(os.environ.get("BAYBE_DEACTIVATE_POLARS", "False")):
raise OptionalImportError(
"Polars was deactivated manually via environment variable."
)
Expand Down
3 changes: 2 additions & 1 deletion docs/userguide/envvars.md
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,8 @@ during this process, and thus might be beneficial for very large search spaces.

Since this is still somewhat experimental, you might want to deactivate Polars without
changing the Python environment. To do so, you can set the environment variable
`BAYBE_DEACTIVATE_POLARS` to any value.
`BAYBE_DEACTIVATE_POLARS` to any truthy value accepted by
[`strtobool`](baybe.utils.boolean.strtobool).


## Disk Caching
Expand Down

0 comments on commit 34def91

Please sign in to comment.