pydiverse-common 0.3.7__tar.gz → 0.3.8__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.
- {pydiverse_common-0.3.7 → pydiverse_common-0.3.8}/PKG-INFO +1 -1
- {pydiverse_common-0.3.7 → pydiverse_common-0.3.8}/docs/source/changelog.md +3 -0
- {pydiverse_common-0.3.7 → pydiverse_common-0.3.8}/pyproject.toml +1 -1
- {pydiverse_common-0.3.7 → pydiverse_common-0.3.8}/src/pydiverse/common/util/hashing.py +16 -13
- {pydiverse_common-0.3.7 → pydiverse_common-0.3.8}/tests/test_util.py +11 -0
- {pydiverse_common-0.3.7 → pydiverse_common-0.3.8}/.gitattributes +0 -0
- {pydiverse_common-0.3.7 → pydiverse_common-0.3.8}/.github/CODEOWNERS +0 -0
- {pydiverse_common-0.3.7 → pydiverse_common-0.3.8}/.github/PULL_REQUEST_TEMPLATE.md +0 -0
- {pydiverse_common-0.3.7 → pydiverse_common-0.3.8}/.github/dependabot.yml +0 -0
- {pydiverse_common-0.3.7 → pydiverse_common-0.3.8}/.github/scripts/check_deps.sh +0 -0
- {pydiverse_common-0.3.7 → pydiverse_common-0.3.8}/.github/workflows/release.yml +0 -0
- {pydiverse_common-0.3.7 → pydiverse_common-0.3.8}/.github/workflows/tests.yml +0 -0
- {pydiverse_common-0.3.7 → pydiverse_common-0.3.8}/.github/workflows/update-lockfiles.yml +0 -0
- {pydiverse_common-0.3.7 → pydiverse_common-0.3.8}/.gitignore +0 -0
- {pydiverse_common-0.3.7 → pydiverse_common-0.3.8}/.pre-commit-config.yaml +0 -0
- {pydiverse_common-0.3.7 → pydiverse_common-0.3.8}/.readthedocs.yaml +0 -0
- {pydiverse_common-0.3.7 → pydiverse_common-0.3.8}/LICENSE +0 -0
- {pydiverse_common-0.3.7 → pydiverse_common-0.3.8}/README.md +0 -0
- {pydiverse_common-0.3.7 → pydiverse_common-0.3.8}/docs/Makefile +0 -0
- {pydiverse_common-0.3.7 → pydiverse_common-0.3.8}/docs/make.bat +0 -0
- {pydiverse_common-0.3.7 → pydiverse_common-0.3.8}/docs/package/README.md +0 -0
- {pydiverse_common-0.3.7 → pydiverse_common-0.3.8}/docs/source/conf.py +0 -0
- {pydiverse_common-0.3.7 → pydiverse_common-0.3.8}/docs/source/index.md +0 -0
- {pydiverse_common-0.3.7 → pydiverse_common-0.3.8}/docs/source/license.md +0 -0
- {pydiverse_common-0.3.7 → pydiverse_common-0.3.8}/docs/source/reference/api.rst +0 -0
- {pydiverse_common-0.3.7 → pydiverse_common-0.3.8}/pixi.lock +0 -0
- {pydiverse_common-0.3.7 → pydiverse_common-0.3.8}/pixi.toml +0 -0
- {pydiverse_common-0.3.7 → pydiverse_common-0.3.8}/pytest.ini +0 -0
- {pydiverse_common-0.3.7 → pydiverse_common-0.3.8}/src/pydiverse/common/__init__.py +0 -0
- {pydiverse_common-0.3.7 → pydiverse_common-0.3.8}/src/pydiverse/common/dtypes.py +0 -0
- {pydiverse_common-0.3.7 → pydiverse_common-0.3.8}/src/pydiverse/common/errors/__init__.py +0 -0
- {pydiverse_common-0.3.7 → pydiverse_common-0.3.8}/src/pydiverse/common/testing.py +0 -0
- {pydiverse_common-0.3.7 → pydiverse_common-0.3.8}/src/pydiverse/common/util/__init__.py +0 -0
- {pydiverse_common-0.3.7 → pydiverse_common-0.3.8}/src/pydiverse/common/util/computation_tracing.py +0 -0
- {pydiverse_common-0.3.7 → pydiverse_common-0.3.8}/src/pydiverse/common/util/deep_map.py +0 -0
- {pydiverse_common-0.3.7 → pydiverse_common-0.3.8}/src/pydiverse/common/util/deep_merge.py +0 -0
- {pydiverse_common-0.3.7 → pydiverse_common-0.3.8}/src/pydiverse/common/util/disposable.py +0 -0
- {pydiverse_common-0.3.7 → pydiverse_common-0.3.8}/src/pydiverse/common/util/import_.py +0 -0
- {pydiverse_common-0.3.7 → pydiverse_common-0.3.8}/src/pydiverse/common/util/structlog.py +0 -0
- {pydiverse_common-0.3.7 → pydiverse_common-0.3.8}/src/pydiverse/common/version.py +0 -0
- {pydiverse_common-0.3.7 → pydiverse_common-0.3.8}/tests/conftest.py +0 -0
- {pydiverse_common-0.3.7 → pydiverse_common-0.3.8}/tests/dtypes/test_dtype_pandas.py +0 -0
- {pydiverse_common-0.3.7 → pydiverse_common-0.3.8}/tests/dtypes/test_dtype_polars.py +0 -0
- {pydiverse_common-0.3.7 → pydiverse_common-0.3.8}/tests/dtypes/test_dtype_pyarrow.py +0 -0
- {pydiverse_common-0.3.7 → pydiverse_common-0.3.8}/tests/dtypes/test_dtype_sqlalchemy.py +0 -0
- {pydiverse_common-0.3.7 → pydiverse_common-0.3.8}/tests/test_version.py +0 -0
- {pydiverse_common-0.3.7 → pydiverse_common-0.3.8}/typos.toml +0 -0
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: pydiverse-common
|
3
|
-
Version: 0.3.
|
3
|
+
Version: 0.3.8
|
4
4
|
Summary: Common functionality shared between pydiverse libraries
|
5
5
|
Author: QuantCo, Inc.
|
6
6
|
Author-email: Martin Trautmann <windiana@users.sf.net>, Finn Rudolph <finn.rudolph@t-online.de>
|
@@ -73,24 +73,27 @@ def hash_polars_dataframe(df: pl.DataFrame, use_init_repr=False) -> str:
|
|
73
73
|
list_columns = [
|
74
74
|
col for col, dtype in df.schema.items() if dtype == pl.List
|
75
75
|
]
|
76
|
-
|
77
|
-
|
78
|
-
.with_columns(pl.col(array_columns).reshape([-1]).implode())
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
)
|
76
|
+
lf = df.lazy()
|
77
|
+
if array_columns:
|
78
|
+
lf = lf.with_columns(pl.col(array_columns).reshape([-1]).implode())
|
79
|
+
lf = lf.with_columns(
|
80
|
+
# Necessary because hash() does not work on lists of strings.
|
81
|
+
# This can be removed when
|
82
|
+
# https://github.com/pola-rs/polars/issues/21523 is resolved
|
83
|
+
# in all supported versions of polars.
|
84
|
+
pl.selectors.by_dtype(pl.List(pl.String)).list.eval(
|
85
|
+
pl.element().hash()
|
87
86
|
)
|
87
|
+
)
|
88
|
+
if list_columns or array_columns:
|
88
89
|
# Necessary because hash_rows() does not work on lists.
|
89
90
|
# This can be removed when
|
90
91
|
# https://github.com/pola-rs/polars/issues/24121 is resolved
|
91
92
|
# in all supported versions of polars.
|
92
|
-
.with_columns(pl.col(*list_columns, *array_columns).hash())
|
93
|
-
|
93
|
+
lf = lf.with_columns(pl.col(*list_columns, *array_columns).hash())
|
94
|
+
|
95
|
+
content_hash = str(
|
96
|
+
lf.collect()
|
94
97
|
.hash_rows() # We get a Series of hashes, one for each row
|
95
98
|
# Since polars only hashes rows, we need to implode the Series into
|
96
99
|
# a single row to get a single hash
|
@@ -142,6 +142,17 @@ def check_df_hashes(df1_a: pl.DataFrame, other_dfs: list[pl.DataFrame]) -> None:
|
|
142
142
|
) == hash_polars_dataframe(df1_other, use_init_repr=True)
|
143
143
|
|
144
144
|
|
145
|
+
@pytest.mark.skipif(pl.DataFrame is None, reason="requires polars")
|
146
|
+
def test_hashing_basic():
|
147
|
+
df1_a = pl.DataFrame(dict(x=[1]))
|
148
|
+
df1_b = pl.DataFrame(dict(y=[1]))
|
149
|
+
df1_c = pl.DataFrame(dict(x=[2]))
|
150
|
+
df1_d = pl.DataFrame(dict(x=[1.0]))
|
151
|
+
df1_e = pl.DataFrame(dict(x=[]))
|
152
|
+
|
153
|
+
check_df_hashes(df1_a, [df1_b, df1_c, df1_d, df1_e])
|
154
|
+
|
155
|
+
|
145
156
|
@pytest.mark.skipif(pl.DataFrame is None, reason="requires polars")
|
146
157
|
def test_hashing():
|
147
158
|
df1_a = pl.DataFrame(
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{pydiverse_common-0.3.7 → pydiverse_common-0.3.8}/src/pydiverse/common/util/computation_tracing.py
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|