polars-runtime-compat 1.34.0b3__cp39-abi3-macosx_11_0_arm64.whl → 1.34.0b4__cp39-abi3-macosx_11_0_arm64.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of polars-runtime-compat might be problematic. Click here for more details.

Files changed (203) hide show
  1. _polars_runtime_compat/_polars_runtime_compat.abi3.so +0 -0
  2. {polars_runtime_compat-1.34.0b3.dist-info → polars_runtime_compat-1.34.0b4.dist-info}/METADATA +1 -1
  3. polars_runtime_compat-1.34.0b4.dist-info/RECORD +6 -0
  4. polars/__init__.py +0 -528
  5. polars/_cpu_check.py +0 -265
  6. polars/_dependencies.py +0 -355
  7. polars/_plr.py +0 -99
  8. polars/_plr.pyi +0 -2496
  9. polars/_reexport.py +0 -23
  10. polars/_typing.py +0 -478
  11. polars/_utils/__init__.py +0 -37
  12. polars/_utils/async_.py +0 -102
  13. polars/_utils/cache.py +0 -176
  14. polars/_utils/cloud.py +0 -40
  15. polars/_utils/constants.py +0 -29
  16. polars/_utils/construction/__init__.py +0 -46
  17. polars/_utils/construction/dataframe.py +0 -1397
  18. polars/_utils/construction/other.py +0 -72
  19. polars/_utils/construction/series.py +0 -560
  20. polars/_utils/construction/utils.py +0 -118
  21. polars/_utils/convert.py +0 -224
  22. polars/_utils/deprecation.py +0 -406
  23. polars/_utils/getitem.py +0 -457
  24. polars/_utils/logging.py +0 -11
  25. polars/_utils/nest_asyncio.py +0 -264
  26. polars/_utils/parquet.py +0 -15
  27. polars/_utils/parse/__init__.py +0 -12
  28. polars/_utils/parse/expr.py +0 -242
  29. polars/_utils/polars_version.py +0 -19
  30. polars/_utils/pycapsule.py +0 -53
  31. polars/_utils/scan.py +0 -27
  32. polars/_utils/serde.py +0 -63
  33. polars/_utils/slice.py +0 -215
  34. polars/_utils/udfs.py +0 -1251
  35. polars/_utils/unstable.py +0 -63
  36. polars/_utils/various.py +0 -782
  37. polars/_utils/wrap.py +0 -25
  38. polars/api.py +0 -370
  39. polars/catalog/__init__.py +0 -0
  40. polars/catalog/unity/__init__.py +0 -19
  41. polars/catalog/unity/client.py +0 -733
  42. polars/catalog/unity/models.py +0 -152
  43. polars/config.py +0 -1571
  44. polars/convert/__init__.py +0 -25
  45. polars/convert/general.py +0 -1046
  46. polars/convert/normalize.py +0 -261
  47. polars/dataframe/__init__.py +0 -5
  48. polars/dataframe/_html.py +0 -186
  49. polars/dataframe/frame.py +0 -12582
  50. polars/dataframe/group_by.py +0 -1067
  51. polars/dataframe/plotting.py +0 -257
  52. polars/datatype_expr/__init__.py +0 -5
  53. polars/datatype_expr/array.py +0 -56
  54. polars/datatype_expr/datatype_expr.py +0 -304
  55. polars/datatype_expr/list.py +0 -18
  56. polars/datatype_expr/struct.py +0 -69
  57. polars/datatypes/__init__.py +0 -122
  58. polars/datatypes/_parse.py +0 -195
  59. polars/datatypes/_utils.py +0 -48
  60. polars/datatypes/classes.py +0 -1213
  61. polars/datatypes/constants.py +0 -11
  62. polars/datatypes/constructor.py +0 -172
  63. polars/datatypes/convert.py +0 -366
  64. polars/datatypes/group.py +0 -130
  65. polars/exceptions.py +0 -230
  66. polars/expr/__init__.py +0 -7
  67. polars/expr/array.py +0 -964
  68. polars/expr/binary.py +0 -346
  69. polars/expr/categorical.py +0 -306
  70. polars/expr/datetime.py +0 -2620
  71. polars/expr/expr.py +0 -11272
  72. polars/expr/list.py +0 -1408
  73. polars/expr/meta.py +0 -444
  74. polars/expr/name.py +0 -321
  75. polars/expr/string.py +0 -3045
  76. polars/expr/struct.py +0 -357
  77. polars/expr/whenthen.py +0 -185
  78. polars/functions/__init__.py +0 -193
  79. polars/functions/aggregation/__init__.py +0 -33
  80. polars/functions/aggregation/horizontal.py +0 -298
  81. polars/functions/aggregation/vertical.py +0 -341
  82. polars/functions/as_datatype.py +0 -848
  83. polars/functions/business.py +0 -138
  84. polars/functions/col.py +0 -384
  85. polars/functions/datatype.py +0 -121
  86. polars/functions/eager.py +0 -524
  87. polars/functions/escape_regex.py +0 -29
  88. polars/functions/lazy.py +0 -2751
  89. polars/functions/len.py +0 -68
  90. polars/functions/lit.py +0 -210
  91. polars/functions/random.py +0 -22
  92. polars/functions/range/__init__.py +0 -19
  93. polars/functions/range/_utils.py +0 -15
  94. polars/functions/range/date_range.py +0 -303
  95. polars/functions/range/datetime_range.py +0 -370
  96. polars/functions/range/int_range.py +0 -348
  97. polars/functions/range/linear_space.py +0 -311
  98. polars/functions/range/time_range.py +0 -287
  99. polars/functions/repeat.py +0 -301
  100. polars/functions/whenthen.py +0 -353
  101. polars/interchange/__init__.py +0 -10
  102. polars/interchange/buffer.py +0 -77
  103. polars/interchange/column.py +0 -190
  104. polars/interchange/dataframe.py +0 -230
  105. polars/interchange/from_dataframe.py +0 -328
  106. polars/interchange/protocol.py +0 -303
  107. polars/interchange/utils.py +0 -170
  108. polars/io/__init__.py +0 -64
  109. polars/io/_utils.py +0 -317
  110. polars/io/avro.py +0 -49
  111. polars/io/clipboard.py +0 -36
  112. polars/io/cloud/__init__.py +0 -17
  113. polars/io/cloud/_utils.py +0 -80
  114. polars/io/cloud/credential_provider/__init__.py +0 -17
  115. polars/io/cloud/credential_provider/_builder.py +0 -520
  116. polars/io/cloud/credential_provider/_providers.py +0 -618
  117. polars/io/csv/__init__.py +0 -9
  118. polars/io/csv/_utils.py +0 -38
  119. polars/io/csv/batched_reader.py +0 -142
  120. polars/io/csv/functions.py +0 -1495
  121. polars/io/database/__init__.py +0 -6
  122. polars/io/database/_arrow_registry.py +0 -70
  123. polars/io/database/_cursor_proxies.py +0 -147
  124. polars/io/database/_executor.py +0 -578
  125. polars/io/database/_inference.py +0 -314
  126. polars/io/database/_utils.py +0 -144
  127. polars/io/database/functions.py +0 -516
  128. polars/io/delta.py +0 -499
  129. polars/io/iceberg/__init__.py +0 -3
  130. polars/io/iceberg/_utils.py +0 -697
  131. polars/io/iceberg/dataset.py +0 -556
  132. polars/io/iceberg/functions.py +0 -151
  133. polars/io/ipc/__init__.py +0 -8
  134. polars/io/ipc/functions.py +0 -514
  135. polars/io/json/__init__.py +0 -3
  136. polars/io/json/read.py +0 -101
  137. polars/io/ndjson.py +0 -332
  138. polars/io/parquet/__init__.py +0 -17
  139. polars/io/parquet/field_overwrites.py +0 -140
  140. polars/io/parquet/functions.py +0 -722
  141. polars/io/partition.py +0 -491
  142. polars/io/plugins.py +0 -187
  143. polars/io/pyarrow_dataset/__init__.py +0 -5
  144. polars/io/pyarrow_dataset/anonymous_scan.py +0 -109
  145. polars/io/pyarrow_dataset/functions.py +0 -79
  146. polars/io/scan_options/__init__.py +0 -5
  147. polars/io/scan_options/_options.py +0 -59
  148. polars/io/scan_options/cast_options.py +0 -126
  149. polars/io/spreadsheet/__init__.py +0 -6
  150. polars/io/spreadsheet/_utils.py +0 -52
  151. polars/io/spreadsheet/_write_utils.py +0 -647
  152. polars/io/spreadsheet/functions.py +0 -1323
  153. polars/lazyframe/__init__.py +0 -9
  154. polars/lazyframe/engine_config.py +0 -61
  155. polars/lazyframe/frame.py +0 -8564
  156. polars/lazyframe/group_by.py +0 -669
  157. polars/lazyframe/in_process.py +0 -42
  158. polars/lazyframe/opt_flags.py +0 -333
  159. polars/meta/__init__.py +0 -14
  160. polars/meta/build.py +0 -33
  161. polars/meta/index_type.py +0 -27
  162. polars/meta/thread_pool.py +0 -50
  163. polars/meta/versions.py +0 -120
  164. polars/ml/__init__.py +0 -0
  165. polars/ml/torch.py +0 -213
  166. polars/ml/utilities.py +0 -30
  167. polars/plugins.py +0 -155
  168. polars/py.typed +0 -0
  169. polars/pyproject.toml +0 -103
  170. polars/schema.py +0 -265
  171. polars/selectors.py +0 -3117
  172. polars/series/__init__.py +0 -5
  173. polars/series/array.py +0 -776
  174. polars/series/binary.py +0 -254
  175. polars/series/categorical.py +0 -246
  176. polars/series/datetime.py +0 -2275
  177. polars/series/list.py +0 -1087
  178. polars/series/plotting.py +0 -191
  179. polars/series/series.py +0 -9197
  180. polars/series/string.py +0 -2367
  181. polars/series/struct.py +0 -154
  182. polars/series/utils.py +0 -191
  183. polars/sql/__init__.py +0 -7
  184. polars/sql/context.py +0 -677
  185. polars/sql/functions.py +0 -139
  186. polars/string_cache.py +0 -185
  187. polars/testing/__init__.py +0 -13
  188. polars/testing/asserts/__init__.py +0 -9
  189. polars/testing/asserts/frame.py +0 -231
  190. polars/testing/asserts/series.py +0 -219
  191. polars/testing/asserts/utils.py +0 -12
  192. polars/testing/parametric/__init__.py +0 -33
  193. polars/testing/parametric/profiles.py +0 -107
  194. polars/testing/parametric/strategies/__init__.py +0 -22
  195. polars/testing/parametric/strategies/_utils.py +0 -14
  196. polars/testing/parametric/strategies/core.py +0 -615
  197. polars/testing/parametric/strategies/data.py +0 -452
  198. polars/testing/parametric/strategies/dtype.py +0 -436
  199. polars/testing/parametric/strategies/legacy.py +0 -169
  200. polars/type_aliases.py +0 -24
  201. polars_runtime_compat-1.34.0b3.dist-info/RECORD +0 -203
  202. {polars_runtime_compat-1.34.0b3.dist-info → polars_runtime_compat-1.34.0b4.dist-info}/WHEEL +0 -0
  203. {polars_runtime_compat-1.34.0b3.dist-info → polars_runtime_compat-1.34.0b4.dist-info}/licenses/LICENSE +0 -0
