etlplus 0.12.3__py3-none-any.whl → 0.12.10__py3-none-any.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.
Files changed (47) hide show
  1. etlplus/file/_imports.py +141 -0
  2. etlplus/file/_io.py +1 -0
  3. etlplus/file/accdb.py +78 -0
  4. etlplus/file/arrow.py +78 -0
  5. etlplus/file/avro.py +17 -27
  6. etlplus/file/bson.py +77 -0
  7. etlplus/file/cbor.py +78 -0
  8. etlplus/file/cfg.py +79 -0
  9. etlplus/file/conf.py +80 -0
  10. etlplus/file/core.py +119 -84
  11. etlplus/file/csv.py +13 -1
  12. etlplus/file/dat.py +78 -0
  13. etlplus/file/duckdb.py +78 -0
  14. etlplus/file/enums.py +114 -15
  15. etlplus/file/feather.py +14 -2
  16. etlplus/file/fwf.py +77 -0
  17. etlplus/file/ini.py +79 -0
  18. etlplus/file/ion.py +78 -0
  19. etlplus/file/json.py +13 -1
  20. etlplus/file/log.py +78 -0
  21. etlplus/file/mdb.py +78 -0
  22. etlplus/file/msgpack.py +78 -0
  23. etlplus/file/ndjson.py +14 -15
  24. etlplus/file/orc.py +14 -2
  25. etlplus/file/parquet.py +14 -2
  26. etlplus/file/pb.py +78 -0
  27. etlplus/file/pbf.py +77 -0
  28. etlplus/file/properties.py +78 -0
  29. etlplus/file/proto.py +77 -0
  30. etlplus/file/psv.py +79 -0
  31. etlplus/file/sqlite.py +78 -0
  32. etlplus/file/stub.py +84 -0
  33. etlplus/file/tab.py +81 -0
  34. etlplus/file/toml.py +78 -0
  35. etlplus/file/tsv.py +14 -1
  36. etlplus/file/txt.py +13 -10
  37. etlplus/file/xls.py +1 -1
  38. etlplus/file/xlsx.py +1 -1
  39. etlplus/file/xml.py +12 -1
  40. etlplus/file/yaml.py +15 -44
  41. {etlplus-0.12.3.dist-info → etlplus-0.12.10.dist-info}/METADATA +119 -1
  42. {etlplus-0.12.3.dist-info → etlplus-0.12.10.dist-info}/RECORD +46 -23
  43. etlplus/file/_pandas.py +0 -58
  44. {etlplus-0.12.3.dist-info → etlplus-0.12.10.dist-info}/WHEEL +0 -0
  45. {etlplus-0.12.3.dist-info → etlplus-0.12.10.dist-info}/entry_points.txt +0 -0
  46. {etlplus-0.12.3.dist-info → etlplus-0.12.10.dist-info}/licenses/LICENSE +0 -0
  47. {etlplus-0.12.3.dist-info → etlplus-0.12.10.dist-info}/top_level.txt +0 -0
etlplus/file/yaml.py CHANGED
@@ -1,19 +1,30 @@
1
1
  """
2
2
  :mod:`etlplus.file.yaml` module.
3
3
 
4
- Helpers for reading/writing YAML files.
4
+ Helpers for reading/writing YAML Ain't Markup Language (YAML) files.
5
+
6
+ Notes
7
+ -----
8
+ - A YAML file is a human-readable data serialization format.
9
+ - Common cases:
10
+ - Configuration files.
11
+ - Data exchange between languages with different data structures.
12
+ - Complex data storage.
13
+ - Rule of thumb:
14
+ - If the file follows the YAML specification, use this module for
15
+ reading and writing.
5
16
  """
6
17
 
7
18
  from __future__ import annotations
8
19
 
9
20
  from pathlib import Path
10
- from typing import Any
11
21
  from typing import cast
12
22
 
13
23
  from ..types import JSONData
14
24
  from ..types import JSONDict
15
25
  from ..types import JSONList
