Skip to content

Commit 3041025

Browse files
authored
chore: fix and revert poetry lock to its stable state (#1133)
1 parent 68d92a4 commit 3041025

File tree

6 files changed

+1611
-1927
lines changed

6 files changed

+1611
-1927
lines changed

.github/workflows/latest-deps-tests.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ name: Test with Latest Dependencies
33
on:
44
schedule:
55
- cron: "0 22 * * *" # 10:00 PM UTC, daily
6+
7+
workflow_dispatch:
68
jobs:
79
latest-deps-tests-matrix:
810
strategy:

.github/workflows/test-and-build-wheel.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ jobs:
8585
runs-on: ubuntu-latest
8686
strategy:
8787
matrix:
88-
python-version: ["3.9", "3.10", "3.11", "3.12"]
88+
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"]
8989
steps:
9090
- name: Set up Python
9191
uses: actions/setup-python@v5

poetry.lock

Lines changed: 1555 additions & 1891 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyproject.toml

Lines changed: 13 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -50,20 +50,8 @@ python = ">=3.9,!=3.9.7,<3.14"
5050
aiohttp = ">=3.10.11"
5151
annoy = ">=1.17.3"
5252
fastapi = ">=0.103.0,"
53-
fastembed = [
54-
{ version = ">=0.2.2, <0.5", python = ">=3.9,<3.10" },
55-
{ version = ">=0.5.0, <=0.6.0", python = ">=3.10, <3.14" },
56-
]
57-
onnxruntime = [
58-
{ version = ">=1.17.0, <=1.19.2", python = ">=3.9, <3.10" },
59-
{ version = ">=1.20.0", python = ">=3.10, <3.14" },
60-
]
61-
53+
fastembed = [{ version = ">=0.2.2, <=0.6.0", python = ">=3.9,<3.14" }]
6254
httpx = ">=0.24.1"
63-
# onnxruntime in 1.20 has dropped python 3.9 support
64-
# fastembed has also dropped python 3.9 support entirely as of 0.5.0
65-
# fastembed depends on onnxruntime we pindown the working version for 3.9 here
66-
# as it is a transient dependency we must remove it later
6755
jinja2 = ">=3.1.6"
6856
langchain = ">=0.2.14,<0.4.0"
6957
langchain-core = ">=0.2.14,<0.4.0"
@@ -90,20 +78,19 @@ langchain-openai = { version = ">=0.0.5", optional = true }
9078

9179
# eval
9280
tqdm = { version = ">=4.65,<5.0", optional = true }
93-
numpy = [
94-
{ version = ">=1.21,<1.24", python = ">=3.9,<3.10" },
95-
{ version = ">=1.24,<2.2.0", python = ">=3.10,<3.14" },
96-
]
9781
streamlit = { version = "^1.37.0", optional = true, python = ">=3.9,!=3.9.7,<3.12" }
9882
pandas = { version = ">=1.4.0,<3", optional = true }
99-
100-
spacy = [
101-
{ version = ">=3.7.2,<3.8.0", optional = true, python = ">=3.9,<3.13" },
102-
# { version = "==3.7.2", optional = true, python = ">=3.13,<3.14" },
103-
] # Capping spacy to spacy<3.8.0 see https://github.com/explosion/cython-blis/issues/117# poetry 3.8.4 does not exist for python 3.9
104-
# No spacy support for python 3.13 (https://github.com/explosion/spaCy/issues/13658)
105-
presidio-analyzer = { version = ">=2.2", optional = true } # sdd
106-
presidio-anonymizer = { version = ">=2.2", optional = true }
83+
numpy = [
84+
{ version = ">=1.21", python = ">=3.10,<3.12" },
85+
{ version = ">=1.26", python = ">=3.12,<3.13" },
86+
{ version = ">=2.1.0", python = ">=3.13" },
87+
{ version = ">=1.21,<2.1.0", python = "<3.10" },
88+
]
89+
# sdd
90+
# we don't need it and we comment it for sake of documentation
91+
# spacy = { version = ">=3.4.4,<4.0.0,!=3.7.0", python = "<3.13", optional = true }
92+
presidio-analyzer = { version = ">=2.2", optional = true, python = "<3.13" }
93+
presidio-anonymizer = { version = ">=2.2", optional = true, python = "<3.13" }
10794

10895
# nim
10996
langchain-nvidia-ai-endpoints = { version = ">= 0.2.0", optional = true }
@@ -115,7 +102,7 @@ google-cloud-language = { version = ">=2.14.0", optional = true }
115102
yara-python = { version = "^4.5.1", optional = true }
116103

117104
[tool.poetry.extras]
118-
sdd = ["presidio-analyzer", "presidio-anonymizer", "spacy"]
105+
sdd = ["presidio-analyzer", "presidio-anonymizer"]
119106
eval = ["tqdm", "numpy", "streamlit"]
120107
openai = ["langchain-openai"]
121108
gcp = ["google-cloud-language"]
@@ -128,7 +115,6 @@ jailbreak = ["yara-python"]
128115
all = [
129116
"presidio-analyzer",
130117
"presidio-anonymizer",
131-
"spacy",
132118
"tqdm",
133119
"numpy",
134120
"streamlit",

tests/test_embeddings_only_user_messages.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ def colang_1_config():
4242
dialog:
4343
user_messages:
4444
embeddings_only: True
45-
embeddings_only_similarity_threshold: 0.99
45+
embeddings_only_similarity_threshold: 0.8
4646
embeddings_only_fallback_intent: "express greeting"
4747
""",
4848
)
@@ -76,7 +76,7 @@ def colang_2_config():
7676
dialog:
7777
user_messages:
7878
embeddings_only: True
79-
embeddings_only_similarity_threshold: 0.99
79+
embeddings_only_similarity_threshold: 0.8
8080
embeddings_only_fallback_intent: "user expressed greeting"
8181
""",
8282
)

tests/test_sensitive_data_detection.py

Lines changed: 38 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,28 +13,60 @@
1313
# See the License for the specific language governing permissions and
1414
# limitations under the License.
1515

16+
# We detect if the environment is set up correct for SDD (presidio + downloaded spacy model)
17+
# poetry install -e "sdd" --with dev
18+
# python -m spacy download en_core_web_lg
19+
20+
import subprocess
21+
1622
import pytest
1723

1824
from nemoguardrails import RailsConfig
1925
from nemoguardrails.actions import action
2026
from nemoguardrails.actions.actions import ActionResult
2127
from tests.utils import TestChat
2228

23-
# We detect if the environment is set up correct for SDD (presidio + downloaded spacy model)
24-
# poetry install -e "sdd" --with dev
25-
# python -m spacy download en_core_web_lg
2629
try:
2730
import presidio_analyzer
2831
import presidio_anonymizer
2932
import spacy
3033

31-
assert spacy.util.is_package("en_core_web_lg")
32-
3334
SDD_SETUP_PRESENT = True
34-
except (ImportError, AssertionError):
35+
except ImportError:
3536
SDD_SETUP_PRESENT = False
3637

3738

39+
def setup_module(module):
40+
if not SDD_SETUP_PRESENT:
41+
pytest.skip("Required dependencies not found")
42+
43+
try:
44+
# check if the model is already downloaded
45+
if not spacy.util.is_package("en_core_web_lg"):
46+
subprocess.run(
47+
["python", "-m", "spacy", "download", "en_core_web_lg"],
48+
check=True,
49+
capture_output=True,
50+
text=True,
51+
)
52+
53+
# ensure the model is now available
54+
55+
if not spacy.util.is_package("en_core_web_lg"):
56+
pytest.skip("Failed to download or verify spaCy model 'en_core_web_lg'")
57+
58+
except subprocess.CalledProcessError as e:
59+
pytest.skip(f"Error downloading spaCy model: {e.stderr}")
60+
except Exception as e:
61+
pytest.skip(f"Unexpected error during setup: {str(e)}")
62+
63+
64+
def teardown_module(module):
65+
"""No cleanup needed as the spaCy model is a persistent dependency
66+
that should remain available for future test runs."""
67+
pass
68+
69+
3870
@pytest.mark.skipif(
3971
not SDD_SETUP_PRESENT, reason="Sensitive Data Detection setup is not present."
4072
)

0 commit comments

Comments
 (0)