Skip to content

APP-5243: Migrate to httpx (goodbye requests 👋 ) #679

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

Merged
merged 43 commits into from
Aug 20, 2025
Merged

Conversation

Aryamanz29
Copy link
Member

@Aryamanz29 Aryamanz29 commented Jul 14, 2025

Jira link:

  • https://atlanhq.atlassian.net/browse/APP-5243

  • Removed requirements files (no need since we already migrated to uv)

  • Updated GitHub workflows for Docker image builds to use uv sync (without dev dependencies)

  • Breaking change: Dropped support for Python 3.8 (httpx-retries requires Python ≥ 3.9)

Other v8 release tasks:

  • Add Python version in headers
  • Reduce test build time & coverage report generation
    (explore label-based test runs for async tests)
  • Fix conda packages publish GitHub Action
  • Complete final SDK benchmarking
  • Create async dev docs (TBD)

✨ Description

  • Completely removed support for requests and replaced it with httpx (which supports both sync and async clients)
  • Implemented AsyncAtlanClient for all async operations (extends AtlanClient for reusability)
  • Refactored all existing clients, caches, and several creators (connection, badge, etc.) to support async variants, and added new models (mainly search result models that require async iteration). Following aio directory convention for all async components.
  • Used a "sandwich approach" for refactoring: extracted common functionality (request preparation and response processing) into a separate common sub-package. This enables reuse across both sync and async operations - only the middle layer (API calling with respective clients) differs.

Ex:

from pyatlan.client.common import FindPurposesByName

@validate_arguments
async def find_purposes_by_name(
   self,
   name: str,
   attributes: Optional[List[str]] = None,
) -> List[Purpose]:
   """
   Async find purposes by name using shared business logic.
   :param name: of the purpose
   :param attributes: (optional) collection of attributes to retrieve for the purpose
   :returns: all purposes with that name, if found
   :raises NotFoundError: if no purpose with the provided name exists
   """
   search_request = FindPurposesByName.prepare_request(name, attributes)
   search_results = await self.search(search_request)
   return FindPurposesByName.process_response(
       search_results, name, allow_multiple=True
   )

🧩 Type of change

Select all that apply:

  • 🚀 New feature (non-breaking change that adds functionality)
  • 🐛 Bug fix (non-breaking change that fixes an issue) — please include tests! Refer testing-toolkit 🧪
  • 🔄 Refactor (code change that neither fixes a bug nor adds a feature)
  • 🧹 Maintenance (chores, cleanup, minor improvements)
  • 💥 Breaking change (fix or feature that may break existing functionality)
  • 📦 Dependency upgrade/downgrade
  • 📚 Documentation updates

✅ How has this been tested? (e.g. screenshots, logs, workflow links)

Describe how the change was tested. Include:

  • Steps to reproduce
  • Any relevant screenshots, logs, or links to successful workflow runs
  • Details on environment/setup if applicable

📋 Checklist

  • My code follows the project’s style guidelines
  • I’ve performed a self-review of my code
  • I’ve added comments in tricky or complex areas
  • I’ve updated the documentation as needed
  • There are no new warnings from my changes
  • I’ve added tests to cover my changes
  • All new and existing tests pass locally

@Aryamanz29 Aryamanz29 requested a review from Copilot July 14, 2025 12:13
@Aryamanz29 Aryamanz29 self-assigned this Jul 14, 2025
@Aryamanz29 Aryamanz29 added feature New feature or request dependencies Pull requests that update a dependency file change Pyatlan change pull request cleanup breaking-change refactor labels Jul 14, 2025
Copilot

This comment was marked as outdated.

cursor[bot]

This comment was marked as outdated.

cursor[bot]

This comment was marked as outdated.

cursor[bot]

This comment was marked as outdated.

cursor[bot]

This comment was marked as outdated.

@Aryamanz29 Aryamanz29 force-pushed the APP-5243 branch 2 times, most recently from 4a1f567 to 82d2354 Compare July 15, 2025 09:21
cursor[bot]

This comment was marked as outdated.

@Aryamanz29 Aryamanz29 force-pushed the APP-5243 branch 2 times, most recently from 652804a to 3ba2a99 Compare July 15, 2025 11:14
cursor[bot]

This comment was marked as outdated.

@Aryamanz29 Aryamanz29 requested a review from Copilot July 15, 2025 11:17
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

Migrates the SDK from requests to httpx (using httpx-retries) and drops Python 3.8 support, updating tests, dependencies, and CI workflows accordingly.

  • Refactored AtlanClient to use httpx.Client with RetryTransport and new timeout/streaming logic
  • Updated unit and integration tests to mock and assert against httpx behavior
  • Removed requests from dependencies, bumped requires-python to ≥ 3.9, and adjusted GitHub Actions to no longer test on 3.8

Reviewed Changes

Copilot reviewed 14 out of 16 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
tests/unit/test_query_client.py Adapted mocks to support httpx streaming and reading
tests/unit/test_file_client.py Updated mocks and assertions for httpx file streaming
tests/unit/test_base_vcr_yaml.py Replaced requests calls with httpx equivalents
tests/unit/test_base_vcr_json.py Replaced requests calls with httpx equivalents
tests/integration/test_index_search.py Swapped requests exceptions and imports for httpx
requirements-dev.txt Removed legacy dev requirements file
pyproject.toml Dropped Python 3.8, removed requests, added httpx
pyatlan/client/common.py Switched retry import from urllib3 to httpx-retries
pyatlan/client/atlan.py Refactored client setup, API calls, timeout and streams
pyatlan/client/asset.py Wrapped retry errors in _wait_till_deleted
.github/workflows/pyatlan-test-cron.yaml Updated Python matrix to ≥ 3.9
.github/workflows/pyatlan-publish.yaml Changed uv sync to omit dev dependencies
.github/workflows/pyatlan-pr.yaml Dropped 3.8 from PR and vulnerability-scan inputs
.github/workflows/build_and_upload_conda_packages.yaml Removed 3.8 from conda build matrix
Comments suppressed due to low confidence (1)

.github/workflows/pyatlan-pr.yaml:40

  • [nitpick] Changing the vulnerability-scan inputs to scan the entire workspace may include unintended files. Specify the exact dependency files (e.g., requirements lock files) to limit the scan surface and reduce noise.
            inputs: .

cursor[bot]

This comment was marked as outdated.

cursor[bot]

This comment was marked as outdated.

cursor[bot]

This comment was marked as outdated.

cursor[bot]

This comment was marked as outdated.

cursor[bot]

This comment was marked as outdated.

Copy link
Member Author

@Aryamanz29 Aryamanz29 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Put tons of work into this - fingers crossed it pays off! 🤞 lets goooo 🚀

@Aryamanz29 Aryamanz29 added the run-async-tests To manually trigger SDK async integration tests label Aug 20, 2025
@Aryamanz29 Aryamanz29 merged commit c7287ed into main Aug 20, 2025
65 of 74 checks passed
@Aryamanz29 Aryamanz29 deleted the APP-5243 branch August 20, 2025 19:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
breaking-change change Pyatlan change pull request cleanup dependencies Pull requests that update a dependency file feature New feature or request refactor run-async-tests To manually trigger SDK async integration tests
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant