polars-runtime-compat 1.34.0b2__cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.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/.gitkeep +0 -0
  2. _polars_runtime_compat/_polars_runtime_compat.abi3.so +0 -0
  3. polars/__init__.py +528 -0
  4. polars/_cpu_check.py +265 -0
  5. polars/_dependencies.py +355 -0
  6. polars/_plr.py +99 -0
  7. polars/_plr.pyi +2496 -0
  8. polars/_reexport.py +23 -0
  9. polars/_typing.py +478 -0
  10. polars/_utils/__init__.py +37 -0
  11. polars/_utils/async_.py +102 -0
  12. polars/_utils/cache.py +176 -0
  13. polars/_utils/cloud.py +40 -0
  14. polars/_utils/constants.py +29 -0
  15. polars/_utils/construction/__init__.py +46 -0
  16. polars/_utils/construction/dataframe.py +1397 -0
  17. polars/_utils/construction/other.py +72 -0
  18. polars/_utils/construction/series.py +560 -0
  19. polars/_utils/construction/utils.py +118 -0
  20. polars/_utils/convert.py +224 -0
  21. polars/_utils/deprecation.py +406 -0
  22. polars/_utils/getitem.py +457 -0
  23. polars/_utils/logging.py +11 -0
  24. polars/_utils/nest_asyncio.py +264 -0
  25. polars/_utils/parquet.py +15 -0
  26. polars/_utils/parse/__init__.py +12 -0
  27. polars/_utils/parse/expr.py +242 -0
  28. polars/_utils/polars_version.py +19 -0
  29. polars/_utils/pycapsule.py +53 -0
  30. polars/_utils/scan.py +27 -0
  31. polars/_utils/serde.py +63 -0
  32. polars/_utils/slice.py +215 -0
  33. polars/_utils/udfs.py +1251 -0
  34. polars/_utils/unstable.py +63 -0
  35. polars/_utils/various.py +782 -0
  36. polars/_utils/wrap.py +25 -0
  37. polars/api.py +370 -0
  38. polars/catalog/__init__.py +0 -0
  39. polars/catalog/unity/__init__.py +19 -0
  40. polars/catalog/unity/client.py +733 -0
  41. polars/catalog/unity/models.py +152 -0
  42. polars/config.py +1571 -0
  43. polars/convert/__init__.py +25 -0
  44. polars/convert/general.py +1046 -0
  45. polars/convert/normalize.py +261 -0
  46. polars/dataframe/__init__.py +5 -0
  47. polars/dataframe/_html.py +186 -0
  48. polars/dataframe/frame.py +12582 -0
  49. polars/dataframe/group_by.py +1067 -0
  50. polars/dataframe/plotting.py +257 -0
  51. polars/datatype_expr/__init__.py +5 -0
  52. polars/datatype_expr/array.py +56 -0
  53. polars/datatype_expr/datatype_expr.py +304 -0
  54. polars/datatype_expr/list.py +18 -0
  55. polars/datatype_expr/struct.py +69 -0
  56. polars/datatypes/__init__.py +122 -0
  57. polars/datatypes/_parse.py +195 -0
  58. polars/datatypes/_utils.py +48 -0
  59. polars/datatypes/classes.py +1213 -0
  60. polars/datatypes/constants.py +11 -0
  61. polars/datatypes/constructor.py +172 -0
  62. polars/datatypes/convert.py +366 -0
  63. polars/datatypes/group.py +130 -0
  64. polars/exceptions.py +230 -0
  65. polars/expr/__init__.py +7 -0
  66. polars/expr/array.py +964 -0
  67. polars/expr/binary.py +346 -0
  68. polars/expr/categorical.py +306 -0
  69. polars/expr/datetime.py +2620 -0
  70. polars/expr/expr.py +11272 -0
  71. polars/expr/list.py +1408 -0
  72. polars/expr/meta.py +444 -0
  73. polars/expr/name.py +321 -0
  74. polars/expr/string.py +3045 -0
  75. polars/expr/struct.py +357 -0
  76. polars/expr/whenthen.py +185 -0
  77. polars/functions/__init__.py +193 -0
  78. polars/functions/aggregation/__init__.py +33 -0
  79. polars/functions/aggregation/horizontal.py +298 -0
  80. polars/functions/aggregation/vertical.py +341 -0
  81. polars/functions/as_datatype.py +848 -0
  82. polars/functions/business.py +138 -0
  83. polars/functions/col.py +384 -0
  84. polars/functions/datatype.py +121 -0
  85. polars/functions/eager.py +524 -0
  86. polars/functions/escape_regex.py +29 -0
  87. polars/functions/lazy.py +2751 -0
  88. polars/functions/len.py +68 -0
  89. polars/functions/lit.py +210 -0
  90. polars/functions/random.py +22 -0
  91. polars/functions/range/__init__.py +19 -0
  92. polars/functions/range/_utils.py +15 -0
  93. polars/functions/range/date_range.py +303 -0
  94. polars/functions/range/datetime_range.py +370 -0
  95. polars/functions/range/int_range.py +348 -0
  96. polars/functions/range/linear_space.py +311 -0
  97. polars/functions/range/time_range.py +287 -0
  98. polars/functions/repeat.py +301 -0
  99. polars/functions/whenthen.py +353 -0
  100. polars/interchange/__init__.py +10 -0
  101. polars/interchange/buffer.py +77 -0
  102. polars/interchange/column.py +190 -0
  103. polars/interchange/dataframe.py +230 -0
  104. polars/interchange/from_dataframe.py +328 -0
  105. polars/interchange/protocol.py +303 -0
  106. polars/interchange/utils.py +170 -0
  107. polars/io/__init__.py +64 -0
  108. polars/io/_utils.py +317 -0
  109. polars/io/avro.py +49 -0
  110. polars/io/clipboard.py +36 -0
  111. polars/io/cloud/__init__.py +17 -0
  112. polars/io/cloud/_utils.py +80 -0
  113. polars/io/cloud/credential_provider/__init__.py +17 -0
  114. polars/io/cloud/credential_provider/_builder.py +520 -0
  115. polars/io/cloud/credential_provider/_providers.py +618 -0
  116. polars/io/csv/__init__.py +9 -0
  117. polars/io/csv/_utils.py +38 -0
  118. polars/io/csv/batched_reader.py +142 -0
  119. polars/io/csv/functions.py +1495 -0
  120. polars/io/database/__init__.py +6 -0
  121. polars/io/database/_arrow_registry.py +70 -0
  122. polars/io/database/_cursor_proxies.py +147 -0
  123. polars/io/database/_executor.py +578 -0
  124. polars/io/database/_inference.py +314 -0
  125. polars/io/database/_utils.py +144 -0
  126. polars/io/database/functions.py +516 -0
  127. polars/io/delta.py +499 -0
  128. polars/io/iceberg/__init__.py +3 -0
  129. polars/io/iceberg/_utils.py +697 -0
  130. polars/io/iceberg/dataset.py +556 -0
  131. polars/io/iceberg/functions.py +151 -0
  132. polars/io/ipc/__init__.py +8 -0
  133. polars/io/ipc/functions.py +514 -0
  134. polars/io/json/__init__.py +3 -0
  135. polars/io/json/read.py +101 -0
  136. polars/io/ndjson.py +332 -0
  137. polars/io/parquet/__init__.py +17 -0
  138. polars/io/parquet/field_overwrites.py +140 -0
  139. polars/io/parquet/functions.py +722 -0
  140. polars/io/partition.py +491 -0
  141. polars/io/plugins.py +187 -0
  142. polars/io/pyarrow_dataset/__init__.py +5 -0
  143. polars/io/pyarrow_dataset/anonymous_scan.py +109 -0
  144. polars/io/pyarrow_dataset/functions.py +79 -0
  145. polars/io/scan_options/__init__.py +5 -0
  146. polars/io/scan_options/_options.py +59 -0
  147. polars/io/scan_options/cast_options.py +126 -0
  148. polars/io/spreadsheet/__init__.py +6 -0
  149. polars/io/spreadsheet/_utils.py +52 -0
  150. polars/io/spreadsheet/_write_utils.py +647 -0
  151. polars/io/spreadsheet/functions.py +1323 -0
  152. polars/lazyframe/__init__.py +9 -0
  153. polars/lazyframe/engine_config.py +61 -0
  154. polars/lazyframe/frame.py +8564 -0
  155. polars/lazyframe/group_by.py +669 -0
  156. polars/lazyframe/in_process.py +42 -0
  157. polars/lazyframe/opt_flags.py +333 -0
  158. polars/meta/__init__.py +14 -0
  159. polars/meta/build.py +33 -0
  160. polars/meta/index_type.py +27 -0
  161. polars/meta/thread_pool.py +50 -0
  162. polars/meta/versions.py +120 -0
  163. polars/ml/__init__.py +0 -0
  164. polars/ml/torch.py +213 -0
  165. polars/ml/utilities.py +30 -0
  166. polars/plugins.py +155 -0
  167. polars/py.typed +0 -0
  168. polars/pyproject.toml +96 -0
  169. polars/schema.py +265 -0
  170. polars/selectors.py +3117 -0
  171. polars/series/__init__.py +5 -0
  172. polars/series/array.py +776 -0
  173. polars/series/binary.py +254 -0
  174. polars/series/categorical.py +246 -0
  175. polars/series/datetime.py +2275 -0
  176. polars/series/list.py +1087 -0
  177. polars/series/plotting.py +191 -0
  178. polars/series/series.py +9197 -0
  179. polars/series/string.py +2367 -0
  180. polars/series/struct.py +154 -0
  181. polars/series/utils.py +191 -0
  182. polars/sql/__init__.py +7 -0
  183. polars/sql/context.py +677 -0
  184. polars/sql/functions.py +139 -0
  185. polars/string_cache.py +185 -0
  186. polars/testing/__init__.py +13 -0
  187. polars/testing/asserts/__init__.py +9 -0
  188. polars/testing/asserts/frame.py +231 -0
  189. polars/testing/asserts/series.py +219 -0
  190. polars/testing/asserts/utils.py +12 -0
  191. polars/testing/parametric/__init__.py +33 -0
  192. polars/testing/parametric/profiles.py +107 -0
  193. polars/testing/parametric/strategies/__init__.py +22 -0
  194. polars/testing/parametric/strategies/_utils.py +14 -0
  195. polars/testing/parametric/strategies/core.py +615 -0
  196. polars/testing/parametric/strategies/data.py +452 -0
  197. polars/testing/parametric/strategies/dtype.py +436 -0
  198. polars/testing/parametric/strategies/legacy.py +169 -0
  199. polars/type_aliases.py +24 -0
  200. polars_runtime_compat-1.34.0b2.dist-info/METADATA +190 -0
  201. polars_runtime_compat-1.34.0b2.dist-info/RECORD +203 -0
  202. polars_runtime_compat-1.34.0b2.dist-info/WHEEL +4 -0
  203. polars_runtime_compat-1.34.0b2.dist-info/licenses/LICENSE +20 -0
