Skip to content

Commit

Permalink
Emit Python warnings for beta and tech preview APIs (#2675)
Browse files Browse the repository at this point in the history
(cherry picked from commit 066465e)
  • Loading branch information
pquentin authored and github-actions[bot] committed Nov 10, 2024
1 parent 1ca2962 commit 3674f72
Show file tree
Hide file tree
Showing 30 changed files with 373 additions and 25 deletions.
3 changes: 3 additions & 0 deletions elasticsearch/_async/client/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,10 @@
_TYPE_HOSTS,
CLIENT_META_SERVICE,
SKIP_IN_PATH,
Stability,
_quote,
_rewrite_parameters,
_stability_warning,
client_node_configs,
is_requests_http_auth,
is_requests_node_class,
Expand Down Expand Up @@ -3554,6 +3556,7 @@ async def render_search_template(
@_rewrite_parameters(
body_fields=("context", "context_setup", "script"),
)
@_stability_warning(Stability.EXPERIMENTAL)
async def scripts_painless_execute(
self,
*,
Expand Down
9 changes: 8 additions & 1 deletion elasticsearch/_async/client/cat.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,13 @@
from elastic_transport import ObjectApiResponse, TextApiResponse

from ._base import NamespacedClient
from .utils import SKIP_IN_PATH, _quote, _rewrite_parameters
from .utils import (
SKIP_IN_PATH,
Stability,
_quote,
_rewrite_parameters,
_stability_warning,
)


class CatClient(NamespacedClient):
Expand Down Expand Up @@ -2517,6 +2523,7 @@ async def snapshots(
)

@_rewrite_parameters()
@_stability_warning(Stability.EXPERIMENTAL)
async def tasks(
self,
*,
Expand Down
33 changes: 32 additions & 1 deletion elasticsearch/_async/client/connector.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,19 @@
from elastic_transport import ObjectApiResponse

from ._base import NamespacedClient
from .utils import SKIP_IN_PATH, _quote, _rewrite_parameters
from .utils import (
SKIP_IN_PATH,
Stability,
_quote,
_rewrite_parameters,
_stability_warning,
)


class ConnectorClient(NamespacedClient):

@_rewrite_parameters()
@_stability_warning(Stability.EXPERIMENTAL)
async def check_in(
self,
*,
Expand Down Expand Up @@ -67,6 +74,7 @@ async def check_in(
)

@_rewrite_parameters()
@_stability_warning(Stability.BETA)
async def delete(
self,
*,
Expand Down Expand Up @@ -115,6 +123,7 @@ async def delete(
)

@_rewrite_parameters()
@_stability_warning(Stability.BETA)
async def get(
self,
*,
Expand Down Expand Up @@ -170,6 +179,7 @@ async def get(
"sync_cursor",
),
)
@_stability_warning(Stability.EXPERIMENTAL)
async def last_sync(
self,
*,
Expand Down Expand Up @@ -299,6 +309,7 @@ async def last_sync(
@_rewrite_parameters(
parameter_aliases={"from": "from_"},
)
@_stability_warning(Stability.BETA)
async def list(
self,
*,
Expand Down Expand Up @@ -372,6 +383,7 @@ async def list(
"service_type",
),
)
@_stability_warning(Stability.BETA)
async def post(
self,
*,
Expand Down Expand Up @@ -453,6 +465,7 @@ async def post(
"service_type",
),
)
@_stability_warning(Stability.BETA)
async def put(
self,
*,
Expand Down Expand Up @@ -529,6 +542,7 @@ async def put(
)

@_rewrite_parameters()
@_stability_warning(Stability.BETA)
async def sync_job_cancel(
self,
*,
Expand Down Expand Up @@ -576,6 +590,7 @@ async def sync_job_cancel(
)

@_rewrite_parameters()
@_stability_warning(Stability.BETA)
async def sync_job_delete(
self,
*,
Expand Down Expand Up @@ -620,6 +635,7 @@ async def sync_job_delete(
)

@_rewrite_parameters()
@_stability_warning(Stability.BETA)
async def sync_job_get(
self,
*,
Expand Down Expand Up @@ -664,6 +680,7 @@ async def sync_job_get(
@_rewrite_parameters(
parameter_aliases={"from": "from_"},
)
@_stability_warning(Stability.BETA)
async def sync_job_list(
self,
*,
Expand Down Expand Up @@ -743,6 +760,7 @@ async def sync_job_list(
@_rewrite_parameters(
body_fields=("id", "job_type", "trigger_method"),
)
@_stability_warning(Stability.BETA)
async def sync_job_post(
self,
*,
Expand Down Expand Up @@ -802,6 +820,7 @@ async def sync_job_post(
)

@_rewrite_parameters()
@_stability_warning(Stability.EXPERIMENTAL)
async def update_active_filtering(
self,
*,
Expand Down Expand Up @@ -845,6 +864,7 @@ async def update_active_filtering(
@_rewrite_parameters(
body_fields=("api_key_id", "api_key_secret_id"),
)
@_stability_warning(Stability.BETA)
async def update_api_key_id(
self,
*,
Expand Down Expand Up @@ -903,6 +923,7 @@ async def update_api_key_id(
@_rewrite_parameters(
body_fields=("configuration", "values"),
)
@_stability_warning(Stability.BETA)
async def update_configuration(
self,
*,
Expand Down Expand Up @@ -958,6 +979,7 @@ async def update_configuration(
@_rewrite_parameters(
body_fields=("error",),
)
@_stability_warning(Stability.EXPERIMENTAL)
async def update_error(
self,
*,
Expand Down Expand Up @@ -1013,6 +1035,7 @@ async def update_error(
@_rewrite_parameters(
body_fields=("advanced_snippet", "filtering", "rules"),
)
@_stability_warning(Stability.BETA)
async def update_filtering(
self,
*,
Expand Down Expand Up @@ -1074,6 +1097,7 @@ async def update_filtering(
@_rewrite_parameters(
body_fields=("validation",),
)
@_stability_warning(Stability.EXPERIMENTAL)
async def update_filtering_validation(
self,
*,
Expand Down Expand Up @@ -1127,6 +1151,7 @@ async def update_filtering_validation(
@_rewrite_parameters(
body_fields=("index_name",),
)
@_stability_warning(Stability.BETA)
async def update_index_name(
self,
*,
Expand Down Expand Up @@ -1180,6 +1205,7 @@ async def update_index_name(
@_rewrite_parameters(
body_fields=("description", "name"),
)
@_stability_warning(Stability.BETA)
async def update_name(
self,
*,
Expand Down Expand Up @@ -1234,6 +1260,7 @@ async def update_name(
@_rewrite_parameters(
body_fields=("is_native",),
)
@_stability_warning(Stability.BETA)
async def update_native(
self,
*,
Expand Down Expand Up @@ -1286,6 +1313,7 @@ async def update_native(
@_rewrite_parameters(
body_fields=("pipeline",),
)
@_stability_warning(Stability.BETA)
async def update_pipeline(
self,
*,
Expand Down Expand Up @@ -1339,6 +1367,7 @@ async def update_pipeline(
@_rewrite_parameters(
body_fields=("scheduling",),
)
@_stability_warning(Stability.BETA)
async def update_scheduling(
self,
*,
Expand Down Expand Up @@ -1391,6 +1420,7 @@ async def update_scheduling(
@_rewrite_parameters(
body_fields=("service_type",),
)
@_stability_warning(Stability.BETA)
async def update_service_type(
self,
*,
Expand Down Expand Up @@ -1443,6 +1473,7 @@ async def update_service_type(
@_rewrite_parameters(
body_fields=("status",),
)
@_stability_warning(Stability.EXPERIMENTAL)
async def update_status(
self,
*,
Expand Down
3 changes: 2 additions & 1 deletion elasticsearch/_async/client/features.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
from elastic_transport import ObjectApiResponse

from ._base import NamespacedClient
from .utils import _rewrite_parameters
from .utils import Stability, _rewrite_parameters, _stability_warning


class FeaturesClient(NamespacedClient):
Expand Down Expand Up @@ -62,6 +62,7 @@ async def get_features(
)

@_rewrite_parameters()
@_stability_warning(Stability.EXPERIMENTAL)
async def reset_features(
self,
*,
Expand Down
10 changes: 9 additions & 1 deletion elasticsearch/_async/client/fleet.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,13 @@
from elastic_transport import ObjectApiResponse

from ._base import NamespacedClient
from .utils import SKIP_IN_PATH, _quote, _rewrite_parameters
from .utils import (
SKIP_IN_PATH,
Stability,
_quote,
_rewrite_parameters,
_stability_warning,
)


class FleetClient(NamespacedClient):
Expand Down Expand Up @@ -91,6 +97,7 @@ async def global_checkpoints(
@_rewrite_parameters(
body_name="searches",
)
@_stability_warning(Stability.EXPERIMENTAL)
async def msearch(
self,
*,
Expand Down Expand Up @@ -277,6 +284,7 @@ async def msearch(
"from": "from_",
},
)
@_stability_warning(Stability.EXPERIMENTAL)
async def search(
self,
*,
Expand Down
11 changes: 10 additions & 1 deletion elasticsearch/_async/client/indices.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,13 @@
from elastic_transport import HeadApiResponse, ObjectApiResponse

from ._base import NamespacedClient
from .utils import SKIP_IN_PATH, _quote, _rewrite_parameters
from .utils import (
SKIP_IN_PATH,
Stability,
_quote,
_rewrite_parameters,
_stability_warning,
)


class IndicesClient(NamespacedClient):
Expand Down Expand Up @@ -1032,6 +1038,7 @@ async def delete_template(
)

@_rewrite_parameters()
@_stability_warning(Stability.EXPERIMENTAL)
async def disk_usage(
self,
*,
Expand Down Expand Up @@ -1114,6 +1121,7 @@ async def disk_usage(
@_rewrite_parameters(
body_name="config",
)
@_stability_warning(Stability.EXPERIMENTAL)
async def downsample(
self,
*,
Expand Down Expand Up @@ -1488,6 +1496,7 @@ async def explain_data_lifecycle(
)

@_rewrite_parameters()
@_stability_warning(Stability.EXPERIMENTAL)
async def field_usage_stats(
self,
*,
Expand Down
12 changes: 11 additions & 1 deletion elasticsearch/_async/client/inference.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,19 @@
from elastic_transport import ObjectApiResponse

from ._base import NamespacedClient
from .utils import SKIP_IN_PATH, _quote, _rewrite_parameters
from .utils import (
SKIP_IN_PATH,
Stability,
_quote,
_rewrite_parameters,
_stability_warning,
)


class InferenceClient(NamespacedClient):

@_rewrite_parameters()
@_stability_warning(Stability.EXPERIMENTAL)
async def delete(
self,
*,
Expand Down Expand Up @@ -93,6 +100,7 @@ async def delete(
)

@_rewrite_parameters()
@_stability_warning(Stability.EXPERIMENTAL)
async def get(
self,
*,
Expand Down Expand Up @@ -151,6 +159,7 @@ async def get(
@_rewrite_parameters(
body_fields=("input", "query", "task_settings"),
)
@_stability_warning(Stability.EXPERIMENTAL)
async def inference(
self,
*,
Expand Down Expand Up @@ -237,6 +246,7 @@ async def inference(
@_rewrite_parameters(
body_name="inference_config",
)
@_stability_warning(Stability.EXPERIMENTAL)
async def put(
self,
*,
Expand Down
Loading

0 comments on commit 3674f72

Please sign in to comment.