Skip to content

Conversation

@nibalizer
Copy link
Contributor

Pull Request Description

What and why?

How to test

What needs special review?

Dependencies, breaking changes, and deployment notes

Release notes

Checklist

  • What and why
  • Screenshots or videos (Frontend)
  • How to test
  • What needs special review
  • Dependencies, breaking changes, and deployment notes
  • Labels applied
  • PR linked to Shortcut
  • Unit tests added (Backend)
  • Tested locally
  • Documentation updated (if required)
  • Environment variable additions/changes documented (if required)

@nibalizer nibalizer marked this pull request as draft September 29, 2025 21:26
@github-actions
Copy link
Contributor

PR Summary

This PR replaces the asynchronous aiohttp-based API client with a synchronous implementation using the requests library. The key changes include:

  • Updating the dependency in the project configuration from "aiohttp[speedups]" (and removing "nest-asyncio") to "requests".
  • Refactoring the API client (validmind/api_client.py) to use requests.Session instead of aiohttp.ClientSession. This includes removal of async/await syntax and related utilities (e.g. run_async).
  • Adjusting function signatures and behavior for common operations (_get, _post, _ping, log_metadata, log_figure, log_test_result, log_metric, log_input, etc.) to operate synchronously.
  • Modifying test files (e.g. test_conversion.py, tests/test_api_client.py, tests/test_results.py, and test_suite runner modules) to remove async tests and to check for proper synchronous behavior. The tests now ensure that asynchronous constructs and dependencies (like aiohttp) are removed entirely and that requests is correctly used.
  • General cleanup of unused async-related code, such as the removal of the async session closing via atexit and adjustments in result logging within the test suite and result modules.

Overall, the refactor simplifies the data flow by removing concurrency complexity, ensuring consistency in API calls (by relying solely on the requests library), and updating the tests to confirm that the synchronous API interactions work as intended.

Test Suggestions

  • Run integration tests against a staging API to verify that synchronous API calls work as expected.
  • Test edge cases for network failures, ensuring that error responses trigger the appropriate error handling.
  • Confirm that all converted endpoints (log_metadata, log_figure, log_test_result, etc.) correctly handle request payloads and return expected results.
  • Ensure that tests checking the removal of asynchronous code and the presence of requests-based implementation pass.

@nibalizer nibalizer closed this Sep 30, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant