datazip 0.2.0__tar.gz
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.
- datazip-0.2.0/.gitignore +207 -0
- datazip-0.2.0/LICENSE +21 -0
- datazip-0.2.0/PKG-INFO +100 -0
- datazip-0.2.0/README.md +53 -0
- datazip-0.2.0/pyproject.toml +218 -0
- datazip-0.2.0/src/datazip/__init__.py +17 -0
- datazip-0.2.0/src/datazip/_optional.py +142 -0
- datazip-0.2.0/src/datazip/_test_classes.py +186 -0
- datazip-0.2.0/src/datazip/_utils.py +87 -0
- datazip-0.2.0/src/datazip/_version.py +24 -0
- datazip-0.2.0/src/datazip/core.py +876 -0
- datazip-0.2.0/src/datazip/mixin.py +117 -0
- datazip-0.2.0/tests/__init__.py +1 -0
- datazip-0.2.0/tests/conftest.py +69 -0
- datazip-0.2.0/tests/smoke_test.py +8 -0
- datazip-0.2.0/tests/unit/__init__.py +1 -0
- datazip-0.2.0/tests/unit/datazip_test.py +702 -0
datazip-0.2.0/.gitignore
ADDED
|
@@ -0,0 +1,207 @@
|
|
|
1
|
+
# Catalyst specific files
|
|
2
|
+
*.swp
|
|
3
|
+
commit.txt
|
|
4
|
+
|
|
5
|
+
# Byte-compiled / optimized / DLL files
|
|
6
|
+
__pycache__/
|
|
7
|
+
*.py[cod]
|
|
8
|
+
*$py.class
|
|
9
|
+
|
|
10
|
+
# C extensions
|
|
11
|
+
*.so
|
|
12
|
+
|
|
13
|
+
# MkDocs build output
|
|
14
|
+
site/
|
|
15
|
+
|
|
16
|
+
# Distribution / packaging
|
|
17
|
+
.Python
|
|
18
|
+
build/
|
|
19
|
+
develop-eggs/
|
|
20
|
+
dist/
|
|
21
|
+
downloads/
|
|
22
|
+
eggs/
|
|
23
|
+
.eggs/
|
|
24
|
+
lib/
|
|
25
|
+
lib64/
|
|
26
|
+
parts/
|
|
27
|
+
sdist/
|
|
28
|
+
var/
|
|
29
|
+
wheels/
|
|
30
|
+
pip-wheel-metadata/
|
|
31
|
+
share/python-wheels/
|
|
32
|
+
*.egg-info/
|
|
33
|
+
.installed.cfg
|
|
34
|
+
*.egg
|
|
35
|
+
MANIFEST
|
|
36
|
+
_version.py
|
|
37
|
+
|
|
38
|
+
# PyInstaller
|
|
39
|
+
# Usually these files are written by a python script from a template
|
|
40
|
+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
|
|
41
|
+
*.manifest
|
|
42
|
+
*.spec
|
|
43
|
+
|
|
44
|
+
# Installer logs
|
|
45
|
+
pip-log.txt
|
|
46
|
+
pip-delete-this-directory.txt
|
|
47
|
+
|
|
48
|
+
# Unit test / coverage reports
|
|
49
|
+
htmlcov/
|
|
50
|
+
.tox/
|
|
51
|
+
.nox/
|
|
52
|
+
.coverage
|
|
53
|
+
.coverage.*
|
|
54
|
+
.cache
|
|
55
|
+
nosetests.xml
|
|
56
|
+
coverage.xml
|
|
57
|
+
coverage.info
|
|
58
|
+
*.cover
|
|
59
|
+
*.py,cover
|
|
60
|
+
.hypothesis/
|
|
61
|
+
.pytest_cache/
|
|
62
|
+
tests/*.zip
|
|
63
|
+
!tests/test_data/pudltabl.zip
|
|
64
|
+
|
|
65
|
+
# Translations
|
|
66
|
+
*.mo
|
|
67
|
+
*.pot
|
|
68
|
+
|
|
69
|
+
# Django stuff:
|
|
70
|
+
*.log
|
|
71
|
+
local_settings.py
|
|
72
|
+
db.sqlite3
|
|
73
|
+
db.sqlite3-journal
|
|
74
|
+
|
|
75
|
+
# Flask stuff:
|
|
76
|
+
instance/
|
|
77
|
+
.webassets-cache
|
|
78
|
+
|
|
79
|
+
# Scrapy stuff:
|
|
80
|
+
.scrapy
|
|
81
|
+
|
|
82
|
+
# Sphinx documentation
|
|
83
|
+
docs/_build/
|
|
84
|
+
|
|
85
|
+
# PyBuilder
|
|
86
|
+
target/
|
|
87
|
+
|
|
88
|
+
# Jupyter Notebook
|
|
89
|
+
.ipynb_checkpoints
|
|
90
|
+
|
|
91
|
+
# IPython
|
|
92
|
+
profile_default/
|
|
93
|
+
ipython_config.py
|
|
94
|
+
|
|
95
|
+
# pyenv
|
|
96
|
+
.python-version
|
|
97
|
+
|
|
98
|
+
# pipenv
|
|
99
|
+
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
|
|
100
|
+
# However, in case of collaboration, if having platform-specific dependencies or dependencies
|
|
101
|
+
# having no cross-platform support, pipenv may install dependencies that don't work, or not
|
|
102
|
+
# install all needed dependencies.
|
|
103
|
+
#Pipfile.lock
|
|
104
|
+
|
|
105
|
+
# PEP 582; used by e.g. github.com/David-OConnor/pyflow
|
|
106
|
+
__pypackages__/
|
|
107
|
+
|
|
108
|
+
# Celery stuff
|
|
109
|
+
celerybeat-schedule
|
|
110
|
+
celerybeat.pid
|
|
111
|
+
|
|
112
|
+
# SageMath parsed files
|
|
113
|
+
*.sage.py
|
|
114
|
+
|
|
115
|
+
# Environments
|
|
116
|
+
.env_tox/
|
|
117
|
+
.env
|
|
118
|
+
.venv
|
|
119
|
+
env/
|
|
120
|
+
venv/
|
|
121
|
+
ENV/
|
|
122
|
+
env.bak/
|
|
123
|
+
venv.bak/
|
|
124
|
+
# as a library, we don't want to lock
|
|
125
|
+
uv.lock
|
|
126
|
+
pixi.lock
|
|
127
|
+
|
|
128
|
+
# Spyder project settings
|
|
129
|
+
.spyderproject
|
|
130
|
+
.spyproject
|
|
131
|
+
|
|
132
|
+
# Rope project settings
|
|
133
|
+
.ropeproject
|
|
134
|
+
|
|
135
|
+
# mkdocs documentation
|
|
136
|
+
/site
|
|
137
|
+
|
|
138
|
+
# mypy
|
|
139
|
+
.mypy_cache/
|
|
140
|
+
.dmypy.json
|
|
141
|
+
dmypy.json
|
|
142
|
+
|
|
143
|
+
# Pyre type checker
|
|
144
|
+
.pyre/
|
|
145
|
+
|
|
146
|
+
# annoying mac stuff
|
|
147
|
+
.DS_Store
|
|
148
|
+
.DS_Store?
|
|
149
|
+
~$*
|
|
150
|
+
._*
|
|
151
|
+
.Spotlight-V100
|
|
152
|
+
.Trashes
|
|
153
|
+
ehthumbs.db
|
|
154
|
+
Thumbs.db
|
|
155
|
+
|
|
156
|
+
# PyCharm
|
|
157
|
+
/.idea
|
|
158
|
+
*.iml
|
|
159
|
+
|
|
160
|
+
# ================= R related =================
|
|
161
|
+
# History files
|
|
162
|
+
.Rhistory
|
|
163
|
+
.Rapp.history
|
|
164
|
+
|
|
165
|
+
# Session Data files
|
|
166
|
+
.RData
|
|
167
|
+
.RDataTmp
|
|
168
|
+
|
|
169
|
+
# User-specific files
|
|
170
|
+
.Ruserdata
|
|
171
|
+
|
|
172
|
+
# Example code in package build process
|
|
173
|
+
*-Ex.R
|
|
174
|
+
|
|
175
|
+
# Output files from R CMD build
|
|
176
|
+
/*.tar.gz
|
|
177
|
+
|
|
178
|
+
# Output files from R CMD check
|
|
179
|
+
/*.Rcheck/
|
|
180
|
+
|
|
181
|
+
# RStudio files
|
|
182
|
+
.Rproj.user/
|
|
183
|
+
#*.Rproj # do want to share these files, for now
|
|
184
|
+
|
|
185
|
+
# produced vignettes
|
|
186
|
+
vignettes/*.html
|
|
187
|
+
vignettes/*.pdf
|
|
188
|
+
|
|
189
|
+
# OAuth2 token, see https://github.com/hadley/httr/releases/tag/v0.3
|
|
190
|
+
.httr-oauth
|
|
191
|
+
|
|
192
|
+
# knitr and R markdown default cache directories
|
|
193
|
+
*_cache/
|
|
194
|
+
/cache/
|
|
195
|
+
|
|
196
|
+
# Temporary files created by R markdown
|
|
197
|
+
*.utf8.md
|
|
198
|
+
*.knit.md
|
|
199
|
+
|
|
200
|
+
# R Environment Variables
|
|
201
|
+
.Renviron
|
|
202
|
+
|
|
203
|
+
# translation temp files
|
|
204
|
+
po/*~
|
|
205
|
+
|
|
206
|
+
# RStudio Connect folder
|
|
207
|
+
rsconnect/
|
datazip-0.2.0/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Alex Engel
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
datazip-0.2.0/PKG-INFO
ADDED
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: datazip
|
|
3
|
+
Version: 0.2.0
|
|
4
|
+
Summary: Seamless serialization and deserialization of complex Python objects — a more flexible and readable alternative to pickle for data science workflows.
|
|
5
|
+
Author-email: Alex Engel <alex@colectric.com>
|
|
6
|
+
License: MIT License
|
|
7
|
+
|
|
8
|
+
Copyright (c) 2026 Alex Engel
|
|
9
|
+
|
|
10
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
11
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
12
|
+
in the Software without restriction, including without limitation the rights
|
|
13
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
14
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
15
|
+
furnished to do so, subject to the following conditions:
|
|
16
|
+
|
|
17
|
+
The above copyright notice and this permission notice shall be included in all
|
|
18
|
+
copies or substantial portions of the Software.
|
|
19
|
+
|
|
20
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
21
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
22
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
23
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
24
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
25
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
26
|
+
SOFTWARE.
|
|
27
|
+
License-File: LICENSE
|
|
28
|
+
Classifier: Natural Language :: English
|
|
29
|
+
Classifier: Operating System :: OS Independent
|
|
30
|
+
Classifier: Programming Language :: Python
|
|
31
|
+
Requires-Python: >=3.12
|
|
32
|
+
Requires-Dist: orjson>=3.8
|
|
33
|
+
Requires-Dist: tzdata>=2022.7; platform_system == 'Windows'
|
|
34
|
+
Provides-Extra: dev
|
|
35
|
+
Requires-Dist: coverage>=5.3; extra == 'dev'
|
|
36
|
+
Requires-Dist: pandas>=2.0; extra == 'dev'
|
|
37
|
+
Requires-Dist: plotly>5.10; extra == 'dev'
|
|
38
|
+
Requires-Dist: polars>=0.20; extra == 'dev'
|
|
39
|
+
Requires-Dist: pyarrow>=9; extra == 'dev'
|
|
40
|
+
Requires-Dist: pytest>=6.2; extra == 'dev'
|
|
41
|
+
Provides-Extra: docs
|
|
42
|
+
Requires-Dist: matplotlib>=3.7; extra == 'docs'
|
|
43
|
+
Requires-Dist: mkdocs-material>=9.0; extra == 'docs'
|
|
44
|
+
Requires-Dist: mkdocs>=1.5; extra == 'docs'
|
|
45
|
+
Requires-Dist: mkdocstrings[python]>=0.24; extra == 'docs'
|
|
46
|
+
Description-Content-Type: text/markdown
|
|
47
|
+
|
|
48
|
+
# DataZip
|
|
49
|
+
[](https://github.com/colectric-dev/datazip/actions)
|
|
50
|
+
[](https://colectric-dev.github.io/datazip/)
|
|
51
|
+
[](https://github.com/astral-sh/ruff)
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
**DataZip** is a Python library that extends [`zipfile.ZipFile`](https://docs.python.org/3/library/zipfile.html#zipfile.ZipFile) to provide seamless serialization and deserialization of complex Python objects — a more flexible and readable alternative to pickle for data science workflows.
|
|
56
|
+
|
|
57
|
+
## Why DataZip?
|
|
58
|
+
|
|
59
|
+
- **Human-inspectable archives**: DataZip files are standard `.zip` files. You can open them with any archive tool and inspect the contents.
|
|
60
|
+
- **Broad type support**: Works out of the box with pandas DataFrames/Series, NumPy arrays, Polars DataFrames, datetimes, paths, sets, frozensets, complex numbers, and custom classes.
|
|
61
|
+
- **Efficient storage**: Tabular data is stored as Parquet; arrays as `.npy`. JSON is used for metadata and simple types.
|
|
62
|
+
- **No pickle by default**: Most types are serialized without pickle, making files safer and more portable.
|
|
63
|
+
- **Custom class integration**: Any class that implements `__getstate__`/`__setstate__` (the standard pickle protocol) works automatically. The `IOMixin` makes it even simpler.
|
|
64
|
+
|
|
65
|
+
## Quick Example
|
|
66
|
+
|
|
67
|
+
```python
|
|
68
|
+
from io import BytesIO
|
|
69
|
+
import pandas as pd
|
|
70
|
+
from datazip import DataZip
|
|
71
|
+
|
|
72
|
+
# Write
|
|
73
|
+
buffer = BytesIO()
|
|
74
|
+
with DataZip(buffer, "w") as z:
|
|
75
|
+
z["df"] = pd.DataFrame({"x": [1, 2, 3], "y": [4, 5, 6]})
|
|
76
|
+
z["config"] = {"threshold": 0.5, "labels": ["a", "b"]}
|
|
77
|
+
z["values"] = {1, 2, frozenset([3, 4])}
|
|
78
|
+
|
|
79
|
+
# Read
|
|
80
|
+
with DataZip(buffer, "r") as z:
|
|
81
|
+
df = z["df"]
|
|
82
|
+
config = z["config"]
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
## Supported Types
|
|
86
|
+
|
|
87
|
+
| Category | Types |
|
|
88
|
+
|---|------------------------------------------------------------------|
|
|
89
|
+
| Primitives | `str`, `int`, `float`, `bool`, `None`, `complex` |
|
|
90
|
+
| Collections | `dict`, `list`, `tuple`, `set`, `frozenset`, `deque`, `defaultdict` |
|
|
91
|
+
| Date/Time | `datetime`, `pandas.Timestamp` |
|
|
92
|
+
| Paths | `pathlib.Path` |
|
|
93
|
+
| NumPy | `numpy.ndarray` |
|
|
94
|
+
| Pandas | `pandas.DataFrame`, `pandas.Series` |
|
|
95
|
+
| Polars | `polars.DataFrame`, `polars.LazyFrame`, `polars.Series` |
|
|
96
|
+
| Custom | Any class with `__getstate__`/`__setstate__` |
|
|
97
|
+
| Optional | Plotly figures |
|
|
98
|
+
|
|
99
|
+
|
|
100
|
+
See the [Installation](installation.md) page for full details including optional dependencies.
|
datazip-0.2.0/README.md
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
# DataZip
|
|
2
|
+
[](https://github.com/colectric-dev/datazip/actions)
|
|
3
|
+
[](https://colectric-dev.github.io/datazip/)
|
|
4
|
+
[](https://github.com/astral-sh/ruff)
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
**DataZip** is a Python library that extends [`zipfile.ZipFile`](https://docs.python.org/3/library/zipfile.html#zipfile.ZipFile) to provide seamless serialization and deserialization of complex Python objects — a more flexible and readable alternative to pickle for data science workflows.
|
|
9
|
+
|
|
10
|
+
## Why DataZip?
|
|
11
|
+
|
|
12
|
+
- **Human-inspectable archives**: DataZip files are standard `.zip` files. You can open them with any archive tool and inspect the contents.
|
|
13
|
+
- **Broad type support**: Works out of the box with pandas DataFrames/Series, NumPy arrays, Polars DataFrames, datetimes, paths, sets, frozensets, complex numbers, and custom classes.
|
|
14
|
+
- **Efficient storage**: Tabular data is stored as Parquet; arrays as `.npy`. JSON is used for metadata and simple types.
|
|
15
|
+
- **No pickle by default**: Most types are serialized without pickle, making files safer and more portable.
|
|
16
|
+
- **Custom class integration**: Any class that implements `__getstate__`/`__setstate__` (the standard pickle protocol) works automatically. The `IOMixin` makes it even simpler.
|
|
17
|
+
|
|
18
|
+
## Quick Example
|
|
19
|
+
|
|
20
|
+
```python
|
|
21
|
+
from io import BytesIO
|
|
22
|
+
import pandas as pd
|
|
23
|
+
from datazip import DataZip
|
|
24
|
+
|
|
25
|
+
# Write
|
|
26
|
+
buffer = BytesIO()
|
|
27
|
+
with DataZip(buffer, "w") as z:
|
|
28
|
+
z["df"] = pd.DataFrame({"x": [1, 2, 3], "y": [4, 5, 6]})
|
|
29
|
+
z["config"] = {"threshold": 0.5, "labels": ["a", "b"]}
|
|
30
|
+
z["values"] = {1, 2, frozenset([3, 4])}
|
|
31
|
+
|
|
32
|
+
# Read
|
|
33
|
+
with DataZip(buffer, "r") as z:
|
|
34
|
+
df = z["df"]
|
|
35
|
+
config = z["config"]
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
## Supported Types
|
|
39
|
+
|
|
40
|
+
| Category | Types |
|
|
41
|
+
|---|------------------------------------------------------------------|
|
|
42
|
+
| Primitives | `str`, `int`, `float`, `bool`, `None`, `complex` |
|
|
43
|
+
| Collections | `dict`, `list`, `tuple`, `set`, `frozenset`, `deque`, `defaultdict` |
|
|
44
|
+
| Date/Time | `datetime`, `pandas.Timestamp` |
|
|
45
|
+
| Paths | `pathlib.Path` |
|
|
46
|
+
| NumPy | `numpy.ndarray` |
|
|
47
|
+
| Pandas | `pandas.DataFrame`, `pandas.Series` |
|
|
48
|
+
| Polars | `polars.DataFrame`, `polars.LazyFrame`, `polars.Series` |
|
|
49
|
+
| Custom | Any class with `__getstate__`/`__setstate__` |
|
|
50
|
+
| Optional | Plotly figures |
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
See the [Installation](installation.md) page for full details including optional dependencies.
|
|
@@ -0,0 +1,218 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = [ "hatchling", "hatch-vcs" ]
|
|
3
|
+
build-backend = "hatchling.build"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "datazip"
|
|
7
|
+
dynamic = [ "version" ]
|
|
8
|
+
description = "Seamless serialization and deserialization of complex Python objects — a more flexible and readable alternative to pickle for data science workflows."
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
authors = [
|
|
11
|
+
{ name = "Alex Engel", email = "alex@colectric.com" }
|
|
12
|
+
]
|
|
13
|
+
license = { file = "LICENSE" }
|
|
14
|
+
classifiers = [
|
|
15
|
+
"Natural Language :: English",
|
|
16
|
+
"Operating System :: OS Independent",
|
|
17
|
+
"Programming Language :: Python",
|
|
18
|
+
]
|
|
19
|
+
requires-python = ">=3.12"
|
|
20
|
+
dependencies = [
|
|
21
|
+
"orjson>=3.8",
|
|
22
|
+
"tzdata>=2022.7;platform_system=='Windows'",
|
|
23
|
+
]
|
|
24
|
+
|
|
25
|
+
[project.optional-dependencies]
|
|
26
|
+
dev = [
|
|
27
|
+
"pandas>=2.0",
|
|
28
|
+
"polars>=0.20",
|
|
29
|
+
"pyarrow>=9",
|
|
30
|
+
"coverage>=5.3", # Lets us track what code is being tested
|
|
31
|
+
"pytest>=6.2", # test framework
|
|
32
|
+
"plotly>5.10",
|
|
33
|
+
]
|
|
34
|
+
docs = [
|
|
35
|
+
"mkdocs>=1.5",
|
|
36
|
+
"mkdocs-material>=9.0",
|
|
37
|
+
"mkdocstrings[python]>=0.24",
|
|
38
|
+
"matplotlib>=3.7",
|
|
39
|
+
]
|
|
40
|
+
|
|
41
|
+
[tool.hatch.version]
|
|
42
|
+
source = "vcs"
|
|
43
|
+
|
|
44
|
+
[tool.hatch.build]
|
|
45
|
+
hooks.vcs.version-file = "src/datazip/_version.py"
|
|
46
|
+
targets.wheel.only-packages = true
|
|
47
|
+
targets.sdist.only-packages = true
|
|
48
|
+
targets.wheel.sources = ["src"]
|
|
49
|
+
|
|
50
|
+
[tool.tox]
|
|
51
|
+
env_list = [ "linters", "prep", "3.12", "3.13", "3.14", "coverage" ]
|
|
52
|
+
|
|
53
|
+
[tool.tox.env.prep]
|
|
54
|
+
skip_install = true
|
|
55
|
+
deps = "coverage"
|
|
56
|
+
commands = [ [ "coverage", "erase" ] ]
|
|
57
|
+
|
|
58
|
+
[tool.tox.env_run_base]
|
|
59
|
+
allowlist_externals = [ "bash", "ruff", "prek" ]
|
|
60
|
+
runner = "uv-venv-runner"
|
|
61
|
+
extras = [ "dev" ]
|
|
62
|
+
commands = [
|
|
63
|
+
[ "coverage", "run", "--source={envsitepackagesdir}/datazip", "-m", "pytest", "--doctest-modules", "{envsitepackagesdir}/datazip", "tests/unit" ],
|
|
64
|
+
]
|
|
65
|
+
|
|
66
|
+
[tool.tox.env.coverage]
|
|
67
|
+
depends = [ "3.12", "3.13", "3.14" ]
|
|
68
|
+
skip_install = true
|
|
69
|
+
deps = "coverage"
|
|
70
|
+
commands = [
|
|
71
|
+
[ "coverage", "combine" ],
|
|
72
|
+
[ "coverage", "report", "--sort=cover" ],
|
|
73
|
+
]
|
|
74
|
+
|
|
75
|
+
[tool.tox.env.docs]
|
|
76
|
+
description = "Build the MkDocs documentation."
|
|
77
|
+
skip_install = false
|
|
78
|
+
extras = [ "docs" ]
|
|
79
|
+
allowlist_externals = [ "mkdocs" ]
|
|
80
|
+
commands = [
|
|
81
|
+
[ "mkdocs", "build" ],
|
|
82
|
+
]
|
|
83
|
+
|
|
84
|
+
[tool.tox.env.linters]
|
|
85
|
+
description = "Run the prek and ruff linters."
|
|
86
|
+
commands = [
|
|
87
|
+
[ "prek", "run", "--all-files", "--show-diff-on-failure", "--skip", "ruff", "--skip", "ruff-format", "--skip", "prettier", "--skip", "doc8", "--skip", "rstcheck" ],
|
|
88
|
+
[ "ruff", "check", "." ],
|
|
89
|
+
]
|
|
90
|
+
|
|
91
|
+
[tool.coverage]
|
|
92
|
+
run.parallel = true
|
|
93
|
+
run.branch = true
|
|
94
|
+
run.source = [ "datazip" ]
|
|
95
|
+
paths.source = [ "src", ".tox/3*/**/site-packages" ]
|
|
96
|
+
report.omit = [ "*/_version.py" ]
|
|
97
|
+
report.show_missing = true
|
|
98
|
+
|
|
99
|
+
[tool.pytest.ini_options]
|
|
100
|
+
testpaths = [ "." ]
|
|
101
|
+
addopts = [ "--verbose", "--doctest-modules" ]
|
|
102
|
+
log_format = "%(asctime)s [%(levelname)8s] %(name)s:%(lineno)s %(message)s"
|
|
103
|
+
log_date_format = " %Y-%m-%d %H:%M:%S"
|
|
104
|
+
log_cli = true
|
|
105
|
+
log_cli_level = "WARNING"
|
|
106
|
+
doctest_optionflags = [ "NORMALIZE_WHITESPACE", "IGNORE_EXCEPTION_DETAIL", "ELLIPSIS" ]
|
|
107
|
+
filterwarnings = [
|
|
108
|
+
"ignore:distutils Version classes are deprecated:DeprecationWarning",
|
|
109
|
+
"ignore:Creating a LegacyVersion:DeprecationWarning:pkg_resources[.*]",
|
|
110
|
+
]
|
|
111
|
+
|
|
112
|
+
[tool.ruff]
|
|
113
|
+
line-length = 88
|
|
114
|
+
show-fixes = true
|
|
115
|
+
exclude = [
|
|
116
|
+
".bzr",
|
|
117
|
+
".direnv",
|
|
118
|
+
".eggs",
|
|
119
|
+
".git",
|
|
120
|
+
".git-rewrite",
|
|
121
|
+
".hg",
|
|
122
|
+
".ipynb_checkpoints",
|
|
123
|
+
".mypy_cache",
|
|
124
|
+
".nox",
|
|
125
|
+
".pants.d",
|
|
126
|
+
".pyenv",
|
|
127
|
+
".pytest_cache",
|
|
128
|
+
".pytype",
|
|
129
|
+
".ruff_cache",
|
|
130
|
+
".svn",
|
|
131
|
+
".tox",
|
|
132
|
+
".venv",
|
|
133
|
+
".vscode",
|
|
134
|
+
".pixi",
|
|
135
|
+
"__pypackages__",
|
|
136
|
+
"_build",
|
|
137
|
+
"buck-out",
|
|
138
|
+
"build",
|
|
139
|
+
"dist",
|
|
140
|
+
"node_modules",
|
|
141
|
+
"site-packages",
|
|
142
|
+
"venv",
|
|
143
|
+
]
|
|
144
|
+
|
|
145
|
+
[tool.ruff.format]
|
|
146
|
+
# Enable reformatting of code snippets in docstrings.
|
|
147
|
+
docstring-code-format = true
|
|
148
|
+
|
|
149
|
+
[tool.ruff.lint]
|
|
150
|
+
select = [ # https://beta.ruff.rs/docs/rules/
|
|
151
|
+
"A", # flake8-builtins
|
|
152
|
+
"B", # flake8-bugbear
|
|
153
|
+
"C",
|
|
154
|
+
"C4", # flake8-comprehensions
|
|
155
|
+
"D", # flake8-docstrings
|
|
156
|
+
"E", # pycodestyle
|
|
157
|
+
"F", # Pyflakes
|
|
158
|
+
"FBT", # flake8-boolean-trap
|
|
159
|
+
"G", # flake8-logging-format
|
|
160
|
+
"I", # isort
|
|
161
|
+
"TID", # flake8-tidy-imports
|
|
162
|
+
"N", # pep8-naming
|
|
163
|
+
"PD", # pandas
|
|
164
|
+
"PT", # flake8-pytest-style
|
|
165
|
+
"PGH", # pygrep-hooks
|
|
166
|
+
"S", # bandit
|
|
167
|
+
"SIM", # flake8-simplify
|
|
168
|
+
"TCH", # flake8-type-checking
|
|
169
|
+
"UP", # pyupgrade
|
|
170
|
+
"W", # pycodestyle
|
|
171
|
+
"RUF", # Ruff-specific rules
|
|
172
|
+
"Q", # flake8-quotes
|
|
173
|
+
]
|
|
174
|
+
ignore = [
|
|
175
|
+
"D105",
|
|
176
|
+
"D203", # 1 blank line required before class docstring
|
|
177
|
+
"D213", # Multi-line docstring summary should start at the second line
|
|
178
|
+
"D401", # First line of docstring should be in imperative mood: "{first_line}"
|
|
179
|
+
"D407", # dashed-underline-after-section, upsets Sphinx
|
|
180
|
+
"D416",
|
|
181
|
+
# conflict with ruff format
|
|
182
|
+
"W191", # tab-indentation
|
|
183
|
+
"E111", # indentation-with-invalid-multiple
|
|
184
|
+
"E114", # indentation-with-invalid-multiple-comment
|
|
185
|
+
"E117", # over-indented
|
|
186
|
+
"D206", # indent-with-spaces
|
|
187
|
+
"D300", # triple-single-quotes
|
|
188
|
+
"Q000", # bad-quotes-inline-string
|
|
189
|
+
"Q001", # bad-quotes-multiline-string
|
|
190
|
+
"Q002", # bad-quotes-docstring
|
|
191
|
+
"Q003", # avoidable-escaped-quote
|
|
192
|
+
"COM812", # missing-trailing-comma
|
|
193
|
+
"COM819", # prohibited-trailing-comma
|
|
194
|
+
"ISC001", # single-line-implicit-string-concatenation
|
|
195
|
+
"ISC002", # multi-line-implicit-string-concatenation
|
|
196
|
+
]
|
|
197
|
+
flake8-tidy-imports.ban-relative-imports = "all"
|
|
198
|
+
flake8-type-checking.strict = true
|
|
199
|
+
mccabe.max-complexity = 15 # Unlike Flake8, default to a complexity level of 10.
|
|
200
|
+
pycodestyle.max-doc-length = 88
|
|
201
|
+
pydocstyle.convention = "google"
|
|
202
|
+
|
|
203
|
+
[tool.ruff.lint.per-file-ignores]
|
|
204
|
+
"__init__.py" = [ "F401" ]
|
|
205
|
+
"docs/benchmarks.py" = [ "D103", "S301", "S311" ]
|
|
206
|
+
"tests/*.py" = [
|
|
207
|
+
"D100", # Missing docstring in public module
|
|
208
|
+
"D101", # Missing docstring in public class
|
|
209
|
+
"F841", # Local variable `pudl` is assigned to but never used
|
|
210
|
+
"FBT003", # Boolean positional value in function call, can't fix it pytest.param
|
|
211
|
+
"PD901",
|
|
212
|
+
"PT006", # Wrong name(s) type in `@pytest.mark.parametrize`, expected `tuple`
|
|
213
|
+
"PT011", # `pytest.raises(ValueError)` is too broad, set the `match` parameter or use a more specific exception
|
|
214
|
+
"S101", # Use of `assert` detected
|
|
215
|
+
"SIM117", # Use a single `with` statement with multiple contexts instead of nested `with` statements
|
|
216
|
+
|
|
217
|
+
]
|
|
218
|
+
"_test_classes.py" = [ "FBT003" ]
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"""Datazip."""
|
|
2
|
+
|
|
3
|
+
import logging
|
|
4
|
+
|
|
5
|
+
# Create a root logger for use anywhere within the package.
|
|
6
|
+
logger = logging.getLogger("datazip")
|
|
7
|
+
|
|
8
|
+
try:
|
|
9
|
+
from datazip._version import version as __version__
|
|
10
|
+
except ImportError:
|
|
11
|
+
logger.warning("Version unknown because package is not installed.")
|
|
12
|
+
__version__ = "unknown"
|
|
13
|
+
|
|
14
|
+
from datazip.core import DataZip # noqa: E402
|
|
15
|
+
from datazip.mixin import IOMixin # noqa: E402
|
|
16
|
+
|
|
17
|
+
__all__ = ["DataZip", "IOMixin", "__version__"]
|