Old usage is still accepted but causes a deprecation warning, saying
we will remove it in v0.21. Similar to #2300. I am planning to add
an option to do wasm compilation in a subsequent PR.

I also did some cleanup from #2300 and added tests for the deprecation 
warnings.
Change extract_dir argument of unpackArchive to be a keyword argument. Old usage is still accepted but causes a deprecation warning, saying
we will remove it in v0.21. Similar to #2300. I am planning to add
an option to do wasm compilation in a subsequent PR.

I also did some cleanup from #2300 and added tests for the deprecation 
warnings.
def test_joblib_numpy_pickle(selenium, request):
    selenium.load_package(["numpy", "joblib"])
    selenium.run(
        """
       import joblib
       import numpy as np
       from numpy.testing import assert_array_equal

       X = np.ones(10)

       file_path = "./X.pkl"

       joblib.dump(X, file_path)

       X2 = joblib.load(file_path)

       assert_array_equal(X, X2)"""
    )


def test_joblib_parallel(selenium):
    selenium.load_package(["numpy", "joblib"])
    selenium.clean_logs()
    selenium.run(
        """
       from math import sqrt
       from joblib import Parallel, delayed

       # check that the default multiprocessing backend
       # gracefully reduces to n_jobs=1
       res = Parallel(n_jobs=2)(delayed(sqrt)(i ** 2)
                                for i in range(10))
       assert res == [sqrt(i ** 2) for i in range(10)]

       # check threading backend
       Parallel(n_jobs=2, backend='threading')(
            delayed(sqrt)(i ** 2) for i in range(10))
       """
    )

def test_joblib_numpy_pickle(selenium, request):
    selenium.load_package(["numpy", "joblib"])
    selenium.run(
        """
       import joblib
       import numpy as np
       from numpy.testing import assert_array_equal

       X = np.ones(10)

       file_path = "./X.pkl"

       joblib.dump(X, file_path)

       X2 = joblib.load(file_path)

       assert_array_equal(X, X2)"""
    )


def test_joblib_parallel(selenium):
    selenium.load_package(["numpy", "joblib"])
    selenium.clean_logs()
    selenium.run(
        """
       from math import sqrt
       from joblib import Parallel, delayed

       # check that the default multiprocessing backend
       # gracefully reduces to n_jobs=1
       res = Parallel(n_jobs=2)(delayed(sqrt)(i ** 2)
                                for i in range(10))
       assert res == [sqrt(i ** 2) for i in range(10)]

       # check threading backend
       Parallel(n_jobs=2, backend='threading')(
            delayed(sqrt)(i ** 2) for i in range(10))
       """
    )