16
26
  from ..utils import count_records
27
+ from ._imports import get_yaml
17
28
 
18
29
  # SECTION: EXPORTS ========================================================== #
19
30
 
@@ -24,43 +35,6 @@ __all__ = [
24
35
  ]
25
36
 
26
37
 
27
- # SECTION: INTERNAL CONSTANTS =============================================== #
28
-
29
-
30
- # Optional YAML support (lazy-loaded to avoid hard dependency)
31
- # Cached access function to avoid global statements.
32
- _YAML_CACHE: dict[str, Any] = {}
33
-
34
-
35
- # SECTION: INTERNAL FUNCTIONS =============================================== #
36
-
37
-
38
- def _get_yaml() -> Any:
39
- """
40
- Return the PyYAML module, importing it on first use.
41
-
42
- Raises an informative ImportError if the optional dependency is missing.
43
- """
44
- mod = _YAML_CACHE.get('mod')
45
- if mod is not None: # pragma: no cover - tiny branch
46
- return mod
47
- try:
48
- _yaml_mod = __import__('yaml') # type: ignore[assignment]
49
- except ImportError as e: # pragma: no cover
50
- raise ImportError(
51
- 'YAML support requires optional dependency "PyYAML".\n'
52
- 'Install with: pip install PyYAML',
53
- ) from e
54
- _YAML_CACHE['mod'] = _yaml_mod
55
-
56
- return _yaml_mod
57
-
58
-
59
- def _require_yaml() -> None:
60
- """Ensure PyYAML is available or raise an informative error."""
61
- _get_yaml()
62
-
63
-
64
38
  # SECTION: FUNCTIONS ======================================================== #
65
39
 
66
40
 
