Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

Type annotation of methods which are returning {api_endpoint}.call_with_http_info for asynchronous api is incorrect

Open
#2,629 3 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
35/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Stale
Tech stack
python
Domain
api

Research direction

Start in src/datadog_api_client/v2/api/spans_metrics_api.py around lines 134-150 and inspect how the asynchronous API client calls call_with_http_info. Check the affected method annotations against the coroutine behavior, then verify that type checkers accept the corrected return types; done means asynchronous methods accurately describe their possible return values.

Written by the indexing model from the issue text.

Description

kind/bug stale

Describe the bug

For example in [1]:

    def create_spans_metric(
        self,
        body: SpansMetricCreateRequest,
    ) -> SpansMetricResponse:
        """Create a span-based metric.

        Create a metric based on your ingested spans in your organization.
        Returns the span-based metric object from the request body when the request is successful.

        :param body: The definition of the new span-based metric.
        :type body: SpansMetricCreateRequest
        :rtype: SpansMetricResponse
        """
        kwargs: Dict[str, Any] = {}
        kwargs["body"] = body

        return self._create_spans_metric_endpoint.call_with_http_info(**kwargs)

when the api client is async, the function returns coroutine. So the return type should be updated to

-    ) -> SpansMetricCreateRequest:
+    ) -> SpansMetricCreateRequest | Awaitable[SpansMetricCreateRequest]:

Type checkers are not happy about the current state

[1] https://github.com/DataDog/datadog-api-client-python/blob/master/src/datadog_api_client/v2/api/spans_metrics_api.py#L134-L150

Dominant language
Python
Stars
166
Forks
55
Avg merge
2d 17h
Merged PRs (30d)
73

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from DataDog/datadog-api-client-python

All issues in DataDog/datadog-api-client-python

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.