Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ENG-669] Remove deprecation warnings #1046

Merged
merged 4 commits into from
Nov 22, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 26 additions & 12 deletions rasa_sdk/endpoint.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,38 @@
import logging
import os
import types
import warnings
import zlib
import json
from opentelemetry.sdk.trace import TracerProvider
from typing import List, Text, Union, Optional
from ssl import SSLContext

from sanic import Sanic, response
from sanic.response import HTTPResponse
from sanic.request import Request
from sanic_cors import CORS

from rasa_sdk import utils
from rasa_sdk.cli.arguments import add_endpoint_arguments
from rasa_sdk.constants import DEFAULT_KEEP_ALIVE_TIMEOUT, DEFAULT_SERVER_PORT
from rasa_sdk.executor import ActionExecutor
from rasa_sdk.interfaces import ActionExecutionRejection, ActionNotFoundException
from rasa_sdk.plugin import plugin_manager
from rasa_sdk.tracing.utils import get_tracer_and_context, set_span_attributes

# catching:
# - all `pkg_resources` deprecation warning from multiple dependencies
# - google rcp warnings (`pkg_resources.namespaces`)
# - open telemetry (`pkg_resources`)
# - sanic-cors (`distutils Version classes...`)
with warnings.catch_warnings():
ancalita marked this conversation as resolved.
Show resolved Hide resolved
warnings.filterwarnings(
"ignore", category=DeprecationWarning, message=".*pkg_resources.*"
)
warnings.filterwarnings(
"ignore",
category=DeprecationWarning,
message="distutils Version classes are deprecated",
)
from opentelemetry.sdk.trace import TracerProvider
from sanic_cors import CORS
from sanic.request import Request
from rasa_sdk import utils
from rasa_sdk.cli.arguments import add_endpoint_arguments
from rasa_sdk.constants import DEFAULT_KEEP_ALIVE_TIMEOUT, DEFAULT_SERVER_PORT
from rasa_sdk.executor import ActionExecutor
from rasa_sdk.interfaces import ActionExecutionRejection, ActionNotFoundException
from rasa_sdk.plugin import plugin_manager
from rasa_sdk.tracing.utils import get_tracer_and_context, set_span_attributes

logger = logging.getLogger(__name__)

Expand Down