@@ -87,10 +61,8 @@ def read(
87
61
  TypeError
88
62
  If the YAML root is not an object or an array of objects.
89
63
  """
90
- _require_yaml()
91
-
92
64
  with path.open('r', encoding='utf-8') as handle:
93
- loaded = _get_yaml().safe_load(handle)
65
+ loaded = get_yaml().safe_load(handle)
94
66
 
95
67
  if isinstance(loaded, dict):
96
68
  return cast(JSONDict, loaded)
@@ -124,9 +96,8 @@ def write(
124
96
  int
125
97
  The number of records written.
126
98
  """
127
- _require_yaml()
128
99
  with path.open('w', encoding='utf-8') as handle:
129
- _get_yaml().safe_dump(
100
+ get_yaml().safe_dump(
130
101
  data,
131
102
  handle,
132
103
  sort_keys=False,
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: etlplus
3
- Version: 0.12.3
3
+ Version: 0.12.10
4
4
  Summary: A Swiss Army knife for simple ETL operations
5
5
  Home-page: https://github.com/Dagitali/ETLPlus
6
6
  Author: ETLPlus Team
@@ -68,6 +68,19 @@ package and command-line interface for data extraction, validation, transformati
68
68
  - [Features](#features)
69
69
  - [Installation](#installation)
70
70
  - [Quickstart](#quickstart)
71
+ - [Data Connectors](#data-connectors)
72
+ - [REST APIs (`api`)](#rest-apis-api)
73
+ - [Databases (`database`)](#databases-database)
74
+ - [Files (`file`)](#files-file)
75
+ - [Stubbed / Placeholder](#stubbed--placeholder)
76
+ - [Tabular \& Delimited Text](#tabular--delimited-text)
77
+ - [Semi-Structured Text](#semi-structured-text)
78
+ - [Columnar / Analytics-Friendly](#columnar--analytics-friendly)
79
+ - [Binary Serialization and Interchange](#binary-serialization-and-interchange)
80
+ - [Databases and Embedded Storage](#databases-and-embedded-storage)
81
+ - [Spreadsheets](#spreadsheets)
82
+ - [Data Archives](#data-archives)
83
+ - [Logs and Event Streams](#logs-and-event-streams)
71
84
  - [Usage](#usage)
72
85
  - [Command Line Interface](#command-line-interface)
73
86
  - [Argument Order and Required Options](#argument-order-and-required-options)
@@ -191,6 +204,111 @@ assert validate(filtered, rules)["valid"]
191
204
  load(filtered, "file", "temp/sample_output.json", file_format="json")
192
205
  ```
193
206
 
207
+ ## Data Connectors
208
+
209
+ Data connectors abstract sources from which to extract data and targets to which to load data. They
210
+ are differentiated by their types, each of which is represented in the subsections below.
211
+
212
+ ### REST APIs (`api`)
213
+
214
+ ETLPlus can extract from REST APIs and load results via common HTTP methods. Supported operations
215
+ include GET for extract and PATCH/POST/PUT for load.
216
+
217
+ ### Databases (`database`)
218
+
219
+ Database connectors use connection strings for extraction and loading, and
220
+ DDL can be rendered from table specs for migrations or schema checks.
221
+
222
+ ### Files (`file`)
223
+
224
+ File formats are grouped as in `FileFormat`. Support is marked as:
225
+
226
+ - **Y**: implemented (may require optional dependencies)
227
+ - **N**: stubbed or not yet implemented
228
+
229
+ #### Stubbed / Placeholder
230
+
231
+ | Format | Supported | Description |
232
+ | --- | --- | --- |
233
+ | `stub` | N | Placeholder format for tests and future connectors. |
234
+
235
+ #### Tabular & Delimited Text
236
+
237
+ | Format | Supported | Description |
238
+ | --- | --- | --- |
239
+ | `csv` | Y | Comma-Separated Values |
240
+ | `fwf` | N | Fixed-Width Fields |
241
+ | `dat` | N | Generic data file, often delimited or fixed-width |
242
+ | `psv` | N | Pipe-Separated Values |
243
+ | `tab` | N | Often synonymous with TSV |
244
+ | `tsv` | Y | Tab-Separated Values |
245
+ | `txt` | Y | Plain text, often delimited or fixed-width |
246
+
247
+ #### Semi-Structured Text
248
+
249
+ | Format | Supported | Description |
250
+ | --- | --- | --- |
251
+ | `cfg` | N | Config-style key-value pairs |
252
+ | `conf` | N | Config-style key-value pairs |
253
+ | `ini` | N | Config-style key-value pairs |
254
+ | `json` | Y | JavaScript Object Notation |
255
+ | `ndjson` | Y | Newline-Delimited JSON |
256
+ | `properties` | N | Java-style key-value pairs |
257
+ | `toml` | N | Tom's Obvious Minimal Language |
258
+ | `xml` | Y | Extensible Markup Language |
259
+ | `yaml` | Y | YAML Ain't Markup Language |
260
+
261
+ #### Columnar / Analytics-Friendly
262
+
263
+ | Format | Supported | Description |
264
+ | --- | --- | --- |
265
+ | `arrow` | N | Apache Arrow IPC |
266
+ | `feather` | Y | Apache Arrow Feather |
267
+ | `orc` | Y | Optimized Row Columnar; common in Hadoop |
268
+ | `parquet` | Y | Apache Parquet; common in Big Data |
269
+
270
+ #### Binary Serialization and Interchange
271
+
272
+ | Format | Supported | Description |
273
+ | --- | --- | --- |
274
+ | `avro` | Y | Apache Avro |
275
+ | `bson` | N | Binary JSON; common with MongoDB exports/dumps |
276
+ | `cbor` | N | Concise Binary Object Representation |
277
+ | `ion` | N | Amazon Ion |
278
+ | `msgpack` | N | MessagePack |
279
+ | `pb` | N | Protocol Buffers (Google Protobuf) |
280
+ | `pbf` | N | Protocolbuffer Binary Format; often for GIS data |
281
+ | `proto` | N | Protocol Buffers schema; often in .pb / .bin |
282
+
283
+ #### Databases and Embedded Storage
284
+
285
+ | Format | Supported | Description |
286
+ | --- | --- | --- |
287
+ | `accdb` | N | Microsoft Access database file (newer format) |
288
+ | `duckdb` | N | DuckDB database file |
289
+ | `mdb` | N | Microsoft Access database file (older format) |
290
+ | `sqlite` | N | SQLite database file |
291
+
292
+ #### Spreadsheets
293
+
294
+ | Format | Supported | Description |
295
+ | --- | --- | --- |
296
+ | `xls` | Y | Microsoft Excel (BIFF); read-only |
297
+ | `xlsx` | Y | Microsoft Excel (Open XML) |
298
+
299
+ #### Data Archives
300
+
301
+ | Format | Supported | Description |
302
+ | --- | --- | --- |
303
+ | `gz` | Y | Gzip-compressed file |
304
+ | `zip` | Y | ZIP archive |
305
+
306
+ #### Logs and Event Streams
307
+
308
+ | Format | Supported | Description |
309
+ | --- | --- | --- |
310
+ | `log` | N | Generic log file |
311
+
194
312
  ## Usage
195
313
 
196
314
  ### Command Line Interface
@@ -57,24 +57,47 @@ etlplus/database/schema.py,sha256=813C0Dd3WE53KTYot4dgjAxctgKXLXx-8_Rk_4r2e28,70
57
57
  etlplus/database/types.py,sha256=_pkQyC14TzAlgyeIqZG4F5LWYknZbHw3TW68Auk7Ya0,795
58
58
  etlplus/file/README.md,sha256=avWnyeKfs3uP3qa-DVBJ6t05jS2oFUPeQ3xf1Ph0eC0,3626
59
59
  etlplus/file/__init__.py,sha256=X03bosSM-uSd6dh3ur0un6_ozFRw2Tm4PE6kVUjtXK8,475
60
- etlplus/file/_io.py,sha256=kSbe4Bc9J8br7g856IzBvmKIWSSlng8vo66XN9Z2aiw,2917
61
- etlplus/file/_pandas.py,sha256=6ZqU7QzEMBq7OFl3mfEtotnKunpS3XV_GGRgz7SIHsI,1282
62
- etlplus/file/avro.py,sha256=JHK95zrwuHHICRe8f20xfKmeWzv1wP0Br5pOnINdLSc,4621
63
- etlplus/file/core.py,sha256=BkCliUez8SBEgpagxSeDbJixnX9QvD5XQp0dbYOOw0k,8692
64
- etlplus/file/csv.py,sha256=gtEUWJO54veEtgaLB_QnmR8yOpeToq78nrtAPVTTl44,1269
65
- etlplus/file/enums.py,sha256=rwrbwj6PejG0c5v6jzcsmeNu9cSqDyWB1foIuM5UyJo,6648
66
- etlplus/file/feather.py,sha256=WYZBn2f_Z7KDZZJ1eX0RS-934MnYIMydD0p2Oo30do4,2182
60
+ etlplus/file/_imports.py,sha256=9e8CWjyNIRcmiULEPuwtnJELUOXd4EvVv_vDnDYiB9c,3121
61
+ etlplus/file/_io.py,sha256=GXTcvjfXQX4rSdyu1JNhFmqQJlirDqd8dEGCN3dHvNg,2968
62
+ etlplus/file/accdb.py,sha256=xdBLrXHDonVJ1Z6-qZRrLBXpUwqw5nZYxDuxYMJHzVs,1681
63
+ etlplus/file/arrow.py,sha256=rYPqoCAI3cBHETYN3c0Xi7R5Nq7_prIdyESm3ll3Zos,1694
64
+ etlplus/file/avro.py,sha256=yFQMnWPcvC0CbDCyagoB9SHRIuvl2SXIoQJTBIlw4dA,4437
65
+ etlplus/file/bson.py,sha256=okCWQveCnaRxJ47Oy7-HpByEkiwmiSLSWc0a9eISuVg,1613
66
+ etlplus/file/cbor.py,sha256=hpXTqQ-ei4jYKt6-zq3frDXy-SWRpx1ThQUce6b01xU,1667
67
+ etlplus/file/cfg.py,sha256=sUgbQndKM8vNB7uKRNCaKmJ7Z1KcAVclOnhFP6rqAB8,1726
68
+ etlplus/file/conf.py,sha256=30OsMACauw2gzAo4LN6I0LY0mfnB9OR92GLTOcaH4Mc,1784
69
+ etlplus/file/core.py,sha256=71AFsVwvAP6crsAphMkAmhqTwk_-TkEw9eByG6gwzpA,8862
70
+ etlplus/file/csv.py,sha256=6zXt7OKXm_6k8MrDyw8DdEwpQQrmrxG6myrDplF87_E,1744
71
+ etlplus/file/dat.py,sha256=j-GpY49SmkZtDUzZK6CbrHY9k6N83pyGcMqVGgJZ9cs,1642
72
+ etlplus/file/duckdb.py,sha256=hQ8PWcvYILpkgPEtWeqbT_0yhQpJN9bJh1OwQQCcRD4,1631
73
+ etlplus/file/enums.py,sha256=l7rnwOSf4G27He1y_6Gia3LHLKhnsewlJl7tSlPD_Pw,10924
74
+ etlplus/file/feather.py,sha256=U19T5V_08ooK1STclE9nDvsnUFzu7nvQvi6J09iC-_0,2669
75
+ etlplus/file/fwf.py,sha256=WLbvL94cyLCOYfhABJvoIQc1fljtz3yOuA7X4Fc4QGo,1589
67
76
  etlplus/file/gz.py,sha256=NKsvIV7TIWn8USbvuZmRH9hr6OrXh4TzTfDykHD41Kk,2631
68
- etlplus/file/json.py,sha256=_KAXb4rZ1C8xnaV10IkihuFh1lhbWvajFOlMrBCNVjQ,2099
69
- etlplus/file/ndjson.py,sha256=gT-kgcqCUUSxtm2j-JMejoh65jk-njMvFwxKCquLZw0,2393
70
- etlplus/file/orc.py,sha256=GUrq9rgXCLBJ0i8Jd0Xsl4DzldDBg0FDxYhytb4OgxQ,2139
71
- etlplus/file/parquet.py,sha256=Tp2bi_PAIUdkzc25nArJp7beuUaudw5NdciV6IFHsdQ,2281
72
- etlplus/file/tsv.py,sha256=NiqF84Ck8e_DinaiO8yKRR6fVUTnUhpThzo4E1QUD8k,1271
73
- etlplus/file/txt.py,sha256=BStC7crpkGT4qddEeAD1_1mi_2-vQSXLj2DI-ddPFQE,2206
74
- etlplus/file/xls.py,sha256=83BbBJGxHAdbKH8Imz1l4mOgQT34uo-tyujp2WONRY4,1771
75
- etlplus/file/xlsx.py,sha256=mBKc3dSci9tk4KjQX3CaODwG1ueGtFAfztNUOaWYQAE,2181
76
- etlplus/file/xml.py,sha256=rYtCPvyLn9djClN2xKeqRCPsMXnvCH4R8zj94NJRdQc,4018
77
- etlplus/file/yaml.py,sha256=pWJf0rWyiRpOVOBAwVOosPsdIzuywZ_Cv8_tXLZ6RFw,3183
77
+ etlplus/file/ini.py,sha256=HlvQyQC00oBD8KFBfznPjBx9wF1ZwXH7Yo1JaXqCq8I,1701
78
+ etlplus/file/ion.py,sha256=9q938jROTAcuUT5sRYvS1qIeoz9p8KkVWYDDS2-2A_4,1710
79
+ etlplus/file/json.py,sha256=6EWsOI4RZo366FYsnPp-VkHdgAVBRVUwix-hAJZQM10,2537
80
+ etlplus/file/log.py,sha256=OmsGijXZn1VhN7BUklF8saoktxkmHh1MPLI_BbGDLyc,1681
81
+ etlplus/file/mdb.py,sha256=hSCaxBbc_b9dGTBpR-Gb0UTY2r3zYUxoEiKuwpnx0kI,1657
82
+ etlplus/file/msgpack.py,sha256=9PTitVGnZM0yB2iiwsgLokai6DRmp2l2zfhyjEcajg8,1658
83
+ etlplus/file/ndjson.py,sha256=fSMAAdyucGIVl6zVqylWSBosOg899wgIpIWCGm2HOWU,2432
84
+ etlplus/file/orc.py,sha256=fOO2jQwUr5FHbDve7ztmrE1Mb8uBMQtDo0yp-elVn8Q,2602
85
+ etlplus/file/parquet.py,sha256=nzMrUNQux7Of8Nn0c4d2WYuIJQwZY_xQiO_AuVMCzrI,2758
86
+ etlplus/file/pb.py,sha256=sg72vrjbp7azgEK_oRigmNdSqtEnsrBF24VjOohZhow,1615
87
+ etlplus/file/pbf.py,sha256=lcdehGK_g2drs0VFqTAxZO9-sv65SAkW894ttmlBG8I,1620
88
+ etlplus/file/properties.py,sha256=ZvQ6xiSC71bPH8e5VUt-oITSI1xF99zymoMUgwVur3c,1674
89
+ etlplus/file/proto.py,sha256=QnZMGYHmr6jyiQ08W7hx_MHzNDrPEmMmnbttNRlY4Pg,1668
90
+ etlplus/file/psv.py,sha256=-pfGvLSNOMWVl1mGoKJ_Rh5p5wDyCaxLEd09U23Iub0,1726
91
+ etlplus/file/sqlite.py,sha256=3YRGMB5cRwdZeUVq3J_jSKauad7s8wWHWviqx7yfrUw,1652
92
+ etlplus/file/stub.py,sha256=UPiKD_CYkz66X6bZtSqWX3ShBFrMlf-Se83z4qYnIR4,1733
93
+ etlplus/file/tab.py,sha256=yIbgIM8jkbOmCmewYnDeL4751tHSjVszMIxNlm9C3q8,1984
94
+ etlplus/file/toml.py,sha256=GJ37L3iHwHKksUXCiYz89b490_dwqRVoh3-2bsrSOWI,1642
95
+ etlplus/file/tsv.py,sha256=hKlJd8Q7waZs9_jhRANhmb-fQdPsbvaVG46gYuNVtq0,1766
96
+ etlplus/file/txt.py,sha256=46gSCxPn3SsixtR3RQ-kziaY5cnApHgRbW7UP__9ryE,2313
97
+ etlplus/file/xls.py,sha256=P94lEH8ZMex_G5x1hotidcj-dvGHAnUY7ouzvSYaV7o,1772
98
+ etlplus/file/xlsx.py,sha256=vtiAS8Ng9FV1vCWYTd1YO2ORKIJG3HDfmqy3NkVpt0A,2182
99
+ etlplus/file/xml.py,sha256=p5P60DiV6hyiz-t970d0d0ZXB41gVvAm3MT7dTMULa8,4360
100
+ etlplus/file/yaml.py,sha256=8BEqCELaTQ_nRu1iksLBHVj19P6JmcUf5__fe0yVigw,2449
78
101
  etlplus/file/zip.py,sha256=nd26V3S0edklriKnKOGDTLlO8RBXTda_zLLEQrJgKL4,4185
79
102
  etlplus/templates/README.md,sha256=kHSZ8FWcrlrcWz0hBIbho-k1Bi-PL-DQ7g02o-g70c8,1355
80
103
  etlplus/templates/__init__.py,sha256=tsniN7XJYs3NwYxJ6c2HD5upHP3CDkLx-bQCMt97UOM,106
@@ -83,9 +106,9 @@ etlplus/templates/view.sql.j2,sha256=Iy8DHfhq5yyvrUKDxqp_aHIEXY4Tm6j4wT7YDEFWAhk
83
106
  etlplus/validation/README.md,sha256=qusyiyJu2DsaK80jlwfXVZ0iDgeuTPOX2EL3a_fcFiw,1401
84
107
  etlplus/validation/__init__.py,sha256=Pe5Xg1_EA4uiNZGYu5WTF3j7odjmyxnAJ8rcioaplSQ,1254
85
108
  etlplus/validation/utils.py,sha256=Mtqg449VIke0ziy_wd2r6yrwJzQkA1iulZC87FzXMjo,10201
86
- etlplus-0.12.3.dist-info/licenses/LICENSE,sha256=MuNO63i6kWmgnV2pbP2SLqP54mk1BGmu7CmbtxMmT-U,1069
87
- etlplus-0.12.3.dist-info/METADATA,sha256=pOs4RzpaFcMK7DkbD4k6pzh8BW7aPMUbT4rF1gcSKd4,22878
88
- etlplus-0.12.3.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
89
- etlplus-0.12.3.dist-info/entry_points.txt,sha256=6w-2-jzuPa55spzK34h-UKh2JTEShh38adFRONNP9QE,45
90
- etlplus-0.12.3.dist-info/top_level.txt,sha256=aWWF-udn_sLGuHTM6W6MLh99ArS9ROkUWO8Mi8y1_2U,8
91
- etlplus-0.12.3.dist-info/RECORD,,
109
+ etlplus-0.12.10.dist-info/licenses/LICENSE,sha256=MuNO63i6kWmgnV2pbP2SLqP54mk1BGmu7CmbtxMmT-U,1069
110
+ etlplus-0.12.10.dist-info/METADATA,sha256=Ktx5wLuLA6nVhYLjDVz3OQVog-b_u9FQY4vD3r_lgoQ,26886
111
+ etlplus-0.12.10.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
112
+ etlplus-0.12.10.dist-info/entry_points.txt,sha256=6w-2-jzuPa55spzK34h-UKh2JTEShh38adFRONNP9QE,45
113
+ etlplus-0.12.10.dist-info/top_level.txt,sha256=aWWF-udn_sLGuHTM6W6MLh99ArS9ROkUWO8Mi8y1_2U,8
114
+ etlplus-0.12.10.dist-info/RECORD,,
etlplus/file/_pandas.py DELETED
@@ -1,58 +0,0 @@
1
- """
2
- :mod:`etlplus.file._pandas` module.
3
-
4
- Shared helpers for optional pandas usage.
5
- """
6
-
7
- from __future__ import annotations
8
-
9
- from typing import Any
10
-
11
- # SECTION: EXPORTS ========================================================== #
12
-
13
-
14
- __all__ = [
15
- 'get_pandas',
16
- ]
17
-
18
- # SECTION: INTERNAL CONSTANTS =============================================== #
19
-
20
-
21
- _PANDAS_CACHE: dict[str, Any] = {}
22
-
23
-
24
- # SECTION: FUNCTIONS ======================================================== #
25
-
26
-
27
- def get_pandas(format_name: str) -> Any:
28
- """
29
- Return the pandas module, importing it on first use.
30
-
31
- Parameters
32
- ----------
33
- format_name : str
34
- Human-readable format name for error messages.
35
-
36
- Returns
37
- -------
38
- Any
39
- The pandas module.
40
-
41
- Raises
42
- ------
43
- ImportError
44
- If the optional dependency is missing.
45
- """
46
- mod = _PANDAS_CACHE.get('mod')
47
- if mod is not None: # pragma: no cover - tiny branch
48
- return mod
49
- try:
50
- _pd = __import__('pandas') # type: ignore[assignment]
51
- except ImportError as e: # pragma: no cover
52
- raise ImportError(
53
- f'{format_name} support requires optional dependency "pandas".\n'
54
- 'Install with: pip install pandas',
55
- ) from e
56
- _PANDAS_CACHE['mod'] = _pd
57
-
58
- return _pd