File without changes
polars/__init__.py ADDED
@@ -0,0 +1,528 @@
1
+ """
2
+ Polars: Blazingly fast DataFrames
3
+ =================================
4
+
5
+ Polars is a fast, open-source library for data manipulation with an expressive, typed API.
6
+
7
+ Basic usage:
8
+
9
+ >>> import polars as pl
10
+ >>> df = pl.DataFrame(
11
+ ... {
12
+ ... "name": ["Alice", "Bob", "Charlie"],
13
+ ... "age": [25, 30, 35],
14
+ ... "city": ["New York", "London", "Tokyo"],
15
+ ... }
16
+ ... )
17
+ >>> df.filter(pl.col("age") > 28)
18
+ shape: (2, 3)
19
+ ┌─────────┬─────┬────────┐
20
+ │ name ┆ age ┆ city │
21
+ │ --- ┆ --- ┆ --- │
22
+ │ str ┆ i64 ┆ str │
23
+ ╞═════════╪═════╪════════╡
24
+ │ Bob ┆ 30 ┆ London │
25
+ │ Charlie ┆ 35 ┆ Tokyo │
26
+ └─────────┴─────┴────────┘
27
+
28
+ User Guide: https://docs.pola.rs/
29
+ Python API Documentation: https://docs.pola.rs/api/python/stable/
30
+ Source Code: https://github.com/pola-rs/polars
31
+ """ # noqa: D400, W505, D205
32
+
33
+ import contextlib
34
+
35
+ with contextlib.suppress(ImportError): # Module not available when building docs
36
+ # We also configure the allocator before importing the Polars Rust bindings.
37
+ # See https://github.com/pola-rs/polars/issues/18088,
38
+ # https://github.com/pola-rs/polars/pull/21829.
39
+ import os
40
+
41
+ jemalloc_conf = "dirty_decay_ms:500,muzzy_decay_ms:-1"
42
+ if os.environ.get("POLARS_THP") == "1":
43
+ jemalloc_conf += ",thp:always,metadata_thp:always"
44
+ if override := os.environ.get("_RJEM_MALLOC_CONF"):
45
+ jemalloc_conf += "," + override
46
+ os.environ["_RJEM_MALLOC_CONF"] = jemalloc_conf
47
+
48
+ # Initialize polars on the rust side. This function is highly
49
+ # unsafe and should only be called once.
50
+ from polars._plr import __register_startup_deps
51
+
52
+ __register_startup_deps()
53
+
54
+ from typing import TYPE_CHECKING, Any
55
+
56
+ from polars import api, exceptions, plugins, selectors
57
+ from polars._utils.polars_version import get_polars_version as _get_polars_version
58
+
59
+ # TODO: remove need for importing wrap utils at top level
60
+ from polars._utils.wrap import wrap_df, wrap_s # noqa: F401
61
+ from polars.catalog.unity import Catalog
62
+ from polars.config import Config
63
+ from polars.convert import (
64
+ from_arrow,
65
+ from_dataframe,
66
+ from_dict,
67
+ from_dicts,
68
+ from_numpy,
69
+ from_pandas,
70
+ from_records,
71
+ from_repr,
72
+ from_torch,
73
+ json_normalize,
74
+ )
75
+ from polars.dataframe import DataFrame
76
+ from polars.datatype_expr import DataTypeExpr
77
+ from polars.datatypes import (
78
+ Array,
79
+ Binary,
80
+ Boolean,
81
+ Categorical,
82
+ Categories,
83
+ DataType,
84
+ Date,
85
+ Datetime,
86
+ Decimal,
87
+ Duration,
88
+ Enum,
89
+ Field,
90
+ Float32,
91
+ Float64,
92
+ Int8,
93
+ Int16,
94
+ Int32,
95
+ Int64,
96
+ Int128,
97
+ List,
98
+ Null,
99
+ Object,
100
+ String,
101
+ Struct,
102
+ Time,
103
+ UInt8,
104
+ UInt16,
105
+ UInt32,
106
+ UInt64,
107
+ UInt128,
108
+ Unknown,
109
+ Utf8,
110
+ )
111
+ from polars.expr import Expr
112
+ from polars.functions import (
113
+ align_frames,
114
+ all,
115
+ all_horizontal,
116
+ any,
117
+ any_horizontal,
118
+ approx_n_unique,
119
+ arange,
120
+ arctan2,
121
+ arctan2d,
122
+ arg_sort_by,
123
+ arg_where,
124
+ business_day_count,
125
+ coalesce,
126
+ col,
127
+ collect_all,
128
+ collect_all_async,
129
+ concat,
130
+ concat_arr,
131
+ concat_list,
132
+ concat_str,
133
+ corr,
134
+ count,
135
+ cov,
136
+ cum_count,
137
+ cum_fold,
138
+ cum_reduce,
139
+ cum_sum,
140
+ cum_sum_horizontal,
141
+ date,
142
+ date_range,
143
+ date_ranges,
144
+ datetime,
145
+ datetime_range,
146
+ datetime_ranges,
147
+ dtype_of,
148
+ duration,
149
+ element,
150
+ escape_regex,
151
+ exclude,
152
+ explain_all,
153
+ field,
154
+ first,
155
+ fold,
156
+ format,
157
+ from_epoch,
158
+ groups,
159
+ head,
160
+ implode,
161
+ int_range,
162
+ int_ranges,
163
+ last,
164
+ len,
165
+ linear_space,
166
+ linear_spaces,
167
+ lit,
168
+ map_batches,
169
+ map_groups,
170
+ max,
171
+ max_horizontal,
172
+ mean,
173
+ mean_horizontal,
174
+ median,
175
+ min,
176
+ min_horizontal,
177
+ n_unique,
178
+ nth,
179
+ ones,
180
+ quantile,
181
+ reduce,
182
+ repeat,
183
+ rolling_corr,
184
+ rolling_cov,
185
+ row_index,
186
+ select,
187
+ self_dtype,
188
+ set_random_seed,
189
+ sql_expr,
190
+ std,
191
+ struct,
192
+ struct_with_fields,
193
+ sum,
194
+ sum_horizontal,
195
+ tail,
196
+ time,
197
+ time_range,
198
+ time_ranges,
199
+ var,
200
+ when,
201
+ zeros,
202
+ )
203
+ from polars.interchange import CompatLevel
204
+ from polars.io import (
205
+ BasePartitionContext,
206
+ KeyedPartition,
207
+ KeyedPartitionContext,
208
+ PartitionByKey,
209
+ PartitionMaxSize,
210
+ PartitionParted,
211
+ ScanCastOptions,
212
+ defer,
213
+ read_avro,
214
+ read_clipboard,
215
+ read_csv,
216
+ read_csv_batched,
217
+ read_database,
218
+ read_database_uri,
219
+ read_delta,
220
+ read_excel,
221
+ read_ipc,
222
+ read_ipc_schema,
223
+ read_ipc_stream,
224
+ read_json,
225
+ read_ndjson,
226
+ read_ods,
227
+ read_parquet,
228
+ read_parquet_metadata,
229
+ read_parquet_schema,
230
+ scan_csv,
231
+ scan_delta,
232
+ scan_iceberg,
233
+ scan_ipc,
234
+ scan_ndjson,
235
+ scan_parquet,
236
+ scan_pyarrow_dataset,
237
+ )
238
+ from polars.io.cloud import (
239
+ CredentialProvider,
240
+ CredentialProviderAWS,
241
+ CredentialProviderAzure,
242
+ CredentialProviderFunction,
243
+ CredentialProviderFunctionReturn,
244
+ CredentialProviderGCP,
245
+ )
246
+ from polars.lazyframe import GPUEngine, LazyFrame, QueryOptFlags
247
+ from polars.meta import (
248
+ build_info,
249
+ get_index_type,
250
+ show_versions,
251
+ thread_pool_size,
252
+ threadpool_size,
253
+ )
254
+ from polars.schema import Schema
255
+ from polars.series import Series
256
+ from polars.sql import SQLContext, sql
257
+ from polars.string_cache import (
258
+ StringCache,
259
+ disable_string_cache,
260
+ enable_string_cache,
261
+ using_string_cache,
262
+ )
263
+
264
+ __version__: str = _get_polars_version()
265
+ del _get_polars_version
266
+
267
+ __all__ = [
268
+ # modules
269
+ "api",
270
+ "exceptions",
271
+ "plugins",
272
+ "selectors",
273
+ # core classes
274
+ "DataFrame",
275
+ "Expr",
276
+ "LazyFrame",
277
+ "Series",
278
+ # Engine configuration
279
+ "GPUEngine",
280
+ # schema
281
+ "Schema",
282
+ # datatype_expr
283
+ "DataTypeExpr",
284
+ # datatypes
285
+ "Array",
286
+ "Binary",
287
+ "Boolean",
288
+ "Categorical",
289
+ "Categories",
290
+ "DataType",
291
+ "Date",
292
+ "Datetime",
293
+ "Decimal",
294
+ "Duration",
295
+ "Enum",
296
+ "Field",
297
+ "Float32",
298
+ "Float64",
299
+ "Int8",
300
+ "Int16",
301
+ "Int32",
302
+ "Int64",
303
+ "Int128",
304
+ "List",
305
+ "Null",
306
+ "Object",
307
+ "String",
308
+ "Struct",
309
+ "Time",
310
+ "UInt8",
311
+ "UInt16",
312
+ "UInt32",
313
+ "UInt64",
314
+ "UInt128",
315
+ "Unknown",
316
+ "Utf8",
317
+ # polars.io
318
+ "defer",
319
+ "KeyedPartition",
320
+ "BasePartitionContext",
321
+ "KeyedPartitionContext",
322
+ "PartitionByKey",
323
+ "PartitionMaxSize",
324
+ "PartitionParted",
325
+ "ScanCastOptions",
326
+ "read_avro",
327
+ "read_clipboard",
328
+ "read_csv",
329
+ "read_csv_batched",
330
+ "read_database",
331
+ "read_database_uri",
332
+ "read_delta",
333
+ "read_excel",
334
+ "read_ipc",
335
+ "read_ipc_schema",
336
+ "read_ipc_stream",
337
+ "read_json",
338
+ "read_ndjson",
339
+ "read_ods",
340
+ "read_parquet",
341
+ "read_parquet_metadata",
342
+ "read_parquet_schema",
343
+ "scan_csv",
344
+ "scan_delta",
345
+ "scan_iceberg",
346
+ "scan_ipc",
347
+ "scan_ndjson",
348
+ "scan_parquet",
349
+ "scan_pyarrow_dataset",
350
+ "Catalog",
351
+ # polars.io.cloud
352
+ "CredentialProvider",
353
+ "CredentialProviderAWS",
354
+ "CredentialProviderAzure",
355
+ "CredentialProviderFunction",
356
+ "CredentialProviderFunctionReturn",
357
+ "CredentialProviderGCP",
358
+ # polars.stringcache
359
+ "StringCache",
360
+ "disable_string_cache",
361
+ "enable_string_cache",
362
+ "using_string_cache",
363
+ # polars.config
364
+ "Config",
365
+ # polars.functions.whenthen
366
+ "when",
367
+ # polars.functions
368
+ "align_frames",
369
+ "arg_where",
370
+ "business_day_count",
371
+ "concat",
372
+ "dtype_of",
373
+ "struct_with_fields",
374
+ "date_range",
375
+ "date_ranges",
376
+ "datetime_range",
377
+ "datetime_ranges",
378
+ "element",
379
+ "ones",
380
+ "repeat",
381
+ "self_dtype",
382
+ "time_range",
383
+ "time_ranges",
384
+ "zeros",
385
+ "escape_regex",
386
+ # polars.functions.aggregation
387
+ "all",
388
+ "all_horizontal",
389
+ "any",
390
+ "any_horizontal",
391
+ "cum_sum",
392
+ "cum_sum_horizontal",
393
+ "max",
394
+ "max_horizontal",
395
+ "mean_horizontal",
396
+ "min",
397
+ "min_horizontal",
398
+ "sum",
399
+ "sum_horizontal",
400
+ # polars.functions.lazy
401
+ "approx_n_unique",
402
+ "arange",
403
+ "arctan2",
404
+ "arctan2d",
405
+ "arg_sort_by",
406
+ "coalesce",
407
+ "col",
408
+ "collect_all",
409
+ "collect_all_async",
410
+ "concat_arr",
411
+ "concat_list",
412
+ "concat_str",
413
+ "corr",
414
+ "count",
415
+ "cov",
416
+ "cum_count",
417
+ "cum_fold",
418
+ "cum_reduce",
419
+ "date",
420
+ "datetime",
421
+ "duration",
422
+ "exclude",
423
+ "explain_all",
424
+ "field",
425
+ "first",
426
+ "fold",
427
+ "format",
428
+ "from_epoch",
429
+ "groups",
430
+ "head",
431
+ "implode",
432
+ "int_range",
433
+ "int_ranges",
434
+ "last",
435
+ "linear_space",
436
+ "linear_spaces",
437
+ "lit",
438
+ "map_batches",
439
+ "map_groups",
440
+ "mean",
441
+ "median",
442
+ "n_unique",
443
+ "nth",
444
+ "quantile",
445
+ "reduce",
446
+ "rolling_corr",
447
+ "rolling_cov",
448
+ "row_index",
449
+ "select",
450
+ "std",
451
+ "struct",
452
+ "tail",
453
+ "time",
454
+ "var",
455
+ # polars.functions.len
456
+ "len",
457
+ # polars.functions.random
458
+ "set_random_seed",
459
+ # polars.convert
460
+ "from_arrow",
461
+ "from_dataframe",
462
+ "from_dict",
463
+ "from_dicts",
464
+ "from_numpy",
465
+ "from_pandas",
466
+ "from_records",
467
+ "from_repr",
468
+ "from_torch",
469
+ "json_normalize",
470
+ # polars.meta
471
+ "build_info",
472
+ "get_index_type",
473
+ "show_versions",
474
+ "thread_pool_size",
475
+ "threadpool_size",
476
+ # polars.sql
477
+ "SQLContext",
478
+ "sql",
479
+ "sql_expr",
480
+ "CompatLevel",
481
+ # optimization
482
+ "QueryOptFlags",
483
+ ]
484
+
485
+
486
+ if not TYPE_CHECKING:
487
+ with contextlib.suppress(ImportError): # Module not available when building docs
488
+ import polars._plr as plr
489
+
490
+ # This causes typechecking to resolve any Polars module attribute
491
+ # as Any regardless of existence so we check for TYPE_CHECKING, see #24334.
492
+ def __getattr__(name: str) -> Any:
493
+ # Backwards compatibility for plugins. This used to be called `polars.polars`,
494
+ # but is now `polars._plr`.
495
+ if name == "polars":
496
+ return plr
497
+ elif name == "_allocator":
498
+ return plr._allocator
499
+
500
+ # Deprecate re-export of exceptions at top-level
501
+ if name in dir(exceptions):
502
+ from polars._utils.deprecation import issue_deprecation_warning
503
+
504
+ issue_deprecation_warning(
505
+ message=(
506
+ f"accessing `{name}` from the top-level `polars` module was deprecated "
507
+ "in version 1.0.0. Import it directly from the `polars.exceptions` module "
508
+ f"instead, e.g.: `from polars.exceptions import {name}`"
509
+ ),
510
+ )
511
+ return getattr(exceptions, name)
512
+
513
+ # Deprecate data type groups at top-level
514
+ import polars.datatypes.group as dtgroup
515
+
516
+ if name in dir(dtgroup):
517
+ from polars._utils.deprecation import issue_deprecation_warning
518
+
519
+ issue_deprecation_warning(
520
+ message=(
521
+ f"`{name}` was deprecated in version 1.0.0. Define your own data type groups or "
522
+ "use the `polars.selectors` module for selecting columns of a certain data type."
523
+ ),
524
+ )
525
+ return getattr(dtgroup, name)
526
+
527
+ msg = f"module {__name__!r} has no attribute {name!r}"
528
+ raise AttributeError(msg)