Skip to content

Conversation

@stephenfin
Copy link

@stephenfin stephenfin commented Jan 9, 2026

This is a collection of individual changes that collectively bump the minimum version of poetry to v2, remove stuff that was only applicable for older versions, and migrates things from flake8 to ruff. This PR is likely easier to review on a commit-by-commit basis: I've tried to provide as much detail as possible about what I've done and why I did it in each commit, and the whole thing should be fully bisectable.

  • [python] Re-generate samples
  • [python] Drop fallback for poetry 1.x
  • [python] Switch build backend to poetry-core
  • [python] Remove setup.py file
  • [python] Migrate from flake8 to ruff
  • [python] Stop generating requirements.txt files by default
  • bin/generate-samples: Remove warning about sleep

CC: @cbornet @tomplus @krjakbrjak @fa0311 @multani

PR checklist

  • Read the contribution guidelines.
  • Pull Request title clearly describes the work in the pull request and Pull Request description provides details about how to validate the work. Missing information here may result in delayed response from the community.
  • 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.
  • File the PR against the correct branch: master (upcoming 7.x.0 minor release - breaking changes with fallbacks), 8.0.x (breaking changes without fallbacks)
  • If your PR solves a reported issue, reference it using GitHub's linking syntax (e.g., having "fixes #123" present in the PR description)
  • 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

Drops Poetry v1 support and switches Python outputs to Poetry 2 with poetry-core, replacing setuptools scaffolding. Also migrates linting to Ruff and stops generating requirements.txt by default; samples and docs updated.

  • Refactors

    • Require Poetry 2; set build-backend to poetry-core (PEP 517/621).
    • Remove setup.py/setup.cfg and related README instructions.
    • Migrate from flake8 to ruff; add basic ruff lint config; update test deps.
    • Generate requirements.txt and test-requirements.txt only when generateSourceCodeOnly is enabled; otherwise rely on pyproject.toml.
    • Update CLI help to reference project name in pyproject.toml.
    • Regenerate Python samples; drop legacy files (requirements.txt, setup.* , poetry.lock) and stale docs/tests.
  • Migration

    • Use Poetry 2+ (poetry-core) for builds: pyproject.toml is the single source of truth.
    • Replace flake8/tox lint steps with ruff (ruff check/ruff format) in CI.
    • If you depended on setup.py/setup.cfg, move to pyproject.toml.
    • If you need requirements files, use source-only generation or create them from pyproject.

Written for commit ba7312c. Summary will update on new commits.

Done with:

  # remove existing artifacts
  rm -rf samples/client/echo_api/python/*
  rm -rf samples/client/echo_api/python-disallowAdditionalPropertiesIfNotPresent/*
  rm -rf samples/openapi3/client/petstore/python/*
  rm -rf samples/openapi3/client/petstore/python-aiohttp/*
  rm -rf samples/openapi3/client/petstore/python-httpx/*
  rm -rf samples/openapi3/client/petstore/python-lazyImports/*

  # restore manually added tests
  git checkout -f HEAD -- samples/client/echo_api/python/tests
  git checkout -f HEAD -- samples/client/echo_api/python-disallowAdditionalPropertiesIfNotPresent/tests
  git checkout -f HEAD -- samples/openapi3/client/petstore/python/tests
  git checkout -f HEAD -- samples/openapi3/client/petstore/python-aiohttp/tests
  git checkout -f HEAD -- samples/openapi3/client/petstore/python-httpx/tests
  git checkout -f HEAD -- samples/openapi3/client/petstore/python-lazyImports/tests

  # ...and test files
  git checkout -f HEAD -- samples/client/echo_api/python-disallowAdditionalPropertiesIfNotPresent/testfiles
  git checkout -f HEAD -- samples/openapi3/client/petstore/python/testfiles
  git checkout -f HEAD -- samples/openapi3/client/petstore/python-aiohttp/testfiles
  git checkout -f HEAD -- samples/openapi3/client/petstore/python-httpx/testfiles
  git checkout -f HEAD -- samples/openapi3/client/petstore/python-lazyImports/testfiles

  # regenerate samples
  /mvnw clean package -DskipTests
  ./bin/generate-samples.sh bin/configs/python.yaml bin/configs/python-echo-api.yaml

This highlights a number of file mode changes along with some tests and
docs for things that no longer exist in the relevant OpenAPI specs.

Signed-off-by: Stephen Finucane <[email protected]>
poetry 2.x is a year old now. We no longer need to keep this workaround.

Signed-off-by: Stephen Finucane <[email protected]>
This is more efficient and allows for seamless use of the package in
e.g. tox

Signed-off-by: Stephen Finucane <[email protected]>
We now use poetry so a setuptools setup.py file is unnecessary. The
READMEs are also updated to reflect this.

Signed-off-by: Stephen Finucane <[email protected]>
This has the advantage of being able to automatically format the
generated code for us as well as validating it. It also allows us to
remove the setup.cfg file.

Signed-off-by: Stephen Finucane <[email protected]>
We only need to generate these for convenience if we are not generating
a pyproject.toml file.

Signed-off-by: Stephen Finucane <[email protected]>
The sleep itself has been commented out for a long time (commit
04fa53b from September 2023, to be specific).

Signed-off-by: Stephen Finucane <[email protected]>
@stephenfin stephenfin force-pushed the python-drop-poetry-v1 branch from ba7312c to 10a6206 Compare January 9, 2026 18:11
@stephenfin stephenfin marked this pull request as ready for review January 9, 2026 18:11
Copy link

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

Choose a reason for hiding this comment

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

1 issue found across 97 files

Note: This PR contains a large number of files. cubic only reviews up to 75 files per PR, so some files may not have been reviewed.

Prompt for AI agents (all issues)

Check if these issues are valid — if so, understand the root cause of each and fix them.


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

<violation number="1" location="modules/openapi-generator/src/main/resources/python/README_onlypackage.mustache:27">
P2: Typo: `requirement.txt` should be `requirements.txt` (missing 's'). This inconsistency would confuse users trying to follow the installation instructions.</violation>
</file>

Since this is your first cubic review, here's how it works:

  • cubic automatically reviews your code and comments on bugs and improvements
  • Teach cubic by replying to its comments. cubic learns from your replies and gets better over time
  • Ask questions if you need clarification on any suggestion

Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.

* typing-extensions >= 4.7.1
This python library package is generated without supporting files like `pyproject.toml`.
To be able to use it, you will need these dependencies in your own package that uses this library.
Requirements files (`requirement.txt`, `test-requirements.txt`) are provided for this.
Copy link

@cubic-dev-ai cubic-dev-ai bot Jan 9, 2026

Choose a reason for hiding this comment

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

P2: Typo: requirement.txt should be requirements.txt (missing 's'). This inconsistency would confuse users trying to follow the installation instructions.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At modules/openapi-generator/src/main/resources/python/README_onlypackage.mustache, line 27:

<comment>Typo: `requirement.txt` should be `requirements.txt` (missing 's'). This inconsistency would confuse users trying to follow the installation instructions.</comment>

<file context>
@@ -16,36 +16,24 @@ The `{{packageName}}` package is automatically generated by the [OpenAPI Generat
-* typing-extensions >= 4.7.1
+This python library package is generated without supporting files like `pyproject.toml`.
+To be able to use it, you will need these dependencies in your own package that uses this library.
+Requirements files (`requirement.txt`, `test-requirements.txt`) are provided for this.
+
+```
</file context>
Suggested change
Requirements files (`requirement.txt`, `test-requirements.txt`) are provided for this.
Requirements files (`requirements.txt`, `test-requirements.txt`) are provided for this.
Fix with Cubic

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