Repository navigation
fix: Re-export SDK imports from every module - #187
Merged
Merged
Conversation
… UpdateCheckoutUrl
mikeymike
previously approved these changes
Nov 24, 2026
mikeymike
approved these changes
Nov 24, 2026
This branch was successfully deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
With the
py.typedmarker added in #180, type checkers only treat a name as public from a module if the module re-exports it. Before that, they didn't apply this rule to the SDK, so any name a module imported could be imported from it. On main, 2,457 such imports now fail with pyright's default settings and withmypy --strict, for example:Changes
__init__.pynow uses theName as Nameform (including the three relative imports), the same change feat: Add py.typed marker and fix type annotations #180 made to__init__.pyfiles. The diff is mechanical: apart from the seven modules in the next two points, every changed module has the same syntax tree as on main once theasaliases are removed, so runtime behaviour is unchanged.UpdateCheckoutUrl.pyimportsUndefinedagain. fix: Require default_url when updating the checkout URL #183 removed it oncedefault_urlbecame required, sofrom paddle_billing.Resources.Settings.Operations.UpdateCheckoutUrl import UndefinedraisesImportErroron main. It's kept the same way feat: Add py.typed marker and fix type annotations #180 keptReportTypeandReportFilterinCreateReport.py.NotificationEntityinEntities/Event.py,Entities/Notifications/NotificationEvent.pyandEntities/SimulationRunEvent.py,PriceIncludesandProductIncludesinListPrices.pyandListProducts.py, andPaymentMethodDeletedEntityinNotifications/Events/PaymentMethodDeleted.py. Type checkers never treat a renamed import as public, and__all__would change whatimport *returns, so each is imported under a private name and assigned to the public one, for examplePriceIncludes = _PriceIncludes. It's the same class, andimport *from these modules gives the same names as on main.tests/Unit/test_PackageExports.pynow checks every module: a plain SDK import, or a renamed one whose name doesn't start with_, anywhere in the package fails the test. It also looks inside module-levelifandtryblocks, exceptif TYPE_CHECKING:.What this makes public
This is deliberate: every name a module imports from the SDK is now public from that module, including internal helpers such as
OptionsandResponseParserfrompaddle_billing.Client. All of these could be imported beforepy.typed, so this keeps that behaviour rather than choosing a smaller set. Removing one of these imports later is a breaking change for type checkers, so narrowing what's public is left for a major release.Re-exporting from
paddle_billing.Clientis a convenience: each resource client can also be imported from the module that defines it, for examplefrom paddle_billing.Resources.Customers.CustomersClient import CustomersClient.Not changed
TYPE_CHECKING, which aren't importable at runtime.datetimeorAny.How this was checked
Every SDK name importable from every module of the released 1.18.0 package was listed at runtime: 3,850 names across 876 modules. An import of each was then run and type-checked against main and against this branch:
mypy --stricterrorsUndefined)Tests, black, flake8 and
mypy paddle_billingpass.No changelog entry: this keeps imports working that worked in 1.18.0, so it's part of the unreleased
py.typedchange.