Intro to graphql python/strawberry

course is great so far!
having an issue with openapi-python-client generating the spotify-client
when I run “openapi-python-client generate --meta none --path data/openapi.json”
I can’t get past this error:

Error(s) encountered while generating, client was not created

ruff failed

models\ F821 Undefined name cast
models\ F821 Undefined name cast
models\ F821 Undefined name cast
Found 1929 errors (1926 fixed, 3 remaining).

Screenshot 2024-07-06 061915

unsure on both ruff and what/where ‘cast’ should be?

1 Like

Yep, me too. It’s a great course but now I’m stuck with “Undefined name cast”.

Without rm -rf mock_spotify_rest_api_client, ‘cast’ does not exist in the source tree.
% rm -rf mock_spotify_rest_api_client && grep -r cast .
# nothing found

Ubuntu 22.04.4 LTS within WSL2 / Windows 11
Python 3.12.4
openapi-python-client version: 0.21.1

Apollo GraphQL deacons, please advise us lowly acolytes.

If you need further info, please inquire.

Thanks and have a wonderful day!

I dug into this a bit further. While ruff did have a similar issue once, in this case the generated python files are missing: “from typing import cast”

SOLVED: Simply revert back to 0.18.0 version of openapi-python-client. It works fine then. Have a wonderful day!