Skip to content
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

Stale attrs dependency, attrs>=22.2 required #1084

Closed
astralblue opened this issue Jul 28, 2024 · 0 comments · Fixed by #1184 or #1181
Closed

Stale attrs dependency, attrs>=22.2 required #1084

astralblue opened this issue Jul 28, 2024 · 0 comments · Fixed by #1184 or #1181

Comments

@astralblue
Copy link

Describe the bug
#1009 introduced an alias= to the generated attrs fields. The alias= support needs attrs version 22.2 or higher. However, openapi-python-client emits attrs>=21.3.0. The generated code fails to import against attrs 21.* and 22.1.* due to the missing field(alias=...) kwarg in those versions.

FWIW, existing attrs dependency declarations include:

$ git grep 'attrs\s*>'
end_to_end_tests/metadata_snapshots/pdm.pyproject.toml:    "attrs>=21.3.0",
end_to_end_tests/metadata_snapshots/setup.py:    install_requires=["httpx >= 0.20.0, < 0.28.0", "attrs >= 21.3.0", "python-dateutil >= 2.8.0, < 3"],
integration-tests/pyproject.toml:    "attrs>=21.3.0",
openapi_python_client/templates/pyproject.toml.jinja:    "attrs>=21.3.0",
openapi_python_client/templates/setup.py.jinja:    install_requires=["httpx >= 0.20.0, < 0.28.0", "attrs >= 21.3.0", "python-dateutil >= 2.8.0, < 3"],
pyproject.toml:    "attrs>=21.3.0",

OpenAPI Spec File
https://raw.githubusercontent.com/Karma3Labs/go-eigentrust/bdf0019ffdcd699053dcf7866bf842640a78b08a/pkg/basic/openapi.yaml

Desktop (please complete the following information):

  • OS: Ubuntu 24.04
  • Python Version: 3.8.19
  • openapi-python-client version 0.21.2
@dbanty dbanty closed this as completed in 7225f0e Dec 24, 2024
@knope-bot knope-bot bot mentioned this issue Dec 24, 2024
github-merge-queue bot pushed a commit that referenced this issue Dec 24, 2024
> [!IMPORTANT]
> Merging this pull request will create this release

## Breaking Changes

### Delete fewer files with `--overwrite`

`--overwrite` will no longer delete the entire output directory before
regenerating. Instead, it will only delete
specific, known directories within that directory. Right now, that is
only the generated `models` and `api` directories.

Other generated files, like `README.md`, will be overwritten. Extra
files and directories outside of those listed above
will be left untouched, so you can any extra modules or files around
while still updating `pyproject.toml` automatically.

Closes #1105.

## Features

- Support httpx 0.28 (#1172)

### Add `generate_all_tags` config option

You can now, optionally, generate **duplicate** endpoint
functions/modules using _every_ tag for an endpoint,
not just the first one, by setting `generate_all_tags: true` in your
configuration file.

## Fixes

- Support Typer 0.14 and 0.15 (#1173)

### Fix minimum `attrs` version

The minimum `attrs` dependency version was incorrectly set to 21.3.0.
This has been corrected to 22.2.0, the minimum
supported version since `openapi-python-client` 0.19.1.

Closes #1084, thanks @astralblue!

### Fix compatibility with Pydantic 2.10+

#1176 by @Viicos

Set `defer_build` to models that we know will fail to build, and call
`model_rebuild`
in the `__init__.py` file.

Co-authored-by: knope-bot[bot] <152252888+knope-bot[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant