From b70aafffee0ced0dfd076ec6ae0f2dbcb389b515 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adri=C3=A1n=20Chaves?= Date: Mon, 22 Jan 2024 12:26:40 +0100 Subject: [PATCH 1/5] Try to reproduce the issue on CI --- .github/workflows/tests.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 2125a3af..9e2d3e5e 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -55,6 +55,10 @@ jobs: - name: Run tests run: tox -e ${{ matrix.tox-env }} + - name: Run off-tox tests + # https://github.com/scrapinghub/shub/issues/441 + run: python -c "from shub.exceptions import ShubException; from shub.image.utils import get_docker_client; get_docker_client(validate=False)" + - name: Upload coverage report run: | curl -Os https://uploader.codecov.io/latest/linux/codecov From bf6ea0b4a070afa92800a15e8cfd270be2f266a3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adri=C3=A1n=20Chaves?= Date: Mon, 22 Jan 2024 12:35:04 +0100 Subject: [PATCH 2/5] Setup the venv --- .github/workflows/tests.yml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 9e2d3e5e..16707e13 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -57,7 +57,11 @@ jobs: - name: Run off-tox tests # https://github.com/scrapinghub/shub/issues/441 - run: python -c "from shub.exceptions import ShubException; from shub.image.utils import get_docker_client; get_docker_client(validate=False)" + run: | + python -m venv venv + . venv/bin/activate + pip install . + python -c "from shub.exceptions import ShubException; from shub.image.utils import get_docker_client; get_docker_client(validate=False)" - name: Upload coverage report run: | From 70813a95cf56ea6189deb9299bcc8fb96fe94fea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adri=C3=A1n=20Chaves?= Date: Mon, 22 Jan 2024 12:38:00 +0100 Subject: [PATCH 3/5] Extend importlib_metadata usage to Python 3.8 and 3.9 --- setup.py | 2 +- shub/image/utils.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/setup.py b/setup.py index 7ba295f7..9b87de72 100644 --- a/setup.py +++ b/setup.py @@ -29,7 +29,7 @@ install_requires=[ 'click', 'docker', - 'importlib-metadata; python_version < "3.8"', + 'importlib-metadata; python_version < "3.10"', 'packaging', 'pip', 'PyYAML', diff --git a/shub/image/utils.py b/shub/image/utils.py index 737a07d2..50914ba3 100644 --- a/shub/image/utils.py +++ b/shub/image/utils.py @@ -16,7 +16,7 @@ ShubDeprecationWarning, print_warning, BadParameterException, ) -if sys.version_info < (3, 8): +if sys.version_info < (3, 10): import importlib_metadata as metadata else: from importlib import metadata From f2c7a782fe1fec4a29a51f1348aa3e7c59d99653 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adri=C3=A1n=20Chaves?= Date: Mon, 22 Jan 2024 12:39:39 +0100 Subject: [PATCH 4/5] Add setuptools to dependencies --- setup.py | 1 + 1 file changed, 1 insertion(+) diff --git a/setup.py b/setup.py index 9b87de72..d81c8abf 100644 --- a/setup.py +++ b/setup.py @@ -36,6 +36,7 @@ 'retrying', 'requests', 'scrapinghub>=2.3.1', + 'setuptools', 'tqdm==4.55.1', 'toml', ], From fb8aff1de8d9dbf96bd800712ead0c4a7feedb04 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adri=C3=A1n=20Chaves?= Date: Mon, 22 Jan 2024 14:34:04 +0100 Subject: [PATCH 5/5] Removed an unused import --- .github/workflows/tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 16707e13..c0489417 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -61,7 +61,7 @@ jobs: python -m venv venv . venv/bin/activate pip install . - python -c "from shub.exceptions import ShubException; from shub.image.utils import get_docker_client; get_docker_client(validate=False)" + python -c "from shub.image.utils import get_docker_client; get_docker_client(validate=False)" - name: Upload coverage report run: |