polars/config.py DELETED
@@ -1,1571 +0,0 @@
1
- from __future__ import annotations
2
-
3
- import contextlib
4
- import os
5
- from pathlib import Path
6
- from typing import TYPE_CHECKING, Literal, TypedDict, get_args
7
-
8
- from polars._dependencies import json
9
- from polars._typing import EngineType
10
- from polars._utils.deprecation import deprecated
11
- from polars._utils.unstable import unstable
12
- from polars._utils.various import normalize_filepath
13
- from polars.lazyframe.engine_config import GPUEngine
14
-
15
- if TYPE_CHECKING:
16
- import sys
17
- from types import TracebackType
18
-
19
- from polars._typing import FloatFmt
20
- from polars.io.cloud.credential_provider._providers import (
21
- CredentialProviderFunction,
22
- )
23
-
24
- if sys.version_info >= (3, 10):
25
- from typing import TypeAlias
26
- else:
27
- from typing_extensions import TypeAlias
28
-
29
- if sys.version_info >= (3, 11):
30
- from typing import Self, Unpack
31
- else:
32
- from typing_extensions import Self, Unpack
33
-
34
- if sys.version_info >= (3, 13):
35
- from warnings import deprecated
36
- else:
37
- from typing_extensions import deprecated # noqa: TC004
38
-
39
- __all__ = ["Config"]
40
-
41
- TableFormatNames: TypeAlias = Literal[
42
- "ASCII_FULL",
43
- "ASCII_FULL_CONDENSED",
44
- "ASCII_NO_BORDERS",
45
- "ASCII_BORDERS_ONLY",
46
- "ASCII_BORDERS_ONLY_CONDENSED",
47
- "ASCII_HORIZONTAL_ONLY",
48
- "ASCII_MARKDOWN",
49
- "MARKDOWN",
50
- "UTF8_FULL",
51
- "UTF8_FULL_CONDENSED",
52
- "UTF8_NO_BORDERS",
53
- "UTF8_BORDERS_ONLY",
54
- "UTF8_HORIZONTAL_ONLY",
55
- "NOTHING",
56
- ]
57
-
58
- # note: register all Config-specific environment variable names here; need to constrain
59
- # which 'POLARS_' environment variables are recognized, as there are other lower-level
60
- # and/or unstable settings that should not be saved or reset with the Config vars.
61
- _POLARS_CFG_ENV_VARS = {
62
- "POLARS_WARN_UNSTABLE",
63
- "POLARS_FMT_MAX_COLS",
64
- "POLARS_FMT_MAX_ROWS",
65
- "POLARS_FMT_NUM_DECIMAL",
66
- "POLARS_FMT_NUM_GROUP_SEPARATOR",
67
- "POLARS_FMT_NUM_LEN",
68
- "POLARS_FMT_STR_LEN",
69
- "POLARS_FMT_TABLE_CELL_ALIGNMENT",
70
- "POLARS_FMT_TABLE_CELL_LIST_LEN",
71
- "POLARS_FMT_TABLE_CELL_NUMERIC_ALIGNMENT",
72
- "POLARS_FMT_TABLE_DATAFRAME_SHAPE_BELOW",
73
- "POLARS_FMT_TABLE_FORMATTING",
74
- "POLARS_FMT_TABLE_HIDE_COLUMN_DATA_TYPES",
75
- "POLARS_FMT_TABLE_HIDE_COLUMN_NAMES",
76
- "POLARS_FMT_TABLE_HIDE_COLUMN_SEPARATOR",
77
- "POLARS_FMT_TABLE_HIDE_DATAFRAME_SHAPE_INFORMATION",
78
- "POLARS_FMT_TABLE_INLINE_COLUMN_DATA_TYPE",
79
- "POLARS_FMT_TABLE_ROUNDED_CORNERS",
80
- "POLARS_STREAMING_CHUNK_SIZE",
81
- "POLARS_TABLE_WIDTH",
82
- "POLARS_VERBOSE",
83
- "POLARS_MAX_EXPR_DEPTH",
84
- "POLARS_ENGINE_AFFINITY",
85
- }
86
-
87
- # vars that set the rust env directly should declare themselves here as the Config
88
- # method name paired with a callable that returns the current state of that value:
89
- with contextlib.suppress(ImportError, NameError):
90
- # note: 'plr' not available when building docs
91
- import polars._plr as plr
92
-
93
- _POLARS_CFG_DIRECT_VARS = {
94
- "set_fmt_float": plr.get_float_fmt,
95
- "set_float_precision": plr.get_float_precision,
96
- "set_thousands_separator": plr.get_thousands_separator,
97
- "set_decimal_separator": plr.get_decimal_separator,
98
- "set_trim_decimal_zeros": plr.get_trim_decimal_zeros,
99
- }
100
-
101
-
102
- class ConfigParameters(TypedDict, total=False):
103
- """Parameters supported by the polars Config."""
104
-
105
- ascii_tables: bool | None
106
- auto_structify: bool | None
107
- decimal_separator: str | None
108
- thousands_separator: str | bool | None
109
- float_precision: int | None
110
- fmt_float: FloatFmt | None
111
- fmt_str_lengths: int | None
112
- fmt_table_cell_list_len: int | None
113
- streaming_chunk_size: int | None
114
- tbl_cell_alignment: Literal["LEFT", "CENTER", "RIGHT"] | None
115
- tbl_cell_numeric_alignment: Literal["LEFT", "CENTER", "RIGHT"] | None
116
- tbl_cols: int | None
117
- tbl_column_data_type_inline: bool | None
118
- tbl_dataframe_shape_below: bool | None
119
- tbl_formatting: TableFormatNames | None
120
- tbl_hide_column_data_types: bool | None
121
- tbl_hide_column_names: bool | None
122
- tbl_hide_dtype_separator: bool | None
123
- tbl_hide_dataframe_shape: bool | None
124
- tbl_rows: int | None
125
- tbl_width_chars: int | None
126
- trim_decimal_zeros: bool | None
127
- verbose: bool | None
128
- expr_depth_warning: int
129
-
130
- set_ascii_tables: bool | None
131
- set_auto_structify: bool | None
132
- set_decimal_separator: str | None
133
- set_thousands_separator: str | bool | None
134
- set_float_precision: int | None
135
- set_fmt_float: FloatFmt | None
136
- set_fmt_str_lengths: int | None
137
- set_fmt_table_cell_list_len: int | None
138
- set_streaming_chunk_size: int | None
139
- set_tbl_cell_alignment: Literal["LEFT", "CENTER", "RIGHT"] | None
140
- set_tbl_cell_numeric_alignment: Literal["LEFT", "CENTER", "RIGHT"] | None
141
- set_tbl_cols: int | None
142
- set_tbl_column_data_type_inline: bool | None
143
- set_tbl_dataframe_shape_below: bool | None
144
- set_tbl_formatting: TableFormatNames | None
145
- set_tbl_hide_column_data_types: bool | None
146
- set_tbl_hide_column_names: bool | None
147
- set_tbl_hide_dtype_separator: bool | None
148
- set_tbl_hide_dataframe_shape: bool | None
149
- set_tbl_rows: int | None
150
- set_tbl_width_chars: int | None
151
- set_trim_decimal_zeros: bool | None
152
- set_verbose: bool | None
153
- set_expr_depth_warning: int
154
- set_engine_affinity: EngineType | None
155
-
156
-
157
- class Config(contextlib.ContextDecorator):
158
- """
159
- Configure polars; offers options for table formatting and more.
160
-
161
- Notes
162
- -----
163
- Can also be used as a context manager OR a function decorator in order to
164
- temporarily scope the lifetime of specific options. For example:
165
-
166
- >>> with pl.Config() as cfg:
167
- ... # set verbose for more detailed output within the scope
168
- ... cfg.set_verbose(True) # doctest: +IGNORE_RESULT
169
- >>> # scope exit - no longer in verbose mode
170
-
171
- This can also be written more compactly as:
172
-
173
- >>> with pl.Config(verbose=True):
174
- ... pass
175
-
176
- (The compact format is available for all `Config` methods that take a single value).
177
-
178
- Alternatively, you can use as a decorator in order to scope the duration of the
179
- selected options to a specific function:
180
-
181
- >>> @pl.Config(verbose=True)
182
- ... def test():
183
- ... pass
184
- """
185
-
186
- _context_options: ConfigParameters | None = None
187
- _original_state: str = ""
188
-
189
- def __init__(
190
- self,
191
- *,
192
- restore_defaults: bool = False,
193
- apply_on_context_enter: bool = False,
194
- **options: Unpack[ConfigParameters],
195
- ) -> None:
196
- """
197
- Initialise a Config object instance for context manager usage.
198
-
199
- Any `options` kwargs should correspond to the available named "set_*"
200
- methods, but are allowed to omit the "set_" prefix for brevity.
201
-
202
- Parameters
203
- ----------
204
- restore_defaults
205
- set all options to their default values (this is applied before
206
- setting any other options).
207
- apply_on_context_enter
208
- defer applying the options until a context is entered. This allows you
209
- to create multiple `Config` instances with different options, and then
210
- reuse them independently as context managers or function decorators
211
- with specific bundles of parameters.
212
- **options
213
- keyword args that will set the option; equivalent to calling the
214
- named "set_<option>" method with the given value.
215
-
216
- Examples
217
- --------
218
- Customise Polars table formatting while in context scope:
219
-
220
- >>> df = pl.DataFrame({"abc": [1.0, 2.5, 5.0], "xyz": [True, False, True]})
221
- >>> with pl.Config(
222
- ... # these options will be set for scope duration
223
- ... tbl_formatting="MARKDOWN",
224
- ... tbl_hide_dataframe_shape=True,
225
- ... tbl_rows=10,
226
- ... ):
227
- ... print(df)
228
- | abc | xyz |
229
- | --- | --- |
230
- | f64 | bool |
231
- |-----|-------|
232
- | 1.0 | true |
233
- | 2.5 | false |
234
- | 5.0 | true |
235
-
236
- Establish several independent Config instances for use in different contexts;
237
- setting `apply_on_context_enter=True` defers setting the parameters until a
238
- context (or function, when used as a decorator) is actually entered:
239
-
240
- >>> cfg_polars_verbose = pl.Config(
241
- ... verbose=True,
242
- ... apply_on_context_enter=True,
243
- ... )
244
- >>> cfg_polars_detailed_tables = pl.Config(
245
- ... tbl_rows=25,
246
- ... tbl_cols=25,
247
- ... tbl_width_chars=200,
248
- ... apply_on_context_enter=True,
249
- ... )
250
-
251
- These Config instances can now be applied independently and re-used:
252
-
253
- >>> @cfg_polars_verbose
254
- ... def traced_function(df: pl.DataFrame) -> pl.DataFrame:
255
- ... return polars_operations(df)
256
-
257
- >>> @cfg_polars_detailed_tables
258
- ... def print_detailed_frames(*frames: pl.DataFrame) -> None:
259
- ... for df in frames:
260
- ... print(df)
261
- """
262
- # save original state _before_ any changes are made
263
- self._original_state = self.save()
264
- if restore_defaults:
265
- self.restore_defaults()
266
-
267
- if apply_on_context_enter:
268
- # defer setting options; apply only on entering a new context
269
- self._context_options = options
270
- else:
271
- # apply the given options immediately
272
- self._set_config_params(**options)
273
- self._context_options = None
274
-
275
- def __enter__(self) -> Self:
276
- """Support setting Config options that are reset on scope exit."""
277
- self._original_state = self._original_state or self.save()
278
- if self._context_options:
279
- self._set_config_params(**self._context_options)
280
- return self
281
-
282
- def __exit__(
283
- self,
284
- exc_type: type[BaseException] | None,
285
- exc_val: BaseException | None,
286
- exc_tb: TracebackType | None,
287
- ) -> None:
288
- """Reset any Config options that were set within the scope."""
289
- self.restore_defaults().load(self._original_state)
290
- self._original_state = ""
291
-
292
- def __eq__(self, other: object) -> bool:
293
- if not isinstance(other, Config):
294
- return False
295
- return (self._original_state == other._original_state) and (
296
- self._context_options == other._context_options
297
- )
298
-
299
- def __ne__(self, other: object) -> bool:
300
- return not self.__eq__(other)
301
-
302
- def _set_config_params(self, **options: Unpack[ConfigParameters]) -> None:
303
- for opt, value in options.items():
304
- if not hasattr(self, opt) and not opt.startswith("set_"):
305
- opt = f"set_{opt}"
306
- if not hasattr(self, opt):
307
- msg = f"`Config` has no option {opt!r}"
308
- raise AttributeError(msg)
309
- getattr(self, opt)(value)
310
-
311
- @classmethod
312
- def load(cls, cfg: str) -> Config:
313
- """
314
- Load (and set) previously saved Config options from a JSON string.
315
-
316
- Parameters
317
- ----------
318
- cfg : str
319
- JSON string produced by `Config.save()`.
320
-
321
- See Also
322
- --------
323
- load_from_file : Load (and set) Config options from a JSON file.
324
- save : Save the current set of Config options as a JSON string or file.
325
- """
326
- try:
327
- options = json.loads(cfg)
328
- except json.JSONDecodeError as err:
329
- msg = "invalid Config string (did you mean to use `load_from_file`?)"
330
- raise ValueError(msg) from err
331
-
332
- cfg_load = Config()
333
- opts = options.get("environment", {})
334
- for key, opt in opts.items():
335
- if opt is None:
336
- os.environ.pop(key, None)
337
- else:
338
- os.environ[key] = opt
339
-
340
- for cfg_methodname, value in options.get("direct", {}).items():
341
- if hasattr(cfg_load, cfg_methodname):
342
- getattr(cfg_load, cfg_methodname)(value)
343
- return cfg_load
344
-
345
- @classmethod
346
- def load_from_file(cls, file: Path | str) -> Config:
347
- """
348
- Load (and set) previously saved Config options from file.
349
-
350
- Parameters
351
- ----------
352
- file : Path | str
353
- File path to a JSON string produced by `Config.save()`.
354
-
355
- See Also
356
- --------
357
- load : Load (and set) Config options from a JSON string.
358
- save : Save the current set of Config options as a JSON string or file.
359
- """
360
- try:
361
- options = Path(normalize_filepath(file)).read_text()
362
- except OSError as err:
363
- msg = f"invalid Config file (did you mean to use `load`?)\n{err}"
364
- raise ValueError(msg) from err
365
-
366
- return cls.load(options)
367
-
368
- @classmethod
369
- def restore_defaults(cls) -> type[Config]:
370
- """
371
- Reset all polars Config settings to their default state.
372
-
373
- Notes
374
- -----
375
- This method operates by removing all Config options from the environment,
376
- and then setting any local (non-env) options back to their default value.
377
-
378
- Examples
379
- --------
380
- >>> cfg = pl.Config.restore_defaults() # doctest: +SKIP
381
- """
382
- # unset all Config environment variables
383
- for var in _POLARS_CFG_ENV_VARS:
384
- os.environ.pop(var, None)
385
-
386
- # reset all 'direct' defaults
387
- for method in _POLARS_CFG_DIRECT_VARS:
388
- getattr(cls, method)(None)
389
-
390
- return cls
391
-
392
- @classmethod
393
- def save(cls, *, if_set: bool = False) -> str:
394
- """
395
- Save the current set of Config options as a JSON string.
396
-
397
- Parameters
398
- ----------
399
- if_set
400
- By default this will save the state of all configuration options; set
401
- to `False` to save only those that have been set to a non-default value.
402
-
403
- See Also
404
- --------
405
- load : Load (and set) Config options from a JSON string.
406
- load_from_file : Load (and set) Config options from a JSON file.
407
- save_to_file : Save the current set of Config options as a JSON file.
408
-
409
- Examples
410
- --------
411
- >>> json_state = pl.Config.save()
412
-
413
- Returns
414
- -------
415
- str
416
- JSON string containing current Config options.
417
- """
418
- environment_vars = {
419
- key: os.environ.get(key)
420
- for key in sorted(_POLARS_CFG_ENV_VARS)
421
- if not if_set or (os.environ.get(key) is not None)
422
- }
423
- direct_vars = {
424
- cfg_methodname: get_value()
425
- for cfg_methodname, get_value in _POLARS_CFG_DIRECT_VARS.items()
426
- }
427
- options = json.dumps(
428
- {"environment": environment_vars, "direct": direct_vars},
429
- separators=(",", ":"),
430
- )
431
- return options
432
-
433
- @classmethod
434
- def save_to_file(cls, file: Path | str) -> None:
435
- """
436
- Save the current set of Config options as a JSON file.
437
-
438
- Parameters
439
- ----------
440
- file
441
- Optional path to a file into which the JSON string will be written.
442
- Leave as `None` to return the JSON string directly.
443
-
444
- See Also
445
- --------
446
- load : Load (and set) Config options from a JSON string.
447
- load_from_file : Load (and set) Config options from a JSON file.
448
- save : Save the current set of Config options as a JSON string.
449
-
450
- Examples
451
- --------
452
- >>> pl.Config().save_to_file("~/polars/config.json") # doctest: +SKIP
453
- """
454
- file = Path(normalize_filepath(file)).resolve()
455
- file.write_text(cls.save())
456
-
457
- @classmethod
458
- def state(
459
- cls, *, if_set: bool = False, env_only: bool = False
460
- ) -> dict[str, str | None]:
461
- """
462
- Show the current state of all Config variables in the environment as a dict.
463
-
464
- Parameters
465
- ----------
466
- if_set
467
- By default this will show the state of all `Config` environment variables.
468
- change this to `True` to restrict the returned dictionary to include only
469
- those that have been set to a specific value.
470
- env_only
471
- Include only Config environment variables in the output; some options (such
472
- as "set_fmt_float") are set directly, not via an environment variable.
473
-
474
- Examples
475
- --------
476
- >>> set_state = pl.Config.state(if_set=True)
477
- >>> all_state = pl.Config.state()
478
- """
479
- config_state = {
480
- var: os.environ.get(var)
481
- for var in sorted(_POLARS_CFG_ENV_VARS)
482
- if not if_set or (os.environ.get(var) is not None)
483
- }
484
- if not env_only:
485
- for cfg_methodname, get_value in _POLARS_CFG_DIRECT_VARS.items():
486
- config_state[cfg_methodname] = get_value() # type: ignore[assignment]
487
-
488
- return config_state
489
-
490
- @classmethod
491
- def set_ascii_tables(cls, active: bool | None = True) -> type[Config]:
492
- """
493
- Use ASCII characters to display table outlines.
494
-
495
- Set False to revert to the standard UTF8_FULL_CONDENSED formatting style.
496
-
497
- See Also
498
- --------
499
- set_tbl_formatting : Set the table formatting style (includes Markdown option).
500
-
501
- Examples
502
- --------
503
- >>> df = pl.DataFrame({"abc": [1.0, 2.5, 5.0], "xyz": [True, False, True]})
504
- >>> pl.Config.set_ascii_tables(True) # doctest: +SKIP
505
- # ...
506
- # shape: (3, 2) shape: (3, 2)
507
- # ┌─────┬───────┐ +-----+-------+
508
- # │ abc ┆ xyz │ | abc | xyz |
509
- # │ --- ┆ --- │ | --- | --- |
510
- # │ f64 ┆ bool │ | f64 | bool |
511
- # ╞═════╪═══════╡ +=============+
512
- # │ 1.0 ┆ true │ >> | 1.0 | true |
513
- # │ 2.5 ┆ false │ | 2.5 | false |
514
- # │ 5.0 ┆ true │ | 5.0 | true |
515
- # └─────┴───────┘ +-----+-------+
516
- """
517
- if active is None:
518
- os.environ.pop("POLARS_FMT_TABLE_FORMATTING", None)
519
- else:
520
- fmt = "ASCII_FULL_CONDENSED" if active else "UTF8_FULL_CONDENSED"
521
- os.environ["POLARS_FMT_TABLE_FORMATTING"] = fmt
522
- return cls
523
-
524
- @classmethod
525
- @deprecated("deprecated since version 1.32.0")
526
- def set_auto_structify(cls, active: bool | None = False) -> type[Config]:
527
- """
528
- Allow multi-output expressions to be automatically turned into Structs.
529
-
530
- .. note::
531
- Deprecated since 1.32.0.
532
-
533
- Examples
534
- --------
535
- >>> df = pl.DataFrame({"v": [1, 2, 3], "v2": [4, 5, 6]})
536
- >>> with pl.Config(set_auto_structify=True): # doctest: +SKIP
537
- ... out = df.select(pl.all())
538
- >>> out # doctest: +SKIP
539
- shape: (3, 1)
540
- ┌───────────┐
541
- │ v │
542
- │ --- │
543
- │ struct[2] │
544
- ╞═══════════╡
545
- │ {1,4} │
546
- │ {2,5} │
547
- │ {3,6} │
548
- └───────────┘
549
- """
550
- if active is None:
551
- os.environ.pop("POLARS_AUTO_STRUCTIFY", None)
552
- else:
553
- os.environ["POLARS_AUTO_STRUCTIFY"] = str(int(active))
554
- return cls
555
-
556
- @classmethod
557
- def set_decimal_separator(cls, separator: str | None = None) -> type[Config]:
558
- """
559
- Set the decimal separator character.
560
-
561
- Parameters
562
- ----------
563
- separator : str, bool
564
- Character to use as the decimal separator.
565
- Set to ``None`` to revert to the default (".").
566
-
567
- See Also
568
- --------
569
- set_thousands_separator : Set the thousands grouping separator character.
570
-
571
- Examples
572
- --------
573
- >>> df = pl.DataFrame({"v": [9876.54321, 1010101.0, -123456.78]})
574
- >>> with pl.Config(
575
- ... tbl_cell_numeric_alignment="RIGHT",
576
- ... thousands_separator=".",
577
- ... decimal_separator=",",
578
- ... float_precision=3,
579
- ... ):
580
- ... print(df)
581
- shape: (3, 1)
582
- ┌───────────────┐
583
- │ v │
584
- │ --- │
585
- │ f64 │
586
- ╞═══════════════╡
587
- │ 9.876,543 │
588
- │ 1.010.101,000 │
589
- │ -123.456,780 │
590
- └───────────────┘
591
- """
592
- if isinstance(separator, str) and len(separator) != 1:
593
- msg = f"`separator` must be a single character; found {separator!r}"
594
- raise ValueError(msg)
595
- plr.set_decimal_separator(sep=separator)
596
- return cls
597
-
598
- @classmethod
599
- def set_thousands_separator(
600
- cls, separator: str | bool | None = None
601
- ) -> type[Config]:
602
- """
603
- Set the thousands grouping separator character.
604
-
605
- Parameters
606
- ----------
607
- separator : str, bool
608
- Set True to use the default "," (thousands) and "." (decimal) separators.
609
- Can also set a custom char, or set ``None`` to omit the separator.
610
-
611
- See Also
612
- --------
613
- set_decimal_separator : Set the decimal separator character.
614
-
615
- Examples
616
- --------
617
- >>> df = pl.DataFrame(
618
- ... {
619
- ... "x": [1234567, -987654, 10101],
620
- ... "y": [1234.5, 100000.0, -7654321.25],
621
- ... }
622
- ... )
623
- >>> with pl.Config(
624
- ... tbl_cell_numeric_alignment="RIGHT",
625
- ... thousands_separator=True,
626
- ... float_precision=2,
627
- ... ):
628
- ... print(df)
629
- shape: (3, 2)
630
- ┌───────────┬───────────────┐
631
- │ x ┆ y │
632
- │ --- ┆ --- │
633
- │ i64 ┆ f64 │
634
- ╞═══════════╪═══════════════╡
635
- │ 1,234,567 ┆ 1,234.50 │
636
- │ -987,654 ┆ 100,000.00 │
637
- │ 10,101 ┆ -7,654,321.25 │
638
- └───────────┴───────────────┘
639
- >>> with pl.Config(
640
- ... tbl_cell_numeric_alignment="RIGHT",
641
- ... thousands_separator=".",
642
- ... decimal_separator=",",
643
- ... float_precision=2,
644
- ... ):
645
- ... print(df)
646
- shape: (3, 2)
647
- ┌───────────┬───────────────┐
648
- │ x ┆ y │
649
- │ --- ┆ --- │
650
- │ i64 ┆ f64 │
651
- ╞═══════════╪═══════════════╡
652
- │ 1.234.567 ┆ 1.234,50 │
653
- │ -987.654 ┆ 100.000,00 │
654
- │ 10.101 ┆ -7.654.321,25 │
655
- └───────────┴───────────────┘
656
- """
657
- if separator is True:
658
- plr.set_decimal_separator(sep=".")
659
- plr.set_thousands_separator(sep=",")
660
- else:
661
- if isinstance(separator, str) and len(separator) > 1:
662
- msg = f"`separator` must be a single character; found {separator!r}"
663
- raise ValueError(msg)
664
- plr.set_thousands_separator(sep=separator or None)
665
- return cls
666
-
667
- @classmethod
668
- def set_float_precision(cls, precision: int | None = None) -> type[Config]:
669
- """
670
- Control the number of decimal places displayed for floating point values.
671
-
672
- Parameters
673
- ----------
674
- precision : int
675
- Number of decimal places to display; set to `None` to revert to the
676
- default/standard behaviour.
677
-
678
- Notes
679
- -----
680
- When setting this to a larger value you should ensure that you are aware of both
681
- the limitations of floating point representations, and of the precision of the
682
- data that you are looking at.
683
-
684
- This setting only applies to Float32 and Float64 dtypes; it does not cover
685
- Decimal dtype values (which are displayed at their native level of precision).
686
-
687
- Examples
688
- --------
689
- Set a large maximum float precision:
690
-
691
- >>> from math import pi, e
692
- >>> df = pl.DataFrame({"const": ["pi", "e"], "value": [pi, e]})
693
- >>> with pl.Config(float_precision=15):
694
- ... print(df)
695
- shape: (2, 2)
696
- ┌───────┬───────────────────┐
697
- │ const ┆ value │
698
- │ --- ┆ --- │
699
- │ str ┆ f64 │
700
- ╞═══════╪═══════════════════╡
701
- │ pi ┆ 3.141592653589793 │
702
- │ e ┆ 2.718281828459045 │
703
- └───────┴───────────────────┘
704
-
705
- Set a fixed float precision and align numeric columns to the
706
- right in order to cleanly line-up the decimal separator:
707
-
708
- >>> df = pl.DataFrame(
709
- ... {
710
- ... "a": ["xx", "yy"],
711
- ... "b": [-11111111, 44444444444],
712
- ... "c": [100000.987654321, -23456789],
713
- ... }
714
- ... )
715
- >>> with pl.Config(
716
- ... tbl_cell_numeric_alignment="RIGHT",
717
- ... thousands_separator=",",
718
- ... float_precision=3,
719
- ... ):
720
- ... print(df)
721
- shape: (2, 3)
722
- ┌─────┬────────────────┬─────────────────┐
723
- │ a ┆ b ┆ c │
724
- │ --- ┆ --- ┆ --- │
725
- │ str ┆ i64 ┆ f64 │
726
- ╞═════╪════════════════╪═════════════════╡
727
- │ xx ┆ -11,111,111 ┆ 100,000.988 │
728
- │ yy ┆ 44,444,444,444 ┆ -23,456,789.000 │
729
- └─────┴────────────────┴─────────────────┘
730
- """
731
- plr.set_float_precision(precision)
732
- return cls
733
-
734
- @classmethod
735
- def set_fmt_float(cls, fmt: FloatFmt | None = "mixed") -> type[Config]:
736
- """
737
- Control how floating point values are displayed.
738
-
739
- Parameters
740
- ----------
741
- fmt : {"mixed", "full"}
742
- How to format floating point numbers:
743
-
744
- - "mixed": Limit the number of decimal places and use scientific
745
- notation for large/small values.
746
- - "full": Print the full precision of the floating point number.
747
-
748
- Examples
749
- --------
750
- "mixed" float formatting:
751
-
752
- >>> s = pl.Series([1.2304980958725870923, 1e6, 1e-8])
753
- >>> with pl.Config(set_fmt_float="mixed"):
754
- ... print(s)
755
- shape: (3,)
756
- Series: '' [f64]
757
- [
758
- 1.230498
759
- 1e6
760
- 1.0000e-8
761
- ]
762
-
763
- "full" float formatting:
764
-
765
- >>> with pl.Config(set_fmt_float="full"):
766
- ... print(s)
767
- shape: (3,)
768
- Series: '' [f64]
769
- [
770
- 1.230498095872587
771
- 1000000
772
- 0.00000001
773
- ]
774
- """
775
- plr.set_float_fmt(fmt="mixed" if fmt is None else fmt)
776
- return cls
777
-
778
- @classmethod
779
- def set_fmt_str_lengths(cls, n: int | None) -> type[Config]:
780
- """
781
- Set the number of characters used to display string values.
782
-
783
- Parameters
784
- ----------
785
- n : int
786
- Number of characters to display.
787
-
788
- Examples
789
- --------
790
- >>> df = pl.DataFrame(
791
- ... {
792
- ... "txt": [
793
- ... "Play it, Sam. Play 'As Time Goes By'.",
794
- ... "This is the beginning of a beautiful friendship.",
795
- ... ]
796
- ... }
797
- ... )
798
- >>> df.with_columns(pl.col("txt").str.len_bytes().alias("len"))
799
- shape: (2, 2)
800
- ┌─────────────────────────────────┬─────┐
801
- │ txt ┆ len │
802
- │ --- ┆ --- │
803
- │ str ┆ u32 │
804
- ╞═════════════════════════════════╪═════╡
805
- │ Play it, Sam. Play 'As Time Go… ┆ 37 │
806
- │ This is the beginning of a bea… ┆ 48 │
807
- └─────────────────────────────────┴─────┘
808
- >>> with pl.Config(fmt_str_lengths=50):
809
- ... print(df)
810
- shape: (2, 1)
811
- ┌──────────────────────────────────────────────────┐
812
- │ txt │
813
- │ --- │
814
- │ str │
815
- ╞══════════════════════════════════════════════════╡
816
- │ Play it, Sam. Play 'As Time Goes By'. │
817
- │ This is the beginning of a beautiful friendship. │
818
- └──────────────────────────────────────────────────┘
819
- """
820
- if n is None:
821
- os.environ.pop("POLARS_FMT_STR_LEN", None)
822
- else:
823
- if n <= 0:
824
- msg = "number of characters must be > 0"
825
- raise ValueError(msg)
826
-
827
- os.environ["POLARS_FMT_STR_LEN"] = str(n)
828
- return cls
829
-
830
- @classmethod
831
- def set_fmt_table_cell_list_len(cls, n: int | None) -> type[Config]:
832
- """
833
- Set the number of elements to display for List values.
834
-
835
- Empty lists will always print "[]". Negative values will result in all values
836
- being printed. A value of 0 will always "[…]" for lists with contents. A value
837
- of 1 will print only the final item in the list.
838
-
839
- Parameters
840
- ----------
841
- n : int
842
- Number of values to display.
843
-
844
- Examples
845
- --------
846
- >>> df = pl.DataFrame(
847
- ... {
848
- ... "nums": [
849
- ... [1, 2, 3, 4, 5, 6],
850
- ... ]
851
- ... }
852
- ... )
853
- >>> df
854
- shape: (1, 1)
855
- ┌─────────────┐
856
- │ nums │
857
- │ --- │
858
- │ list[i64] │
859
- ╞═════════════╡
860
- │ [1, 2, … 6] │
861
- └─────────────┘
862
- >>> with pl.Config(fmt_table_cell_list_len=10):
863
- ... print(df)
864
- shape: (1, 1)
865
- ┌────────────────────┐
866
- │ nums │
867
- │ --- │
868
- │ list[i64] │
869
- ╞════════════════════╡
870
- │ [1, 2, 3, 4, 5, 6] │
871
- └────────────────────┘
872
- """
873
- if n is None:
874
- os.environ.pop("POLARS_FMT_TABLE_CELL_LIST_LEN", None)
875
- else:
876
- os.environ["POLARS_FMT_TABLE_CELL_LIST_LEN"] = str(n)
877
- return cls
878
-
879
- @classmethod
880
- def set_streaming_chunk_size(cls, size: int | None) -> type[Config]:
881
- """
882
- Overwrite chunk size used in `streaming` engine.
883
-
884
- By default, the chunk size is determined by the schema
885
- and size of the thread pool. For some datasets (esp.
886
- when you have large string elements) this can be too
887
- optimistic and lead to Out of Memory errors.
888
-
889
- Parameters
890
- ----------
891
- size
892
- Number of rows per chunk. Every thread will process chunks
893
- of this size.
894
- """
895
- if size is None:
896
- os.environ.pop("POLARS_STREAMING_CHUNK_SIZE", None)
897
- else:
898
- if size < 1:
899
- msg = "number of rows per chunk must be >= 1"
900
- raise ValueError(msg)
901
-
902
- os.environ["POLARS_STREAMING_CHUNK_SIZE"] = str(size)
903
- return cls
904
-
905
- @classmethod
906
- def set_tbl_cell_alignment(
907
- cls, format: Literal["LEFT", "CENTER", "RIGHT"] | None
908
- ) -> type[Config]:
909
- """
910
- Set table cell alignment.
911
-
912
- Parameters
913
- ----------
914
- format : str
915
- * "LEFT": left aligned
916
- * "CENTER": center aligned
917
- * "RIGHT": right aligned
918
-
919
- Examples
920
- --------
921
- >>> df = pl.DataFrame(
922
- ... {"column_abc": [1.0, 2.5, 5.0], "column_xyz": [True, False, True]}
923
- ... )
924
- >>> pl.Config.set_tbl_cell_alignment("RIGHT") # doctest: +IGNORE_RESULT
925
- >>> print(df)
926
- shape: (3, 2)
927
- ┌────────────┬────────────┐
928
- │ column_abc ┆ column_xyz │
929
- │ --- ┆ --- │
930
- │ f64 ┆ bool │
931
- ╞════════════╪════════════╡
932
- │ 1.0 ┆ true │
933
- │ 2.5 ┆ false │
934
- │ 5.0 ┆ true │
935
- └────────────┴────────────┘
936
-
937
- Raises
938
- ------
939
- ValueError: if alignment string not recognised.
940
- """
941
- if format is None:
942
- os.environ.pop("POLARS_FMT_TABLE_CELL_ALIGNMENT", None)
943
- elif format not in {"LEFT", "CENTER", "RIGHT"}:
944
- msg = f"invalid alignment: {format!r}"
945
- raise ValueError(msg)
946
- else:
947
- os.environ["POLARS_FMT_TABLE_CELL_ALIGNMENT"] = format
948
- return cls
949
-
950
- @classmethod
951
- def set_tbl_cell_numeric_alignment(
952
- cls, format: Literal["LEFT", "CENTER", "RIGHT"] | None
953
- ) -> type[Config]:
954
- """
955
- Set table cell alignment for numeric columns.
956
-
957
- Parameters
958
- ----------
959
- format : str
960
- * "LEFT": left aligned
961
- * "CENTER": center aligned
962
- * "RIGHT": right aligned
963
-
964
- Examples
965
- --------
966
- >>> from datetime import date
967
- >>> df = pl.DataFrame(
968
- ... {
969
- ... "abc": [11, 2, 333],
970
- ... "mno": [date(2023, 10, 29), None, date(2001, 7, 5)],
971
- ... "xyz": [True, False, None],
972
- ... }
973
- ... )
974
- >>> pl.Config.set_tbl_cell_numeric_alignment("RIGHT") # doctest: +IGNORE_RESULT
975
- >>> print(df)
976
- shape: (3, 3)
977
- ┌─────┬────────────┬───────┐
978
- │ abc ┆ mno ┆ xyz │
979
- │ --- ┆ --- ┆ --- │
980
- │ i64 ┆ date ┆ bool │
981
- ╞═════╪════════════╪═══════╡
982
- │ 11 ┆ 2023-10-29 ┆ true │
983
- │ 2 ┆ null ┆ false │
984
- │ 333 ┆ 2001-07-05 ┆ null │
985
- └─────┴────────────┴───────┘
986
-
987
- Raises
988
- ------
989
- KeyError: if alignment string not recognised.
990
- """
991
- if format is None:
992
- os.environ.pop("POLARS_FMT_TABLE_CELL_NUMERIC_ALIGNMENT", None)
993
- elif format not in {"LEFT", "CENTER", "RIGHT"}:
994
- msg = f"invalid alignment: {format!r}"
995
- raise ValueError(msg)
996
- else:
997
- os.environ["POLARS_FMT_TABLE_CELL_NUMERIC_ALIGNMENT"] = format
998
- return cls
999
-
1000
- @classmethod
1001
- def set_tbl_cols(cls, n: int | None) -> type[Config]:
1002
- """
1003
- Set the number of columns that are visible when displaying tables.
1004
-
1005
- Parameters
1006
- ----------
1007
- n : int
1008
- Number of columns to display; if `n < 0` (eg: -1), display all columns.
1009
-
1010
- Examples
1011
- --------
1012
- Set number of displayed columns to a low value:
1013
-
1014
- >>> with pl.Config() as cfg:
1015
- ... cfg.set_tbl_cols(5)
1016
- ... df = pl.DataFrame({str(i): [i] for i in range(100)})
1017
- ... print(df)
1018
- <class 'polars.config.Config'>
1019
- shape: (1, 100)
1020
- ┌─────┬─────┬─────┬───┬─────┬─────┐
1021
- │ 0 ┆ 1 ┆ 2 ┆ … ┆ 98 ┆ 99 │
1022
- │ --- ┆ --- ┆ --- ┆ ┆ --- ┆ --- │
1023
- │ i64 ┆ i64 ┆ i64 ┆ ┆ i64 ┆ i64 │
1024
- ╞═════╪═════╪═════╪═══╪═════╪═════╡
1025
- │ 0 ┆ 1 ┆ 2 ┆ … ┆ 98 ┆ 99 │
1026
- └─────┴─────┴─────┴───┴─────┴─────┘
1027
-
1028
- >>> with pl.Config(tbl_cols=10):
1029
- ... print(df)
1030
- shape: (1, 100)
1031
- ┌─────┬─────┬─────┬─────┬─────┬───┬─────┬─────┬─────┬─────┬─────┐
1032
- │ 0 ┆ 1 ┆ 2 ┆ 3 ┆ 4 ┆ … ┆ 95 ┆ 96 ┆ 97 ┆ 98 ┆ 99 │
1033
- │ --- ┆ --- ┆ --- ┆ --- ┆ --- ┆ ┆ --- ┆ --- ┆ --- ┆ --- ┆ --- │
1034
- │ i64 ┆ i64 ┆ i64 ┆ i64 ┆ i64 ┆ ┆ i64 ┆ i64 ┆ i64 ┆ i64 ┆ i64 │
1035
- ╞═════╪═════╪═════╪═════╪═════╪═══╪═════╪═════╪═════╪═════╪═════╡
1036
- │ 0 ┆ 1 ┆ 2 ┆ 3 ┆ 4 ┆ … ┆ 95 ┆ 96 ┆ 97 ┆ 98 ┆ 99 │
1037
- └─────┴─────┴─────┴─────┴─────┴───┴─────┴─────┴─────┴─────┴─────┘
1038
- """
1039
- if n is None:
1040
- os.environ.pop("POLARS_FMT_MAX_COLS", None)
1041
- else:
1042
- os.environ["POLARS_FMT_MAX_COLS"] = str(n)
1043
- return cls
1044
-
1045
- @classmethod
1046
- def set_tbl_column_data_type_inline(
1047
- cls, active: bool | None = True
1048
- ) -> type[Config]:
1049
- """
1050
- Display the data type next to the column name (to the right, in parentheses).
1051
-
1052
- Examples
1053
- --------
1054
- >>> df = pl.DataFrame({"abc": [1.0, 2.5, 5.0], "xyz": [True, False, True]})
1055
- >>> pl.Config.set_tbl_column_data_type_inline(True) # doctest: +SKIP
1056
- # ...
1057
- # shape: (3, 2) shape: (3, 2)
1058
- # ┌─────┬───────┐ ┌───────────┬────────────┐
1059
- # │ abc ┆ xyz │ │ abc (f64) ┆ xyz (bool) │
1060
- # │ --- ┆ --- │ ╞═══════════╪════════════╡
1061
- # │ f64 ┆ bool │ │ 1.0 ┆ true │
1062
- # ╞═════╪═══════╡ >> │ 2.5 ┆ false │
1063
- # │ 1.0 ┆ true │ │ 5.0 ┆ true │
1064
- # │ 2.5 ┆ false │ └───────────┴────────────┘
1065
- # │ 5.0 ┆ true │
1066
- # └─────┴───────┘
1067
- """
1068
- if active is None:
1069
- os.environ.pop("POLARS_FMT_TABLE_INLINE_COLUMN_DATA_TYPE", None)
1070
- else:
1071
- os.environ["POLARS_FMT_TABLE_INLINE_COLUMN_DATA_TYPE"] = str(int(active))
1072
- return cls
1073
-
1074
- @classmethod
1075
- def set_tbl_dataframe_shape_below(cls, active: bool | None = True) -> type[Config]:
1076
- """
1077
- Print the DataFrame shape information below the data when displaying tables.
1078
-
1079
- Examples
1080
- --------
1081
- >>> df = pl.DataFrame({"abc": [1.0, 2.5, 5.0], "xyz": [True, False, True]})
1082
- >>> pl.Config.set_tbl_dataframe_shape_below(True) # doctest: +SKIP
1083
- # ...
1084
- # shape: (3, 2) ┌─────┬───────┐
1085
- # ┌─────┬───────┐ │ abc ┆ xyz │
1086
- # │ abc ┆ xyz │ │ --- ┆ --- │
1087
- # │ --- ┆ --- │ │ f64 ┆ bool │
1088
- # │ f64 ┆ bool │ ╞═════╪═══════╡
1089
- # ╞═════╪═══════╡ >> │ 1.0 ┆ true │
1090
- # │ 1.0 ┆ true │ │ 2.5 ┆ false │
1091
- # │ 2.5 ┆ false │ │ 5.0 ┆ true │
1092
- # │ 5.0 ┆ true │ └─────┴───────┘
1093
- # └─────┴───────┘ shape: (3, 2)
1094
- """
1095
- if active is None:
1096
- os.environ.pop("POLARS_FMT_TABLE_DATAFRAME_SHAPE_BELOW", None)
1097
- else:
1098
- os.environ["POLARS_FMT_TABLE_DATAFRAME_SHAPE_BELOW"] = str(int(active))
1099
- return cls
1100
-
1101
- @classmethod
1102
- def set_tbl_formatting(
1103
- cls,
1104
- format: TableFormatNames | None = None,
1105
- rounded_corners: bool | None = False,
1106
- ) -> type[Config]:
1107
- """
1108
- Set table formatting style.
1109
-
1110
- Parameters
1111
- ----------
1112
- format : str
1113
- * "ASCII_FULL": ASCII, with all borders and lines, including row dividers.
1114
- * "ASCII_FULL_CONDENSED": Same as ASCII_FULL, but with dense row spacing.
1115
- * "ASCII_NO_BORDERS": ASCII, no borders.
1116
- * "ASCII_BORDERS_ONLY": ASCII, borders only.
1117
- * "ASCII_BORDERS_ONLY_CONDENSED": ASCII, borders only, dense row spacing.
1118
- * "ASCII_HORIZONTAL_ONLY": ASCII, horizontal lines only.
1119
- * "ASCII_MARKDOWN": Markdown format (ascii ellipses for truncated values).
1120
- * "MARKDOWN": Markdown format (utf8 ellipses for truncated values).
1121
- * "UTF8_FULL": UTF8, with all borders and lines, including row dividers.
1122
- * "UTF8_FULL_CONDENSED": Same as UTF8_FULL, but with dense row spacing.
1123
- * "UTF8_NO_BORDERS": UTF8, no borders.
1124
- * "UTF8_BORDERS_ONLY": UTF8, borders only.
1125
- * "UTF8_HORIZONTAL_ONLY": UTF8, horizontal lines only.
1126
- * "NOTHING": No borders or other lines.
1127
-
1128
- rounded_corners : bool
1129
- Apply rounded corners to UTF8-styled tables (no-op for ASCII formats).
1130
-
1131
- Notes
1132
- -----
1133
- The UTF8 styles all use one or more of the semigraphic box-drawing characters
1134
- found in the Unicode Box Drawing block, which are not ASCII compatible:
1135
- https://en.wikipedia.org/wiki/Box-drawing_character#Box_Drawing
1136
-
1137
- Examples
1138
- --------
1139
- >>> df = pl.DataFrame(
1140
- ... {"abc": [-2.5, 5.0], "mno": ["hello", "world"], "xyz": [True, False]}
1141
- ... )
1142
- >>> with pl.Config(
1143
- ... tbl_formatting="MARKDOWN",
1144
- ... tbl_hide_column_data_types=True,
1145
- ... tbl_hide_dataframe_shape=True,
1146
- ... ):
1147
- ... print(df)
1148
- | abc | mno | xyz |
1149
- |------|-------|-------|
1150
- | -2.5 | hello | true |
1151
- | 5.0 | world | false |
1152
-
1153
- Raises
1154
- ------
1155
- ValueError: if format string not recognised.
1156
- """
1157
- # note: can see what the different styles look like in the comfy-table tests
1158
- # https://github.com/Nukesor/comfy-table/blob/main/tests/all/presets_test.rs
1159
- if format is None:
1160
- os.environ.pop("POLARS_FMT_TABLE_FORMATTING", None)
1161
- else:
1162
- valid_format_names = get_args(TableFormatNames)
1163
- if format not in valid_format_names:
1164
- msg = f"invalid table format name: {format!r}\nExpected one of: {', '.join(valid_format_names)}"
1165
- raise ValueError(msg)
1166
- os.environ["POLARS_FMT_TABLE_FORMATTING"] = format
1167
-
1168
- if rounded_corners is None:
1169
- os.environ.pop("POLARS_FMT_TABLE_ROUNDED_CORNERS", None)
1170
- else:
1171
- os.environ["POLARS_FMT_TABLE_ROUNDED_CORNERS"] = str(int(rounded_corners))
1172
-
1173
- return cls
1174
-
1175
- @classmethod
1176
- def set_tbl_hide_column_data_types(cls, active: bool | None = True) -> type[Config]:
1177
- """
1178
- Hide table column data types (i64, f64, str etc.).
1179
-
1180
- Examples
1181
- --------
1182
- >>> df = pl.DataFrame({"abc": [1.0, 2.5, 5.0], "xyz": [True, False, True]})
1183
- >>> pl.Config.set_tbl_hide_column_data_types(True) # doctest: +SKIP
1184
- # ...
1185
- # shape: (3, 2) shape: (3, 2)
1186
- # ┌─────┬───────┐ ┌─────┬───────┐
1187
- # │ abc ┆ xyz │ │ abc ┆ xyz │
1188
- # │ --- ┆ --- │ ╞═════╪═══════╡
1189
- # │ f64 ┆ bool │ │ 1.0 ┆ true │
1190
- # ╞═════╪═══════╡ >> │ 2.5 ┆ false │
1191
- # │ 1.0 ┆ true │ │ 5.0 ┆ true │
1192
- # │ 2.5 ┆ false │ └─────┴───────┘
1193
- # │ 5.0 ┆ true │
1194
- # └─────┴───────┘
1195
- """
1196
- if active is None:
1197
- os.environ.pop("POLARS_FMT_TABLE_HIDE_COLUMN_DATA_TYPES", None)
1198
- else:
1199
- os.environ["POLARS_FMT_TABLE_HIDE_COLUMN_DATA_TYPES"] = str(int(active))
1200
- return cls
1201
-
1202
- @classmethod
1203
- def set_tbl_hide_column_names(cls, active: bool | None = True) -> type[Config]:
1204
- """
1205
- Hide table column names.
1206
-
1207
- Examples
1208
- --------
1209
- >>> df = pl.DataFrame({"abc": [1.0, 2.5, 5.0], "xyz": [True, False, True]})
1210
- >>> pl.Config.set_tbl_hide_column_names(True) # doctest: +SKIP
1211
- # ...
1212
- # shape: (3, 2) shape: (3, 2)
1213
- # ┌─────┬───────┐ ┌─────┬───────┐
1214
- # │ abc ┆ xyz │ │ f64 ┆ bool │
1215
- # │ --- ┆ --- │ ╞═════╪═══════╡
1216
- # │ f64 ┆ bool │ │ 1.0 ┆ true │
1217
- # ╞═════╪═══════╡ >> │ 2.5 ┆ false │
1218
- # │ 1.0 ┆ true │ │ 5.0 ┆ true │
1219
- # │ 2.5 ┆ false │ └─────┴───────┘
1220
- # │ 5.0 ┆ true │
1221
- # └─────┴───────┘
1222
- """
1223
- if active is None:
1224
- os.environ.pop("POLARS_FMT_TABLE_HIDE_COLUMN_NAMES", None)
1225
- else:
1226
- os.environ["POLARS_FMT_TABLE_HIDE_COLUMN_NAMES"] = str(int(active))
1227
- return cls
1228
-
1229
- @classmethod
1230
- def set_tbl_hide_dtype_separator(cls, active: bool | None = True) -> type[Config]:
1231
- """
1232
- Hide the '---' separator displayed between the column names and column types.
1233
-
1234
- See Also
1235
- --------
1236
- set_tbl_column_data_type_inline : Display the data type inline with the colname.
1237
-
1238
- Examples
1239
- --------
1240
- >>> df = pl.DataFrame({"abc": [1.0, 2.5, 5.0], "xyz": [True, False, True]})
1241
- >>> pl.Config.set_tbl_hide_dtype_separator(True) # doctest: +SKIP
1242
- # ...
1243
- # shape: (3, 2) shape: (3, 2)
1244
- # ┌─────┬───────┐ ┌─────┬───────┐
1245
- # │ abc ┆ xyz │ │ abc ┆ xyz │
1246
- # │ --- ┆ --- │ │ f64 ┆ bool │
1247
- # │ f64 ┆ bool │ ╞═════╪═══════╡
1248
- # ╞═════╪═══════╡ │ 1.0 ┆ true │
1249
- # │ 1.0 ┆ true │ >> │ 2.5 ┆ false │
1250
- # │ 2.5 ┆ false │ │ 5.0 ┆ true │
1251
- # │ 5.0 ┆ true │ └─────┴───────┘
1252
- # └─────┴───────┘
1253
- """
1254
- if active is None:
1255
- os.environ.pop("POLARS_FMT_TABLE_HIDE_COLUMN_SEPARATOR", None)
1256
- else:
1257
- os.environ["POLARS_FMT_TABLE_HIDE_COLUMN_SEPARATOR"] = str(int(active))
1258
- return cls
1259
-
1260
- @classmethod
1261
- def set_tbl_hide_dataframe_shape(cls, active: bool | None = True) -> type[Config]:
1262
- """
1263
- Hide the DataFrame shape information when displaying tables.
1264
-
1265
- Examples
1266
- --------
1267
- >>> df = pl.DataFrame({"abc": [1.0, 2.5, 5.0], "xyz": [True, False, True]})
1268
- >>> pl.Config.set_tbl_hide_dataframe_shape(True) # doctest: +SKIP
1269
- # ...
1270
- # shape: (3, 2) ┌─────┬───────┐
1271
- # ┌─────┬───────┐ │ abc ┆ xyz │
1272
- # │ abc ┆ xyz │ │ --- ┆ --- │
1273
- # │ --- ┆ --- │ │ f64 ┆ bool │
1274
- # │ f64 ┆ bool │ ╞═════╪═══════╡
1275
- # ╞═════╪═══════╡ │ 1.0 ┆ true │
1276
- # │ 1.0 ┆ true │ >> │ 2.5 ┆ false │
1277
- # │ 2.5 ┆ false │ │ 5.0 ┆ true │
1278
- # │ 5.0 ┆ true │ └─────┴───────┘
1279
- # └─────┴───────┘
1280
- """
1281
- if active is None:
1282
- os.environ.pop("POLARS_FMT_TABLE_HIDE_DATAFRAME_SHAPE_INFORMATION", None)
1283
- else:
1284
- os.environ["POLARS_FMT_TABLE_HIDE_DATAFRAME_SHAPE_INFORMATION"] = str(
1285
- int(active)
1286
- )
1287
- return cls
1288
-
1289
- @classmethod
1290
- def set_tbl_rows(cls, n: int | None) -> type[Config]:
1291
- """
1292
- Set the max number of rows used to draw the table (both Dataframe and Series).
1293
-
1294
- Parameters
1295
- ----------
1296
- n : int
1297
- Number of rows to display; if `n < 0` (eg: -1), display all
1298
- rows (DataFrame) and all elements (Series).
1299
-
1300
- Examples
1301
- --------
1302
- >>> df = pl.DataFrame(
1303
- ... {"abc": [1.0, 2.5, 3.5, 5.0], "xyz": [True, False, True, False]}
1304
- ... )
1305
- >>> with pl.Config(tbl_rows=2):
1306
- ... print(df)
1307
- shape: (4, 2)
1308
- ┌─────┬───────┐
1309
- │ abc ┆ xyz │
1310
- │ --- ┆ --- │
1311
- │ f64 ┆ bool │
1312
- ╞═════╪═══════╡
1313
- │ 1.0 ┆ true │
1314
- │ … ┆ … │
1315
- │ 5.0 ┆ false │
1316
- └─────┴───────┘
1317
- """
1318
- if n is None:
1319
- os.environ.pop("POLARS_FMT_MAX_ROWS", None)
1320
- else:
1321
- os.environ["POLARS_FMT_MAX_ROWS"] = str(n)
1322
- return cls
1323
-
1324
- @classmethod
1325
- def set_tbl_width_chars(cls, width: int | None) -> type[Config]:
1326
- """
1327
- Set the maximum width of a table in characters.
1328
-
1329
- Parameters
1330
- ----------
1331
- width : int
1332
- Maximum table width in characters; if n < 0 (eg: -1), display full width.
1333
-
1334
- Examples
1335
- --------
1336
- >>> df = pl.DataFrame(
1337
- ... {
1338
- ... "id": ["SEQ1", "SEQ2"],
1339
- ... "seq": ["ATGATAAAGGAG", "GCAACGCATATA"],
1340
- ... }
1341
- ... )
1342
- >>> df
1343
- shape: (2, 2)
1344
- ┌──────┬──────────────┐
1345
- │ id ┆ seq │
1346
- │ --- ┆ --- │
1347
- │ str ┆ str │
1348
- ╞══════╪══════════════╡
1349
- │ SEQ1 ┆ ATGATAAAGGAG │
1350
- │ SEQ2 ┆ GCAACGCATATA │
1351
- └──────┴──────────────┘
1352
- >>> pl.Config.set_tbl_width_chars(12) # doctest: +IGNORE_RESULT
1353
- >>> df
1354
- shape: (2, 2)
1355
- ┌─────┬─────┐
1356
- │ id ┆ seq │
1357
- │ --- ┆ --- │
1358
- │ str ┆ str │
1359
- ╞═════╪═════╡
1360
- │ SEQ ┆ ATG │
1361
- │ 1 ┆ ATA │
1362
- │ ┆ AAG │
1363
- │ ┆ GAG │
1364
- │ SEQ ┆ GCA │
1365
- │ 2 ┆ ACG │
1366
- │ ┆ CAT │
1367
- │ ┆ ATA │
1368
- └─────┴─────┘
1369
- """
1370
- if width is None:
1371
- os.environ.pop("POLARS_TABLE_WIDTH", None)
1372
- else:
1373
- os.environ["POLARS_TABLE_WIDTH"] = str(width)
1374
- return cls
1375
-
1376
- @classmethod
1377
- def set_trim_decimal_zeros(cls, active: bool | None = True) -> type[Config]:
1378
- """
1379
- Strip trailing zeros from Decimal data type values.
1380
-
1381
- Parameters
1382
- ----------
1383
- active : bool
1384
- Enable stripping of trailing '0' characters from Decimal values.
1385
-
1386
- Examples
1387
- --------
1388
- >>> from decimal import Decimal as D
1389
- >>> df = pl.DataFrame(
1390
- ... data={"d": [D("1.01000"), D("-5.67890")]},
1391
- ... schema={"d": pl.Decimal(scale=5)},
1392
- ... )
1393
- >>> with pl.Config(trim_decimal_zeros=False):
1394
- ... print(df)
1395
- shape: (2, 1)
1396
- ┌───────────────┐
1397
- │ d │
1398
- │ --- │
1399
- │ decimal[38,5] │
1400
- ╞═══════════════╡
1401
- │ 1.01000 │
1402
- │ -5.67890 │
1403
- └───────────────┘
1404
- >>> with pl.Config(trim_decimal_zeros=True):
1405
- ... print(df)
1406
- shape: (2, 1)
1407
- ┌───────────────┐
1408
- │ d │
1409
- │ --- │
1410
- │ decimal[38,5] │
1411
- ╞═══════════════╡
1412
- │ 1.01 │
1413
- │ -5.6789 │
1414
- └───────────────┘
1415
- """
1416
- plr.set_trim_decimal_zeros(active)
1417
- return cls
1418
-
1419
- @classmethod
1420
- def set_verbose(cls, active: bool | None = True) -> type[Config]:
1421
- """
1422
- Enable additional verbose/debug logging.
1423
-
1424
- Examples
1425
- --------
1426
- >>> pl.Config.set_verbose(True) # doctest: +SKIP
1427
- >>> with pl.Config(verbose=True): # doctest: +SKIP
1428
- ... do_polars_operations()
1429
- """
1430
- if active is None:
1431
- os.environ.pop("POLARS_VERBOSE", None)
1432
- else:
1433
- os.environ["POLARS_VERBOSE"] = str(int(active))
1434
- return cls
1435
-
1436
- @classmethod
1437
- def warn_unstable(cls, active: bool | None = True) -> type[Config]:
1438
- """
1439
- Issue a warning when unstable functionality is used.
1440
-
1441
- Enabling this setting may help avoid functionality that is still evolving,
1442
- potentially reducing maintenance burden from API changes and bugs.
1443
-
1444
- Examples
1445
- --------
1446
- >>> pl.Config.warn_unstable(True) # doctest: +SKIP
1447
- >>> pl.col("a").qcut(5) # doctest: +SKIP
1448
- UnstableWarning: `qcut` is considered unstable. It may be changed at any point without it being considered a breaking change.
1449
- """ # noqa: W505
1450
- if active is None:
1451
- os.environ.pop("POLARS_WARN_UNSTABLE", None)
1452
- else:
1453
- os.environ["POLARS_WARN_UNSTABLE"] = str(int(active))
1454
- return cls
1455
-
1456
- @classmethod
1457
- def set_expr_depth_warning(cls, limit: int) -> type[Config]:
1458
- """
1459
- Set the expression depth that Polars will accept without triggering a warning.
1460
-
1461
- Having too deep expressions (several 1000s) can lead to overflowing the stack and might be worth a refactor.
1462
- """ # noqa: W505
1463
- if limit < 0:
1464
- msg = "limit should be positive"
1465
- raise ValueError(msg)
1466
-
1467
- os.environ["POLARS_MAX_EXPR_DEPTH"] = str(limit)
1468
- return cls
1469
-
1470
- @classmethod
1471
- def set_engine_affinity(cls, engine: EngineType | None = None) -> type[Config]:
1472
- """
1473
- Set which engine to use by default.
1474
-
1475
- Parameters
1476
- ----------
1477
- engine : {None, 'auto', 'in-memory', 'streaming', 'gpu'}
1478
- The default execution engine Polars will attempt to use
1479
- when calling `.collect()`. However, the query is not
1480
- guaranteed to execute with the specified engine.
1481
-
1482
- Examples
1483
- --------
1484
- >>> pl.Config.set_engine_affinity("streaming") # doctest: +SKIP
1485
- >>> lf = pl.LazyFrame({"v": [1, 2, 3], "v2": [4, 5, 6]}) # doctest: +SKIP
1486
- >>> lf.max().collect() # doctest: +SKIP
1487
- shape: (3, 2)
1488
- ┌─────┬─────┐
1489
- │ v ┆ v2 │
1490
- │ --- ┆ --- │
1491
- │ i64 ┆ i64 │
1492
- ╞═════╪═════╡
1493
- │ 1 ┆ 4 │
1494
- │ 2 ┆ 5 │
1495
- │ 3 ┆ 6 │
1496
- └─────┴─────┘
1497
- >>> pl.Config.set_engine_affinity("gpu") # doctest: +SKIP
1498
- >>> lf.max().collect() # doctest: +SKIP
1499
- shape: (3, 2)
1500
- ┌─────┬─────┐
1501
- │ v ┆ v2 │
1502
- │ --- ┆ --- │
1503
- │ i64 ┆ i64 │
1504
- ╞═════╪═════╡
1505
- │ 1 ┆ 4 │
1506
- │ 2 ┆ 5 │
1507
- │ 3 ┆ 6 │
1508
- └─────┴─────┘
1509
-
1510
- Raises
1511
- ------
1512
- ValueError: if engine is not recognised.
1513
- NotImplementedError: if engine is a GPUEngine object
1514
- """
1515
- if isinstance(engine, GPUEngine):
1516
- msg = "GPU engine with non-defaults not yet supported"
1517
- raise NotImplementedError(msg)
1518
- supported_engines = get_args(get_args(EngineType)[0])
1519
- if engine not in {*supported_engines, None}:
1520
- msg = "invalid engine"
1521
- raise ValueError(msg)
1522
- if engine is None:
1523
- os.environ.pop("POLARS_ENGINE_AFFINITY", None)
1524
- else:
1525
- os.environ["POLARS_ENGINE_AFFINITY"] = engine
1526
- return cls
1527
-
1528
- @classmethod
1529
- @unstable()
1530
- def set_default_credential_provider(
1531
- cls, credential_provider: CredentialProviderFunction | Literal["auto"] | None
1532
- ) -> type[Config]:
1533
- """
1534
- Set a default credential provider.
1535
-
1536
- Sets the default credential provider to be used for functions that
1537
- read / write to cloud storage.
1538
-
1539
- .. warning::
1540
- This functionality is considered **unstable**. It may be changed
1541
- at any point without it being considered a breaking change.
1542
-
1543
- Parameters
1544
- ----------
1545
- credential_provider
1546
- Provide a function that can be called to provide cloud storage
1547
- credentials. The function is expected to return a dictionary of
1548
- credential keys along with an optional credential expiry time.
1549
-
1550
- Can also be set to None, which globally disables auto-initialization
1551
- of credential providers, or "auto" (the default behavior).
1552
-
1553
- Examples
1554
- --------
1555
- >>> pl.Config.set_default_credential_provider(
1556
- ... pl.CredentialProviderAWS(
1557
- ... assume_role={"RoleArn": "...", "RoleSessionName": "..."}
1558
- ... )
1559
- ... )
1560
- <class 'polars.config.Config'>
1561
- """
1562
- import polars.io.cloud.credential_provider._builder
1563
-
1564
- if isinstance(credential_provider, str) and credential_provider != "auto":
1565
- raise ValueError(credential_provider)
1566
-
1567
- polars.io.cloud.credential_provider._builder.DEFAULT_CREDENTIAL_PROVIDER = (
1568
- credential_provider
1569
- )
1570
-
1571
- return cls