Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@
# Minimum 21.0.0 to support `use_content_defined_chunking` in ParquetWriter
"pyarrow>=21.0.0",
# For smart caching dataset processing
"dill>=0.3.0,<0.3.9", # tmp pin until dill has official support for determinism see https://github.com/uqfoundation/dill/issues/19
"dill>=0.3.0,<0.3.10", # tmp pin until dill has official support for determinism see https://github.com/uqfoundation/dill/issues/19
# For performance gains with apache arrow
"pandas",
# for downloading datasets over HTTPS
Expand Down
22 changes: 12 additions & 10 deletions src/datasets/utils/_dill.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,16 @@ def proxy(func):
return proxy


def _is_supported_dill_version():
"""Check if the current dill version is in the supported range."""
return config.DILL_VERSION.release[:3] in [
version.parse("0.3.6").release,
version.parse("0.3.7").release,
version.parse("0.3.8").release,
version.parse("0.3.9").release,
]


def dump(obj, file):
"""Pickle an object to a file."""
Pickler(file, recurse=True).dump(obj)
Expand All @@ -115,11 +125,7 @@ def dumps(obj):
def log(pickler, msg):
dill._dill.log.info(msg)

elif config.DILL_VERSION.release[:3] in [
version.parse("0.3.6").release,
version.parse("0.3.7").release,
version.parse("0.3.8").release,
]:
elif _is_supported_dill_version():

def log(pickler, msg):
dill._dill.logger.trace(pickler, msg)
Expand Down Expand Up @@ -312,11 +318,7 @@ def _save_code(pickler, obj):
dill._dill.log.info("# Co")
return

elif config.DILL_VERSION.release[:3] in [
version.parse("0.3.6").release,
version.parse("0.3.7").release,
version.parse("0.3.8").release,
]:
elif _is_supported_dill_version():
# From: https://github.com/uqfoundation/dill/blob/dill-0.3.6/dill/_dill.py#L1104
@pklregister(CodeType)
def save_code(pickler, obj):
Expand Down
Loading