Closed mjpieters closed 8 months ago
Perhaps regenerating would be a step too far; the new generator adds pydantic as a dependency to enforce type safety and correctness, so could radically alter how the library responds to types that may or may not be acceptable to the SDK now.
While looking into the codebase to potentially help out with PRs, I noticed that the
onepasswordconnectsdk.models.generator_recipe
module includes:The import is undeclared as a dependency of the project; the only reason this hasn't been an issue so far is because it is a transitive dependency for
python-dateutil
. There is no guarantee that all futurepython-dateutil
releases will includesix
as a dependency.The import can trivially be removed as connect-sdk-python now requires Python 3.7 and up; the following line would be equivalent, more efficient and removes the need to import
six
:I note that the specific OpenAPI code generator now only supports Python 3.7 and up, so you could just re-generate the code.
Another option is to use
pyupgrade
to rewrite the code for you to remove the Python 2.x support altogether, but you'll have to manually remove theimport six
line in that case, and pyupgrade would rewrite the above to usefor attr, _ in self.openapi_types.items():
, missing the iteration-over-dictionaries-yields-keys trick (the values are ignored in the loop, so.items()
is overkill here).