diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 1fc0cfd..38badc1 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -13,7 +13,7 @@ jobs: max-parallel: 3 matrix: platform: [ubuntu-latest] - python-version: [3.7, 3.8, 3.9, 3.10] + python-version: ["3.7", "3.8", "3.9", "3.10"] steps: - uses: actions/checkout@v2 diff --git a/README.md b/README.md index fbc51a4..b922c3d 100644 --- a/README.md +++ b/README.md @@ -56,6 +56,8 @@ python setup.py install ``` +# evaluation needs extra texmex package +pip install pqkmeans[texmex] # with artificial data python bin/run_experiment.py --dataset artificial --algorithm bkmeans pqkmeans --k 100 # with texmex dataset (http://corpus-texmex.irisa.fr/) diff --git a/pqkmeans/evaluation.py b/pqkmeans/evaluation.py index c3b84f6..1c573e9 100644 --- a/pqkmeans/evaluation.py +++ b/pqkmeans/evaluation.py @@ -3,10 +3,6 @@ import os import six.moves.urllib import tarfile -try: - import texmex_python -except ImportError: - pass def get_gmm_random_dataset(k, dimension=100, test_size=5000, train_size=500): @@ -42,6 +38,10 @@ def get_sift1m_dataset(cache_directory="."): def get_texmex_dataset(url, filename, member_names, cache_directory="."): + try: + import texmex_python + except ImportError: + raise ImportError("Missing optional dependency 'texmex_python'. You must install it to use this dataset.") path = os.path.join(cache_directory, filename) if not os.path.exists(path): print("downloading {}".format(url)) diff --git a/setup.py b/setup.py index 953ed25..97b7ca4 100644 --- a/setup.py +++ b/setup.py @@ -92,4 +92,7 @@ def build_extension(self, ext): cmdclass=dict(build_ext=CMakeBuild), test_suite='test', zip_safe=False, + extras_require={ + "texmex": ["texmex-python>=1.0.0"], + }, )