Skip to content

fix: Do not mask unrelated import errors when guarding optional dependencies - #1009

Merged
vdusek merged 1 commit into
masterfrom
fix-try-import-masking
Aug 17, 2026
Merged

fix: Do not mask unrelated import errors when guarding optional dependencies#1009
vdusek merged 1 commit into
masterfrom
fix-try-import-masking

Conversation

@vdusek

Copy link
Copy Markdown
Contributor

try_import now swallows only the ModuleNotFoundError of the optional dependency it names, so an import error raised by the importing module itself or by another dependency propagates instead of being masked. __all__ of apify_client.http_compressors omits BrotliHttpCompressor when the brotli extra is not installed, since the symbol was never provided.

Split out of #1006.

✍️ Drafted by Claude Code

@vdusekvdusek added adhoc Ad-hoc unplanned task added during the sprint. t-tooling Issues with this label are in the ownership of the tooling team. labels Aug 17, 2026
@vdusekvdusek self-assigned this Aug 17, 2026
@github-actionsgithub-actionsBot added the tested Temporary label used only programatically for some analytics. label Aug 17, 2026
@codecov

codecovBot commented Aug 17, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 94.89%. Comparing base (31f7854) to head (e38c0b5).

Additional details and impacted files
@@ Coverage Diff @@## master #1009 +/- ##
==========================================
+ Coverage 94.86% 94.89% +0.02% 
==========================================
Files 58 58 Lines 5357 5366 +9 ==========================================
+ Hits 5082 5092 +10 + Misses 275 274 -1 
FlagCoverage Δ
integration92.30% <60.00%> (+0.16%)⬆️
unit84.66% <100.00%> (+0.02%)⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@vdusek
vdusek requested a review from PijukatelAugust 17, 2026 09:57
@vdusek
vdusek marked this pull request as ready for review August 17, 2026 09:57
@vdusek
vdusek merged commit f57e9e7 into masterAug 17, 2026
30 checks passed
@vdusek
vdusek deleted the fix-try-import-masking branch August 17, 2026 13:16
vdusek added a commit that referenced this pull request Aug 17, 2026
…onses (#1010)
`HttpResponse` now comes from `typing_extensions`, whose runtime
protocol check looks attributes up statically. The `typing`
implementation on Python 3.11 calls `hasattr`, which evaluates
properties, so `isinstance(response, HttpResponse)` on an unread
streaming response either raised or silently buffered the whole body.
Adds streaming regression tests (unit and integration) and a
parametrized built-in-client fixture they run on.
Split out of #1006. Stacked on #1009.
*✍️ Drafted by Claude Code*
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

adhocAd-hoc unplanned task added during the sprint.t-toolingIssues with this label are in the ownership of the tooling team.testedTemporary label used only programatically for some analytics.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

@vdusek@Pijukatel@apify-service-account