From eeb1d227796eb90dfe533deb650ca2848a74c1e1 Mon Sep 17 00:00:00 2001 From: JSv4 Date: Sun, 28 Jul 2024 13:52:19 -0700 Subject: [PATCH 1/5] Upgrade Django apps not compatible with Django 4.2. --- config/wsgi.py | 1 + requirements/base.txt | 2 +- requirements/local.txt | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/config/wsgi.py b/config/wsgi.py index b3513c58..628fff28 100644 --- a/config/wsgi.py +++ b/config/wsgi.py @@ -33,6 +33,7 @@ # file. This includes Django's development server, if the WSGI_APPLICATION # setting points here. application = get_wsgi_application() + # Apply WSGI middleware here. # from helloworld.wsgi import HelloWorldApplication # application = HelloWorldApplication(application) diff --git a/requirements/base.txt b/requirements/base.txt index e388d36e..f1203433 100644 --- a/requirements/base.txt +++ b/requirements/base.txt @@ -24,7 +24,7 @@ crispy-bootstrap5==0.7 # https://github.com/django-crispy-forms/crispy-bootstra django-redis==5.2.0 # https://github.com/jazzband/django-redis django-filter==22.1 # https://github.com/carltongibson/django-filter django-storages[boto3]==1.13.1 # https://github.com/jschneier/django-storages -django-extensions==3.2.0 # https://github.com/django-extensions/django-extensions +django-extensions==3.2.3 # https://github.com/django-extensions/django-extensions whitenoise django-tree-queries pgvector # For vector embeddings diff --git a/requirements/local.txt b/requirements/local.txt index 75ee3b9c..804e992c 100644 --- a/requirements/local.txt +++ b/requirements/local.txt @@ -8,7 +8,7 @@ watchgod==0.8.2 # https://github.com/samuelcolvin/watchgod # Testing # ------------------------------------------------------------------------------ mypy==0.991 # https://github.com/python/mypy -django-stubs==1.13.0 # https://github.com/typeddjango/django-stubs +django-stubs==4.2.7 # https://github.com/typeddjango/django-stubs pytest==8.2.2 # https://github.com/pytest-dev/pytest pytest-cov==4.0.0 # https://github.com/pytest-dev/pytest-cov pytest-sugar==0.9.5 # https://github.com/Frozenball/pytest-sugar From b0666b2b719bf7a91a9c0aa0aa0aeff57da53dcc Mon Sep 17 00:00:00 2001 From: JSv4 Date: Sun, 28 Jul 2024 23:41:50 -0700 Subject: [PATCH 2/5] Solved all issues on OC side but vcr.py causing install trouble. --- compose/local/django/Dockerfile | 4 ++++ requirements/base.txt | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/compose/local/django/Dockerfile b/compose/local/django/Dockerfile index e6d04a3f..0e8c80fb 100644 --- a/compose/local/django/Dockerfile +++ b/compose/local/django/Dockerfile @@ -36,6 +36,8 @@ RUN apt-get update && apt-get install --no-install-recommends -y \ # Requirements are installed here to ensure they will be cached. COPY ./requirements . +RUN pip install --upgrade pip + # Create Python Dependency and Sub-Dependency Wheels. RUN pip wheel --wheel-dir /usr/src/app/wheels \ -r ${BUILD_ENVIRONMENT}.txt @@ -74,6 +76,8 @@ RUN apt-get update && apt-get install --no-install-recommends -y \ # copy python dependency wheels from python-build-stage COPY --from=python-build-stage /usr/src/app/wheels /wheels/ +RUN pip install --upgrade pip + # Install CPU-less requirements RUN pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cpu RUN pip install sentence-transformers diff --git a/requirements/base.txt b/requirements/base.txt index f1203433..229e721f 100644 --- a/requirements/base.txt +++ b/requirements/base.txt @@ -63,7 +63,7 @@ marvin==2.3.4 # Data Processing Tools # ------------------------------------------------------------------------------- -opencv-python==4.7.0.68 # https://github.com/opencv/opencv-python +opencv-python==4.10.0.84 # https://github.com/opencv/opencv-python filetype==1.2.0 # https://github.com/h2non/filetype.py # Permissioning From 942447dc7b980a9ef4838a03f681f960476769ff Mon Sep 17 00:00:00 2001 From: JSv4 Date: Sun, 28 Jul 2024 23:48:47 -0700 Subject: [PATCH 3/5] Downgrade vcr.py --- requirements/local.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements/local.txt b/requirements/local.txt index 804e992c..84dac9e6 100644 --- a/requirements/local.txt +++ b/requirements/local.txt @@ -14,7 +14,7 @@ pytest-cov==4.0.0 # https://github.com/pytest-dev/pytest-cov pytest-sugar==0.9.5 # https://github.com/Frozenball/pytest-sugar djangorestframework-stubs==1.8.0 # https://github.com/typeddjango/djangorestframework-stubs responses==0.22.0 # https://github.com/getsentry/responses -vcrpy==6.0.1 # https://vcrpy.readthedocs.io/en/latest/ +vcrpy==5.1.0 # https://vcrpy.readthedocs.io/en/latest/ # Profiling # ------------------------------------------------------------------------------ From 0f15091985b7c9135de363d09160c4be813c4d4b Mon Sep 17 00:00:00 2001 From: JSv4 Date: Mon, 29 Jul 2024 17:06:38 -0700 Subject: [PATCH 4/5] Install VCR.py commit that fixes setuptools error. --- opencontractserver/tests/test_corpus_query.py | 2 +- opencontractserver/tests/test_extract_tasks.py | 2 +- requirements/local.txt | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/opencontractserver/tests/test_corpus_query.py b/opencontractserver/tests/test_corpus_query.py index 71040c91..b2776eda 100644 --- a/opencontractserver/tests/test_corpus_query.py +++ b/opencontractserver/tests/test_corpus_query.py @@ -66,7 +66,7 @@ def setUp(self): ) @override_settings(CELERY_TASK_ALWAYS_EAGER=True) - @vcr.use_cassette("fixtures/vcr_cassettes/run_query.yaml") + @vcr.use_cassette("fixtures/vcr_cassettes/run_query.yaml", filter_headers=['authorization']) def test_run_query(self): print(self.query) diff --git a/opencontractserver/tests/test_extract_tasks.py b/opencontractserver/tests/test_extract_tasks.py index 7ecfe698..75c7a95a 100644 --- a/opencontractserver/tests/test_extract_tasks.py +++ b/opencontractserver/tests/test_extract_tasks.py @@ -140,7 +140,7 @@ def setUp(self): self.extract.save() @override_settings(CELERY_TASK_ALWAYS_EAGER=True) - @vcr.use_cassette("fixtures/vcr_cassettes/test_run_extract_task.yaml") + @vcr.use_cassette("fixtures/vcr_cassettes/test_run_extract_task.yaml", filter_headers=['authorization']) def test_run_extract_task(self): print(f"{self.extract.documents.all()}") diff --git a/requirements/local.txt b/requirements/local.txt index 84dac9e6..fd58a307 100644 --- a/requirements/local.txt +++ b/requirements/local.txt @@ -14,7 +14,7 @@ pytest-cov==4.0.0 # https://github.com/pytest-dev/pytest-cov pytest-sugar==0.9.5 # https://github.com/Frozenball/pytest-sugar djangorestframework-stubs==1.8.0 # https://github.com/typeddjango/djangorestframework-stubs responses==0.22.0 # https://github.com/getsentry/responses -vcrpy==5.1.0 # https://vcrpy.readthedocs.io/en/latest/ +git+https://github.com/kevin1024/vcrpy.git@35650b141b5689eed84eac05c23b48412c76dd52 # VCR.py 6.0.* has deprecated setuptools which broke recently. # Profiling # ------------------------------------------------------------------------------ From 01ce5ef2fe6639d8d4f378c3044148f45b9a5dff Mon Sep 17 00:00:00 2001 From: JSv4 Date: Mon, 29 Jul 2024 18:30:02 -0700 Subject: [PATCH 5/5] Ran linter. --- opencontractserver/tests/test_corpus_query.py | 4 +++- opencontractserver/tests/test_extract_tasks.py | 5 ++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/opencontractserver/tests/test_corpus_query.py b/opencontractserver/tests/test_corpus_query.py index b2776eda..7dfa6a07 100644 --- a/opencontractserver/tests/test_corpus_query.py +++ b/opencontractserver/tests/test_corpus_query.py @@ -66,7 +66,9 @@ def setUp(self): ) @override_settings(CELERY_TASK_ALWAYS_EAGER=True) - @vcr.use_cassette("fixtures/vcr_cassettes/run_query.yaml", filter_headers=['authorization']) + @vcr.use_cassette( + "fixtures/vcr_cassettes/run_query.yaml", filter_headers=["authorization"] + ) def test_run_query(self): print(self.query) diff --git a/opencontractserver/tests/test_extract_tasks.py b/opencontractserver/tests/test_extract_tasks.py index 75c7a95a..60df0b8b 100644 --- a/opencontractserver/tests/test_extract_tasks.py +++ b/opencontractserver/tests/test_extract_tasks.py @@ -140,7 +140,10 @@ def setUp(self): self.extract.save() @override_settings(CELERY_TASK_ALWAYS_EAGER=True) - @vcr.use_cassette("fixtures/vcr_cassettes/test_run_extract_task.yaml", filter_headers=['authorization']) + @vcr.use_cassette( + "fixtures/vcr_cassettes/test_run_extract_task.yaml", + filter_headers=["authorization"], + ) def test_run_extract_task(self): print(f"{self.extract.documents.all()}")