Skip to content

[python] Import aiohttp-retry lazily - #25677

Open
timonrieger wants to merge 2 commits into
OpenAPITools:masterfrom
timonrieger:python-lazy-aiohttp-retry
Open

timonrieger wants to merge 2 commits into
OpenAPITools:masterfrom
timonrieger:python-lazy-aiohttp-retry

Conversation

@timonrieger

@timonrieger timonrieger commented Nov 14, 2026 •

Copy link
Copy Markdown
Contributor

aiohttp-retries is only used if retries are configured. respect that by moving it to an optional requirement and import it only when needed.

PR checklist

  • Read the contribution guidelines.
  • Run the following to build the project and update samples:
    ./mvnw clean package || exit
    ./bin/generate-samples.sh ./bin/configs/*.yaml || exit
    ./bin/utils/export_docs_generators.sh || exit
    
    (For Windows users, please run the script in WSL)
    Commit all changed files.
    This is important, as CI jobs will verify all generator outputs of your HEAD commit as it would merge with master.
    These must match the expectations made by your contribution.
    You may regenerate an individual generator by passing the relevant config(s) as an argument to the script, for example ./bin/generate-samples.sh bin/configs/java*.
    IMPORTANT: Do NOT purge/delete any folders/files (e.g. tests) when regenerating the samples as manually written tests may be removed.
  • If your PR is targeting a particular programming language, @mention the technical committee members, so they are more likely to review the pull request.

Summary by cubic

Imports aiohttp-retry lazily and makes it an optional dependency so generated async Python clients no longer need it unless retries are configured.

  • Moves the aiohttp_retry import into the retry configuration branch and gates type annotations behind TYPE_CHECKING.
  • Registers aiohttp-retry as an optional retry extra in pyproject.toml and setup.py, and removes it from the default requirements.
  • Clients that never configure retries no longer need aiohttp-retry installed.

Written for commit 34bcb29. Summary will update on new commits.

View guided diff

@timonrieger timonrieger changed the title [python] Import aiohttp-retry lazily so it is only needed when retries are configured [python] Import aiohttp-retry lazily Nov 14, 2026

@cubic-dev-ai cubic-dev-ai Bot left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

All reported issues were addressed across 4 files

Reply with feedback, questions, or to request a fix.

View guided diff | Re-trigger cubic

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

1 issue found across 9 files (changes from recent commits).

Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="modules/openapi-generator/src/main/resources/python/pyproject.mustache">

<violation number="1" location="modules/openapi-generator/src/main/resources/python/pyproject.mustache:94">
P2: The generated README's install commands do not select this extra. Users who configure retries then hit `ModuleNotFoundError`; document the `[retry]` install command.</violation>
</file>

Reply with feedback, questions, or to request a fix.

View guided diff | Re-trigger cubic

{{#asyncio}}

[project.optional-dependencies]
retry = ["aiohttp-retry (>=2.8.3)"]

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P2: The generated README's install commands do not select this extra. Users who configure retries then hit ModuleNotFoundError; document the [retry] install command.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. At modules/openapi-generator/src/main/resources/python/pyproject.mustache, line 94:

<comment>The generated README's install commands do not select this extra. Users who configure retries then hit `ModuleNotFoundError`; document the `[retry]` install command.</comment>

<file context>
@@ -84,6 +88,11 @@ dependencies = [
+{{#asyncio}}
+
+[project.optional-dependencies]
+retry = ["aiohttp-retry (>=2.8.3)"]
+{{/asyncio}}
 
</file context>

This branch has not been deployed

No deployments
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