From bd7355a693bf67c722d97bac91df3bd1dc08808e Mon Sep 17 00:00:00 2001 From: ruthenian8 Date: Mon, 4 Dec 2023 09:22:40 +0000 Subject: [PATCH] require requests for extended conditions; update requirements in tutorials --- .../conditions/models/remote_api/rasa_model.py | 3 +-- setup.py | 16 ++++++++-------- tests/tutorials/test_tutorials.py | 3 +++ .../script/extras/conditions/2_gensim_example.py | 2 +- .../script/extras/conditions/3_hf_example.py | 2 +- 5 files changed, 14 insertions(+), 12 deletions(-) diff --git a/dff/script/extras/conditions/models/remote_api/rasa_model.py b/dff/script/extras/conditions/models/remote_api/rasa_model.py index 50c648ad5..6a38e95e9 100644 --- a/dff/script/extras/conditions/models/remote_api/rasa_model.py +++ b/dff/script/extras/conditions/models/remote_api/rasa_model.py @@ -11,10 +11,9 @@ from urllib.parse import urljoin from typing import Optional -import requests - try: import httpx + import requests rasa_available = True except ImportError: diff --git a/setup.py b/setup.py index fc3bbbbd1..d569bd8d4 100644 --- a/setup.py +++ b/setup.py @@ -32,6 +32,10 @@ def merge_req_lists(*req_lists: List[str]) -> List[str]: "typing-extensions", ] +requests_dependencies = [ + "requests==2.31.0", +] + async_files_dependencies = [ "aiofiles", ] @@ -77,7 +81,7 @@ def merge_req_lists(*req_lists: List[str]) -> List[str]: sklearn_dependencies = ["scikit-learn>=1.1.3", "joblib==1.2.0"] -extended_conditions_dependencies = merge_req_lists(sklearn_dependencies, ["pyyaml==6.0"]) +extended_conditions_dependencies = merge_req_lists(requests_dependencies, sklearn_dependencies, ["pyyaml==6.0"]) httpx_dependencies = [ "httpx==0.23.0", @@ -122,8 +126,8 @@ def merge_req_lists(*req_lists: List[str]) -> List[str]: stats_dependencies = merge_req_lists( otl_dependencies, + requests_dependencies, [ - "requests", "wrapt", "tqdm", "omegaconf", @@ -149,10 +153,6 @@ def merge_req_lists(*req_lists: List[str]) -> List[str]: dialogflow_dependencies, ) -requests_requirements = [ - "requests==2.31.0", -] - test_requirements = merge_req_lists( [ "pytest==7.4.0", @@ -168,7 +168,7 @@ def merge_req_lists(*req_lists: List[str]) -> List[str]: "httpx<=0.23.0", "sqlparse==0.4.4", ], - requests_requirements, + requests_dependencies, ) tutorial_dependencies = [ @@ -204,7 +204,7 @@ def merge_req_lists(*req_lists: List[str]) -> List[str]: "jupytext==1.15.0", "jupyter==1.0.0", ], - requests_requirements, + requests_dependencies, ) devel = [ diff --git a/tests/tutorials/test_tutorials.py b/tests/tutorials/test_tutorials.py index bdd8a1e8c..1ef53a772 100644 --- a/tests/tutorials/test_tutorials.py +++ b/tests/tutorials/test_tutorials.py @@ -40,6 +40,9 @@ def check_tutorial_dependencies(venv: "VirtualEnv", tutorial_source_code: str): @pytest.mark.parametrize("dff_tutorial_py_file", DFF_TUTORIAL_PY_FILES) @pytest.mark.slow @pytest.mark.docker +@pytest.mark.rasa +@pytest.mark.dialogflow +@pytest.mark.huggingface @pytest.mark.no_coverage def test_tutorials(dff_tutorial_py_file, virtualenv): with open(dff_tutorial_py_file, "r", encoding="utf-8") as fd: diff --git a/tutorials/script/extras/conditions/2_gensim_example.py b/tutorials/script/extras/conditions/2_gensim_example.py index 93d1e5da2..3626ff3bb 100644 --- a/tutorials/script/extras/conditions/2_gensim_example.py +++ b/tutorials/script/extras/conditions/2_gensim_example.py @@ -6,7 +6,7 @@ for annotating user phrases. """ -# %pip install dff[gensim] +# %pip install dff[ext,gensim] # %% import os diff --git a/tutorials/script/extras/conditions/3_hf_example.py b/tutorials/script/extras/conditions/3_hf_example.py index b8e26d968..b207b39c5 100644 --- a/tutorials/script/extras/conditions/3_hf_example.py +++ b/tutorials/script/extras/conditions/3_hf_example.py @@ -6,7 +6,7 @@ for annotating user phrases. """ -# %pip install dff[huggingface] +# %pip install dff[ext,huggingface] # %% from transformers import AutoTokenizer, AutoModelForSequenceClassification