diff --git a/poetry.lock b/poetry.lock index d7b0c8774..063a813b5 100644 --- a/poetry.lock +++ b/poetry.lock @@ -1,4 +1,4 @@ -# This file is automatically @generated by Poetry 2.1.4 and should not be changed by hand. +# This file is automatically @generated by Poetry 2.1.2 and should not be changed by hand. [[package]] name = "aiodns" @@ -6346,6 +6346,23 @@ cryptography = "<44.1" [package.extras] server = ["flask (>=1.1)", "gunicorn"] +[[package]] +name = "presidio-structured" +version = "0.0.4a0" +description = "Presidio structured package - analyzes and anonymizes structured and semi-structured data." +optional = true +python-versions = "<4.0,>=3.9" +groups = ["main"] +markers = "python_version < \"3.11\" and extra == \"pii-detection\"" +files = [ + {file = "presidio_structured-0.0.4a0-py3-none-any.whl", hash = "sha256:7cc63b48038a177684cb9512d481571814c04331a0f4ddeb09299cc76803258b"}, +] + +[package.dependencies] +pandas = ">=1.5.2" +presidio-analyzer = ">=2.2" +presidio-anonymizer = ">=2.2" + [[package]] name = "presidio-structured" version = "0.0.6" @@ -6353,7 +6370,7 @@ description = "Presidio structured package - analyzes and anonymizes structured optional = true python-versions = "<4.0,>=3.9" groups = ["main"] -markers = "extra == \"pii-detection\"" +markers = "python_version >= \"3.11\" and extra == \"pii-detection\"" files = [ {file = "presidio_structured-0.0.6-py3-none-any.whl", hash = "sha256:f3454c86857a00db9828e684895da43411bcc7d750cac0a52e15d68f6c6455a1"}, ] @@ -6362,7 +6379,6 @@ files = [ pandas = ">=1.5.2" presidio-analyzer = ">=2.2" presidio-anonymizer = ">=2.2" -spacy = {version = "<3.8.4", markers = "python_version < \"3.10\""} [[package]] name = "prometheus-client" @@ -8436,9 +8452,10 @@ testpaths = ["test"] name = "sentry-sdk" version = "1.45.1" description = "Python client for Sentry (https://sentry.io)" -optional = false +optional = true python-versions = "*" groups = ["main"] +markers = "extra == \"llm\"" files = [ {file = "sentry_sdk-1.45.1-py2.py3-none-any.whl", hash = "sha256:608887855ccfe39032bfd03936e3a1c4f4fc99b3a4ac49ced54a4220de61c9c1"}, {file = "sentry_sdk-1.45.1.tar.gz", hash = "sha256:a16c997c0f4e3df63c0fc5e4207ccb1ab37900433e0f72fef88315d317829a26"}, @@ -8665,86 +8682,6 @@ files = [ {file = "soupsieve-2.7.tar.gz", hash = "sha256:ad282f9b6926286d2ead4750552c8a6142bc4c783fd66b0293547c8fe6ae126a"}, ] -[[package]] -name = "spacy" -version = "3.8.3" -description = "Industrial-strength Natural Language Processing (NLP) in Python" -optional = true -python-versions = "<3.13,>=3.9" -groups = ["main"] -markers = "python_version < \"3.11\" and extra == \"pii-detection\"" -files = [ - {file = "spacy-3.8.3-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:b530a5cbb077601d03bdd71bf1ded4de4b7fb0362b5443c5183c628cfa81ffdc"}, - {file = "spacy-3.8.3-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:b28a5f7b77400ebf7e23aa24a82a2d35f97071cd5ef1ad0f859aa9b323fff59a"}, - {file = "spacy-3.8.3-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:bbcfd24a00da30ca53570f5b1c3535c1fa95b633f2a12b3d08395c9552ffb53c"}, - {file = "spacy-3.8.3-cp310-cp310-musllinux_1_2_x86_64.whl", hash = "sha256:e3630ea33608a6db8045fad7e0ba22f864c61ea351445488a89af1734e434a37"}, - {file = "spacy-3.8.3-cp310-cp310-win_amd64.whl", hash = "sha256:20839fa04cc2156ab613e40db54c25031304fdc1dd369930bc01c366586d0079"}, - {file = "spacy-3.8.3-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:b16b8f9c544cdccd1bd23fc6bf6e2f1d667a1ee285a9b31bdb4a89e2d61345b4"}, - {file = "spacy-3.8.3-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:f62e45a2259acc51cd8eb185f978848928f2f698ba174b283253485fb7691b04"}, - {file = "spacy-3.8.3-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:57a267ea25dd8b7ec3e55accd1592d2d0847f0c6277a55145af5bb08e318bab4"}, - {file = "spacy-3.8.3-cp311-cp311-musllinux_1_2_x86_64.whl", hash = "sha256:45bc5fc8d399089607e3e759aee98362ffb007e39386531f195f42dcddcc94dc"}, - {file = "spacy-3.8.3-cp311-cp311-win_amd64.whl", hash = "sha256:9e348359d54418a5752305975f1268013135255bd656a783aa3397b3bd4dd5e9"}, - {file = "spacy-3.8.3-cp312-cp312-macosx_10_13_x86_64.whl", hash = "sha256:b01e50086515fa6d43275be11a762a3a3285d9aabbe27b4f3b98a08083f1d2a1"}, - {file = "spacy-3.8.3-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:187f9732362d0dc52b16c80e67decf58ff91605e34b251c50c7dc5212082fcb4"}, - {file = "spacy-3.8.3-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:d7517bc969bca924cbdba4e14e0ce16e66d32967468ad27490e95c9b4d8d8aa8"}, - {file = "spacy-3.8.3-cp312-cp312-musllinux_1_2_x86_64.whl", hash = "sha256:460948437c5571367105554b1e67549f957ba8dd6ee7e1594e719f9a88c398bb"}, - {file = "spacy-3.8.3-cp312-cp312-win_amd64.whl", hash = "sha256:1f14d4e2b1e6ab144ee546236f2c32b255f91f24939e62436c3a9c2ee200c6d1"}, - {file = "spacy-3.8.3-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:6f6020603633ec47374af71e936671d5992d68e592661dffac940f5596d77696"}, - {file = "spacy-3.8.3-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:72b492651534460bf4fe842f7efa462887f9e215de86146b862df6238b952650"}, - {file = "spacy-3.8.3-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:6a630119aaa7a6180635eb8f21b27509654882847480c8423a657582b4a9bdd3"}, - {file = "spacy-3.8.3-cp39-cp39-musllinux_1_2_x86_64.whl", hash = "sha256:8563ba9cbb71a629c7dc8c2db98f0348416dc0f0927de0e9ed8b448f707b5248"}, - {file = "spacy-3.8.3-cp39-cp39-win_amd64.whl", hash = "sha256:608beca075f7611083e93c91625d7e6c5885e2672cb5ec1b9f274cab6c82c816"}, - {file = "spacy-3.8.3.tar.gz", hash = "sha256:81a967dc3d6a5a0a9ab250559483fe2092306582a9192f98be7a63bdce2797f7"}, -] - -[package.dependencies] -catalogue = ">=2.0.6,<2.1.0" -cymem = ">=2.0.2,<2.1.0" -jinja2 = "*" -langcodes = ">=3.2.0,<4.0.0" -murmurhash = ">=0.28.0,<1.1.0" -numpy = {version = ">=1.19.0", markers = "python_version >= \"3.9\""} -packaging = ">=20.0" -preshed = ">=3.0.2,<3.1.0" -pydantic = ">=1.7.4,<1.8 || >1.8,<1.8.1 || >1.8.1,<3.0.0" -requests = ">=2.13.0,<3.0.0" -setuptools = "*" -spacy-legacy = ">=3.0.11,<3.1.0" -spacy-loggers = ">=1.0.0,<2.0.0" -srsly = ">=2.4.3,<3.0.0" -thinc = ">=8.3.0,<8.4.0" -tqdm = ">=4.38.0,<5.0.0" -typer = ">=0.3.0,<1.0.0" -wasabi = ">=0.9.1,<1.2.0" -weasel = ">=0.1.0,<0.5.0" - -[package.extras] -apple = ["thinc-apple-ops (>=1.0.0,<2.0.0)"] -cuda = ["cupy (>=5.0.0b4,<13.0.0)"] -cuda-autodetect = ["cupy-wheel (>=11.0.0,<13.0.0)"] -cuda100 = ["cupy-cuda100 (>=5.0.0b4,<13.0.0)"] -cuda101 = ["cupy-cuda101 (>=5.0.0b4,<13.0.0)"] -cuda102 = ["cupy-cuda102 (>=5.0.0b4,<13.0.0)"] -cuda110 = ["cupy-cuda110 (>=5.0.0b4,<13.0.0)"] -cuda111 = ["cupy-cuda111 (>=5.0.0b4,<13.0.0)"] -cuda112 = ["cupy-cuda112 (>=5.0.0b4,<13.0.0)"] -cuda113 = ["cupy-cuda113 (>=5.0.0b4,<13.0.0)"] -cuda114 = ["cupy-cuda114 (>=5.0.0b4,<13.0.0)"] -cuda115 = ["cupy-cuda115 (>=5.0.0b4,<13.0.0)"] -cuda116 = ["cupy-cuda116 (>=5.0.0b4,<13.0.0)"] -cuda117 = ["cupy-cuda117 (>=5.0.0b4,<13.0.0)"] -cuda11x = ["cupy-cuda11x (>=11.0.0,<13.0.0)"] -cuda12x = ["cupy-cuda12x (>=11.5.0,<13.0.0)"] -cuda80 = ["cupy-cuda80 (>=5.0.0b4,<13.0.0)"] -cuda90 = ["cupy-cuda90 (>=5.0.0b4,<13.0.0)"] -cuda91 = ["cupy-cuda91 (>=5.0.0b4,<13.0.0)"] -cuda92 = ["cupy-cuda92 (>=5.0.0b4,<13.0.0)"] -ja = ["sudachidict_core (>=20211220)", "sudachipy (>=0.5.2,!=0.6.1)"] -ko = ["natto-py (>=0.9.0)"] -lookups = ["spacy_lookups_data (>=1.0.3,<1.1.0)"] -th = ["pythainlp (>=2.0)"] -transformers = ["spacy_transformers (>=1.1.2,<1.4.0)"] - [[package]] name = "spacy" version = "3.8.7" @@ -8752,7 +8689,7 @@ description = "Industrial-strength Natural Language Processing (NLP) in Python" optional = true python-versions = "<3.14,>=3.9" groups = ["main"] -markers = "python_version >= \"3.11\" and extra == \"pii-detection\"" +markers = "extra == \"pii-detection\"" files = [ {file = "spacy-3.8.7-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:6ec0368ce96cd775fb14906f04b771c912ea8393ba30f8b35f9c4dc47a420b8e"}, {file = "spacy-3.8.7-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:5672f8a0fe7a3847e925544890be60015fbf48a60a838803425f82e849dd4f18"}, @@ -10796,4 +10733,4 @@ xgboost = ["xgboost"] [metadata] lock-version = "2.1" python-versions = ">=3.9,<3.13" -content-hash = "c0d19b5f56a04e23ab24ef3dda0ff866f7cadc21ab47721b083021feea7a0104" +content-hash = "a71d5d3474039cdc4a5e81fed3a212aac66e5cd69e9ffe9e73a3403cd287865b" diff --git a/pyproject.toml b/pyproject.toml index a4a96f618..e49687e8a 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -26,7 +26,6 @@ dependencies = [ "python-dotenv", "scikit-learn", "seaborn", - "sentry-sdk (>=1.24.0,<2.0.0)", "tabulate (>=0.9.0,<0.10.0)", "tiktoken", "tqdm", diff --git a/validmind/api_client.py b/validmind/api_client.py index 553e2701c..c901be491 100644 --- a/validmind/api_client.py +++ b/validmind/api_client.py @@ -22,7 +22,7 @@ from .client_config import client_config from .errors import MissingAPICredentialsError, MissingModelIdError, raise_api_error -from .logging import get_logger, init_sentry, log_api_operation, send_single_error +from .logging import get_logger, log_api_operation from .utils import NumpyEncoder, is_html, md_to_html, run_async from .vm_models.figure import Figure @@ -166,7 +166,7 @@ def _ping() -> Dict[str, Any]: client_info = r.json() - init_sentry(client_info.get("sentry_config", {})) + # Sentry removed: no telemetry initialization # Only show this confirmation the first time we connect to the API ack_connected = not client_config.model @@ -244,14 +244,7 @@ def init( def reload(): """Reconnect to the ValidMind API and reload the project configuration.""" - - try: - _ping() - except Exception as e: - # if the api host is https, assume we're not in dev mode and send to sentry - if _api_host.startswith("https://"): - send_single_error(e) - raise e + _ping() async def aget_metadata(content_id: str) -> Dict[str, Any]: diff --git a/validmind/logging.py b/validmind/logging.py index 3b0322b39..51d145d10 100644 --- a/validmind/logging.py +++ b/validmind/logging.py @@ -7,14 +7,7 @@ import logging import os import time -from typing import Any, Awaitable, Callable, Dict, Optional, TypeVar - -import sentry_sdk -from sentry_sdk.utils import event_from_exception, exc_info_from_error - -from .__version__ import __version__ - -__dsn = "https://48f446843657444aa1e2c0d716ef864b@o1241367.ingest.sentry.io/4505239625465856" +from typing import Any, Awaitable, Callable, Optional, TypeVar def _get_log_level() -> int: @@ -55,45 +48,6 @@ def get_logger( return logger -def init_sentry(server_config: Dict[str, Any]) -> None: - """Initialize Sentry SDK for sending logs back to ValidMind. - - This will usually only be called by the API client module to initialize the - Sentry connection after the user calls `validmind.init()`. This is because the DSN - and other config options will be returned by the API. - - Args: - server_config (Dict[str, Any]): The config dictionary returned by the API. - - send_logs (bool): Whether to send logs to Sentry (gets removed). - - dsn (str): The Sentry DSN. - ...: Other config options for Sentry. - - Returns: - None. - """ - if os.getenv("VM_NO_TELEMETRY", False): - return - - if not server_config.get("send_logs", False): - return - - config = { - "dsn": __dsn, - "traces_sample_rate": 1.0, - "release": f"validmind-python@{__version__}", - "in_app_include": ["validmind"], - "environment": "production", - } - config.update({k: v for k, v in server_config.items() if k != "send_logs"}) - - try: - sentry_sdk.init(**config) - except Exception as e: - logger = get_logger(__name__) - logger.info("Sentry failed to initialize - ignoring...") - logger.debug(f"Sentry error: {str(e)}") - - F = TypeVar("F", bound=Callable[..., Any]) AF = TypeVar("AF", bound=Callable[..., Awaitable[Any]]) @@ -216,16 +170,3 @@ async def wrapped(*args: Any, **kwargs: Any) -> Any: return wrapped return decorator - - -def send_single_error(error: Exception) -> None: - """Send a single error to Sentry. - - Args: - error (Exception): The exception to send. - """ - event, hint = event_from_exception(exc_info_from_error(error)) - client = sentry_sdk.Client(__dsn, release=f"validmind-python@{__version__}") - client.capture_event(event, hint=hint) - - time.sleep(0.25) # wait for the event to be sent