Skip to content

Commit

Permalink
RELEASE 1.4.2 - bugfix release (#1579)
Browse files Browse the repository at this point in the history
  • Loading branch information
tomMoral committed May 2, 2024
1 parent 1787fb7 commit d46857a
Show file tree
Hide file tree
Showing 4 changed files with 42 additions and 7 deletions.
7 changes: 3 additions & 4 deletions CHANGES.rst
@@ -1,12 +1,11 @@
Latest changes
==============

In development
--------------
Release 1.4.2 -- 2024/05/02
---------------------------

Due to maintenance issues, 1.4.1 was not valid and we bumped the version to 1.4.2

Release 1.4.1 -- 2024/05/02
---------------------------

- Fix a backward incompatible change in ``MemorizedFunc.call`` which needs to
return the metadata. Also make sure that ``NotMemorizedFunc.call`` return
Expand Down
2 changes: 1 addition & 1 deletion joblib/__init__.py
Expand Up @@ -106,7 +106,7 @@
# Dev branch marker is: 'X.Y.dev' or 'X.Y.devN' where N is an integer.
# 'X.Y.dev0' is the canonical version of 'X.Y.dev'
#
__version__ = '1.5.dev0'
__version__ = '1.4.2'


import os
Expand Down
30 changes: 28 additions & 2 deletions joblib/memory.py
Expand Up @@ -933,6 +933,20 @@ class Memory(Logger):
Verbosity flag, controls the debug messages that are issued
as functions are evaluated.
bytes_limit: int | str, optional
Limit in bytes of the size of the cache. By default, the size of
the cache is unlimited. When reducing the size of the cache,
``joblib`` keeps the most recently accessed items first. If a
str is passed, it is converted to a number of bytes using units
{ K | M | G} for kilo, mega, giga.
**Note:** You need to call :meth:`joblib.Memory.reduce_size` to
actually reduce the cache size to be less than ``bytes_limit``.
**Note:** This argument has been deprecated. One should give the
value of ``bytes_limit`` directly in
:meth:`joblib.Memory.reduce_size`.
backend_options: dict, optional
Contains a dictionary of named parameters used to configure
the store backend.
Expand All @@ -941,12 +955,21 @@ class Memory(Logger):
# Public interface
# ------------------------------------------------------------------------

def __init__(self, location=None, backend='local', mmap_mode=None,
compress=False, verbose=1, backend_options=None):
def __init__(self, location=None, backend='local',
mmap_mode=None, compress=False, verbose=1, bytes_limit=None,
backend_options=None):
Logger.__init__(self)
self._verbose = verbose
self.mmap_mode = mmap_mode
self.timestamp = time.time()
if bytes_limit is not None:
warnings.warn(
"bytes_limit argument has been deprecated. It will be removed "
"in version 1.5. Please pass its value directly to "
"Memory.reduce_size.",
category=DeprecationWarning
)
self.bytes_limit = bytes_limit
self.backend = backend
self.compress = compress
if backend_options is None:
Expand Down Expand Up @@ -1076,6 +1099,9 @@ def reduce_size(self, bytes_limit=None, items_limit=None, age_limit=None):
of the cache, any items last accessed more than the given length of
time ago are deleted.
"""
if bytes_limit is None:
bytes_limit = self.bytes_limit

if self.store_backend is None:
# No cached results, this function does nothing.
return
Expand Down
10 changes: 10 additions & 0 deletions joblib/test/test_memory.py
Expand Up @@ -1399,6 +1399,16 @@ def f(x):
caplog.clear()


def test_deprecated_bytes_limit(tmpdir):
from joblib import __version__
if __version__ >= "1.5":
raise DeprecationWarning(
"Bytes limit is deprecated and should be removed by 1.4"
)
with pytest.warns(DeprecationWarning, match="bytes_limit"):
_ = Memory(location=tmpdir.strpath, bytes_limit='1K')


class TestCacheValidationCallback:
"Tests on parameter `cache_validation_callback`"

Expand Down

0 comments on commit d46857a

Please sign in to comment.