From f90b170e6877d731763f7cc080e1fb1083c08c7e Mon Sep 17 00:00:00 2001 From: dgtlmoon Date: Thu, 27 Oct 2022 23:26:14 +0200 Subject: [PATCH] Docker & python - Jq conditional pip requirements.txt include (Don't install in Windows because theres no Windows library/wheel) --- Dockerfile | 3 --- README.md | 3 --- changedetectionio/run_all_tests.sh | 8 -------- requirements.txt | 3 +++ 4 files changed, 3 insertions(+), 14 deletions(-) diff --git a/Dockerfile b/Dockerfile index 373334f4..d16736fa 100644 --- a/Dockerfile +++ b/Dockerfile @@ -21,9 +21,6 @@ COPY requirements.txt /requirements.txt RUN pip install --target=/dependencies -r /requirements.txt -RUN pip install --target=/dependencies jq~=1.3 \ - || echo "WARN: Failed to install JQ. The application can still run, but the Jq: filter option will be disabled." - # Final image stage FROM python:3.8-slim diff --git a/README.md b/README.md index 9ab279bf..80925b62 100644 --- a/README.md +++ b/README.md @@ -167,9 +167,6 @@ One big advantage of `jq` is that you can use logic in your JSON filter, such as See the wiki https://github.com/dgtlmoon/changedetection.io/wiki/JSON-Selector-Filter-help for more information and examples -Note: `jq` library must be added separately (`pip3 install jq`) - - ### Parse JSON embedded in HTML! When you enable a `json:` or `jq:` filter, you can even automatically extract and parse embedded JSON inside a HTML page! Amazingly handy for sites that build content based on JSON, such as many e-commerce websites. diff --git a/changedetectionio/run_all_tests.sh b/changedetectionio/run_all_tests.sh index 79886c00..2783c9b8 100755 --- a/changedetectionio/run_all_tests.sh +++ b/changedetectionio/run_all_tests.sh @@ -24,14 +24,6 @@ echo "RUNNING WITH BASE_URL SET" export BASE_URL="https://really-unique-domain.io" pytest tests/test_notification.py - -## JQ + JSON: filter test -# jq is not available on windows and we should just test it when the package is installed -# this will re-test with jq support -pip3 install jq~=1.3 -pytest tests/test_jsonpath_jq_selector.py - - # Now for the selenium and playwright/browserless fetchers # Note - this is not UI functional tests - just checking that each one can fetch the content diff --git a/requirements.txt b/requirements.txt index 6362f9e1..48398276 100644 --- a/requirements.txt +++ b/requirements.txt @@ -50,6 +50,9 @@ werkzeug~=2.0.0 jinja2~=3.1 jinja2-time +# https://peps.python.org/pep-0508/#environment-markers +# https://github.com/dgtlmoon/changedetection.io/pull/1009 +jq ~= 1.3 ;python_version >= "3.8" and sys_platform == "linux" playwright~=1.26; python_version >= "3.8" and "arm" not in platform_machine and "aarch" not in platform_machine