Skip to content

Stopped working after 0.10.2 #479

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

Closed
chamini2 opened this issue Aug 19, 2021 · 5 comments · Fixed by #489
Closed

Stopped working after 0.10.2 #479

chamini2 opened this issue Aug 19, 2021 · 5 comments · Fixed by #489
Assignees
Labels
🐞bug Something isn't working
Milestone

Comments

@chamini2
Copy link

Describe the bug
After the version 0.10.2 (inlcuding that one), I cannot generate the python client.

To Reproduce
Steps to reproduce the behavior:

$ pipx run --spec openapi-python-client==0.10.1 openapi-python-client generate --path target/openapi.json

Generating open-api-definition-client
Warning(s) encountered while generating. Client was generated, but some pieces may be missing

WARNING parsing PUT /feature-groups/schedule/offline-to-online-etl/bigquery-firestore within feature_group_load_controller.

Cannot parse response for status code 200, response will be ommitted from generated client

Response(description='OK', headers=None, content={'*/*': MediaType(media_type_schema=Schema(title=None, multipleOf=None, maximum=None, exclusiveMaximum=None, minimum=None, exclusiveMinimum=None, maxLength=None, minLength=None, pattern=None, maxItems=None, minItems=None, uniqueItems=None, maxProperties=None, minProperties=None, required=None, enum=None, type='array', allOf=None, oneOf=[], anyOf=[], schema_not=None, items=Reference(ref='#/components/schemas/FeatureGroupLoad'), properties=None, additionalProperties=None, description=None, schema_format=None, default=None, nullable=False, discriminator=None, readOnly=None, writeOnly=None, xml=None, externalDocs=None, example=None, deprecated=None), example=None, examples=None, encoding=None)}, links=None)

WARNING parsing GET /feature-groups/{featureGroup}/load within feature_group_load_controller.

Cannot parse response for status code 200, response will be ommitted from generated client

Response(description='OK', headers=None, content={'*/*': MediaType(media_type_schema=Reference(ref='#/components/schemas/FeatureGroupLoad'), example=None, examples=None, encoding=None)}, links=None)

WARNING parsing GET /service-account/notebook-role/status within service_account_status_controller.

Cannot parse response for status code 200, response will be ommitted from generated client

Response(description='OK', headers=None, content={'text/plain': MediaType(media_type_schema=Schema(title=None, multipleOf=None, maximum=None, exclusiveMaximum=None, minimum=None, exclusiveMinimum=None, maxLength=None, minLength=None, pattern=None, maxItems=None, minItems=None, uniqueItems=None, maxProperties=None, minProperties=None, required=None, enum=None, type='string', allOf=None, oneOf=[], anyOf=[], schema_not=None, items=None, properties=None, additionalProperties=None, description=None, schema_format=None, default=None, nullable=False, discriminator=None, readOnly=None, writeOnly=None, xml=None, externalDocs=None, example=None, deprecated=None), example=None, examples=None, encoding=None)}, links=None)

WARNING parsing GET /service-account/api-client-role/status within service_account_status_controller.

Cannot parse response for status code 200, response will be ommitted from generated client

Response(description='OK', headers=None, content={'text/plain': MediaType(media_type_schema=Schema(title=None, multipleOf=None, maximum=None, exclusiveMaximum=None, minimum=None, exclusiveMinimum=None, maxLength=None, minLength=None, pattern=None, maxItems=None, minItems=None, uniqueItems=None, maxProperties=None, minProperties=None, required=None, enum=None, type='string', allOf=None, oneOf=[], anyOf=[], schema_not=None, items=None, properties=None, additionalProperties=None, description=None, schema_format=None, default=None, nullable=False, discriminator=None, readOnly=None, writeOnly=None, xml=None, externalDocs=None, example=None, deprecated=None), example=None, examples=None, encoding=None)}, links=None)

vs

pipx run --spec openapi-python-client==0.10.2 openapi-python-client generate --path target/openapi.json
Generating open-api-definition-client
Traceback (most recent call last):
  File "/Users/matteo/.local/pipx/.cache/6d25871679c6797/bin/openapi-python-client", line 8, in <module>
    sys.exit(app())
  File "/Users/matteo/.local/pipx/.cache/6d25871679c6797/lib/python3.9/site-packages/typer/main.py", line 214, in __call__
    return get_command(self)(*args, **kwargs)
  File "/Users/matteo/.local/pipx/.cache/6d25871679c6797/lib/python3.9/site-packages/click/core.py", line 829, in __call__
    return self.main(*args, **kwargs)
  File "/Users/matteo/.local/pipx/.cache/6d25871679c6797/lib/python3.9/site-packages/click/core.py", line 782, in main
    rv = self.invoke(ctx)
  File "/Users/matteo/.local/pipx/.cache/6d25871679c6797/lib/python3.9/site-packages/click/core.py", line 1259, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/Users/matteo/.local/pipx/.cache/6d25871679c6797/lib/python3.9/site-packages/click/core.py", line 1066, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/Users/matteo/.local/pipx/.cache/6d25871679c6797/lib/python3.9/site-packages/click/core.py", line 610, in invoke
    return callback(*args, **kwargs)
  File "/Users/matteo/.local/pipx/.cache/6d25871679c6797/lib/python3.9/site-packages/typer/main.py", line 497, in wrapper
    return callback(**use_params)  # type: ignore
  File "/Users/matteo/.local/pipx/.cache/6d25871679c6797/lib/python3.9/site-packages/openapi_python_client/cli.py", line 142, in generate
    errors = create_new_client(
  File "/Users/matteo/.local/pipx/.cache/6d25871679c6797/lib/python3.9/site-packages/openapi_python_client/__init__.py", line 322, in create_new_client
    return project.build()
  File "/Users/matteo/.local/pipx/.cache/6d25871679c6797/lib/python3.9/site-packages/openapi_python_client/__init__.py", line 113, in build
    self._reformat()
  File "/Users/matteo/.local/pipx/.cache/6d25871679c6797/lib/python3.9/site-packages/openapi_python_client/__init__.py", line 130, in _reformat
    subprocess.run(
  File "/usr/local/Cellar/[email protected]/3.9.6/Frameworks/Python.framework/Versions/3.9/lib/python3.9/subprocess.py", line 528, in run
    raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command 'autoflake -i -r --remove-all-unused-imports --remove-unused-variables --ignore-init-module-imports .' returned non-zero exit status 127.

Expected behavior
That it generates the client

OpenAPI Spec File

{"openapi":"3.0.1","info":{"title":"OpenAPI definition","version":"v0"},"servers":[{"url":"http://localhost:8080","description":"Generated server url"}],"paths":{"/feature-groups/schedule/offline-to-online-etl/bigquery-firestore":{"put":{"tags":["feature-group-load-controller"],"operationId":"bigQueryToFirestoreEtlList","requestBody":{"content":{"application/json":{"schema":{"type":"array","items":{"type":"string"}}}},"required":true},"responses":{"200":{"description":"OK","content":{"*/*":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/FeatureGroupLoad"}}}}}}}},"/feature-groups/config":{"get":{"tags":["feature-group-controller"],"operationId":"getConfig","responses":{"200":{"description":"OK","content":{"application/x-yaml":{"schema":{"$ref":"#/components/schemas/FeatureConfig"}},"application/json":{"schema":{"$ref":"#/components/schemas/FeatureConfig"}}}}}},"put":{"tags":["feature-group-controller"],"operationId":"createConfig","parameters":[{"name":"apply","in":"query","required":false,"schema":{"type":"boolean","default":false}}],"requestBody":{"content":{"application/x-yaml":{"schema":{"$ref":"#/components/schemas/FeatureConfig"}},"application/json":{"schema":{"$ref":"#/components/schemas/FeatureConfig"}}},"required":true},"responses":{"200":{"description":"OK","content":{"application/x-yaml":{"schema":{"$ref":"#/components/schemas/FeatureConfig"}},"application/json":{"schema":{"$ref":"#/components/schemas/FeatureConfig"}}}}}}},"/datasets/config":{"get":{"tags":["dataset-controller"],"operationId":"getConfig_1","responses":{"200":{"description":"OK","content":{"application/x-yaml":{"schema":{"$ref":"#/components/schemas/DatasetConfig"}},"application/json":{"schema":{"$ref":"#/components/schemas/DatasetConfig"}}}}}},"put":{"tags":["dataset-controller"],"operationId":"createConfig_1","parameters":[{"name":"apply","in":"query","required":false,"schema":{"type":"boolean","default":false}}],"requestBody":{"content":{"application/x-yaml":{"schema":{"$ref":"#/components/schemas/DatasetConfig"}},"application/json":{"schema":{"$ref":"#/components/schemas/DatasetConfig"}}},"required":true},"responses":{"200":{"description":"OK","content":{"application/x-yaml":{"schema":{"$ref":"#/components/schemas/DatasetConfig"}},"application/json":{"schema":{"$ref":"#/components/schemas/DatasetConfig"}}}}}}},"/datasets/{dataset}/data-frames":{"get":{"tags":["data-frame-controller"],"operationId":"getDataFramesPaged","parameters":[{"name":"dataset","in":"path","required":true,"schema":{"type":"string"}},{"name":"pageable","in":"query","required":true,"schema":{"$ref":"#/components/schemas/Pageable"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PageDataFrame"}}}}}},"post":{"tags":["data-frame-controller"],"operationId":"createDataFrame","parameters":[{"name":"dataset","in":"path","required":true,"schema":{"type":"string"}}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/DataFrame"}}},"required":true},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DataFrame"}}}}}}},"/service-account/notebook-role/status":{"get":{"tags":["service-account-status-controller"],"operationId":"getNotebookRoleStatus","responses":{"200":{"description":"OK","content":{"text/plain":{"schema":{"type":"string"}}}}}}},"/service-account/api-client-role/status":{"get":{"tags":["service-account-status-controller"],"operationId":"getApiRoleStatus","responses":{"200":{"description":"OK","content":{"text/plain":{"schema":{"type":"string"}}}}}}},"/feature-groups":{"get":{"tags":["feature-group-controller"],"operationId":"getFeatures","parameters":[{"name":"pageable","in":"query","required":true,"schema":{"$ref":"#/components/schemas/Pageable"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PageFeatureGroup"}}}}}}},"/feature-groups/{featureGroup}/load":{"get":{"tags":["feature-group-load-controller"],"operationId":"getLoad","parameters":[{"name":"featureGroup","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"*/*":{"schema":{"$ref":"#/components/schemas/FeatureGroupLoad"}}}}}}},"/data-frames/{dataFrame}":{"get":{"tags":["data-frame-controller"],"operationId":"getDataFrame","parameters":[{"name":"dataFrame","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DataFrame"}}}}}}}},"components":{"schemas":{"FeatureGroupLoad":{"type":"object","properties":{"feature_group_name":{"type":"string"},"run_status":{"$ref":"#/components/schemas/RunStatusFirestoreCollectionReference"}}},"FirestoreCollectionReference":{"type":"object","properties":{"fields":{"type":"array","items":{"$ref":"#/components/schemas/StoreField"}},"store_name":{"type":"string"},"entity_id_field":{"$ref":"#/components/schemas/StoreField"},"timestamp_field":{"$ref":"#/components/schemas/StoreField"},"store_type":{"type":"string","readOnly":true,"enum":["BIGQUERY","FIRESTORE"]}}},"RunStatusFirestoreCollectionReference":{"required":["status"],"type":"object","properties":{"runId":{"type":"string","writeOnly":true},"status":{"type":"string","enum":["PENDING","RUNNING","FAILED","DONE"]},"started_at":{"type":"string","format":"date-time"},"ended_at":{"type":"string","format":"date-time"},"detail":{"type":"string"},"store_reference":{"$ref":"#/components/schemas/FirestoreCollectionReference"},"table_location":{"$ref":"#/components/schemas/TableLocation"}}},"StoreField":{"type":"object","properties":{"feature_group_name":{"type":"string"},"feature_name":{"type":"string"},"feature_path":{"type":"string"}}},"TableLocation":{"type":"object","properties":{"version":{"type":"string"},"source_type":{"type":"string","enum":["BIGQUERY","FIRESTORE"]},"table":{"type":"string"}}},"FeatureConfig":{"required":["feature_groups"],"type":"object","properties":{"feature_groups":{"type":"array","items":{"$ref":"#/components/schemas/FeatureGroup"}}}},"FeatureField":{"required":["name"],"type":"object","properties":{"name":{"type":"string"},"description":{"type":"string"}}},"FeatureGroup":{"required":["entity","entity_field","features","name","owner","query","source","timestamp_field"],"type":"object","properties":{"name":{"pattern":"^[a-zA-Z][a-zA-Z0-9_]{2,63}$","type":"string"},"owner":{"type":"string"},"description":{"type":"string"},"entity":{"type":"string"},"entity_field":{"type":"string"},"timestamp_field":{"type":"string"},"source":{"$ref":"#/components/schemas/Source"},"query":{"type":"string"},"features":{"type":"array","items":{"$ref":"#/components/schemas/FeatureField"}}}},"Source":{"required":["type"],"type":"object","properties":{"type":{"type":"string","enum":["BIGQUERY","DATAFLOW"]},"opts":{"$ref":"#/components/schemas/SourceOpts"}}},"SourceOpts":{"required":["entity_field","table","timestamp_field"],"type":"object","properties":{"table":{"type":"string"},"entity_field":{"type":"string"},"timestamp_field":{"type":"string"}}},"Dataset":{"required":["feature_groups","name","owner"],"type":"object","properties":{"name":{"pattern":"^[a-zA-Z][a-zA-Z0-9_]{2,63}$","type":"string"},"owner":{"type":"string"},"description":{"type":"string"},"feature_groups":{"type":"array","items":{"$ref":"#/components/schemas/DatasetFeatureGroup"}}}},"DatasetConfig":{"required":["dataframe_configurations"],"type":"object","properties":{"dataframe_configurations":{"type":"array","items":{"$ref":"#/components/schemas/Dataset"}}}},"DatasetFeatureGroup":{"required":["features","name"],"type":"object","properties":{"name":{"type":"string"},"features":{"uniqueItems":true,"type":"array","items":{"type":"string"}}}},"BigQueryTableReference":{"type":"object","properties":{"project_id":{"type":"string"},"dataset_name":{"type":"string"},"table_name":{"type":"string"},"entity_id_field":{"$ref":"#/components/schemas/StoreField"},"timestamp_field":{"$ref":"#/components/schemas/StoreField"},"fields":{"type":"array","items":{"$ref":"#/components/schemas/StoreField"}},"store_type":{"type":"string","readOnly":true,"enum":["BIGQUERY","FIRESTORE"]}}},"DataFrame":{"required":["label","name"],"type":"object","properties":{"name":{"pattern":"^[a-zA-Z][a-zA-Z0-9_]{2,63}$","type":"string"},"label":{"type":"string"},"run_status":{"$ref":"#/components/schemas/RunStatusBigQueryTableReference"}}},"RunStatusBigQueryTableReference":{"required":["status"],"type":"object","properties":{"runId":{"type":"string","writeOnly":true},"status":{"type":"string","enum":["PENDING","RUNNING","FAILED","DONE"]},"started_at":{"type":"string","format":"date-time"},"ended_at":{"type":"string","format":"date-time"},"detail":{"type":"string"},"store_reference":{"$ref":"#/components/schemas/BigQueryTableReference"},"table_location":{"$ref":"#/components/schemas/TableLocation"}}},"Pageable":{"type":"object","properties":{"page":{"minimum":0,"type":"integer","format":"int32"},"size":{"minimum":1,"type":"integer","format":"int32"},"sort":{"type":"array","items":{"type":"string"}}}},"PageFeatureGroup":{"type":"object","properties":{"total_pages":{"type":"integer","format":"int32"},"total_elements":{"type":"integer","format":"int64"},"number_of_elements":{"type":"integer","format":"int32"},"number":{"type":"integer","format":"int32"},"first":{"type":"boolean"},"last":{"type":"boolean"},"sort":{"$ref":"#/components/schemas/Sort"},"size":{"type":"integer","format":"int32"},"content":{"type":"array","items":{"$ref":"#/components/schemas/FeatureGroup"}},"pageable":{"$ref":"#/components/schemas/Pageable"},"empty":{"type":"boolean"}}},"Sort":{"type":"object","properties":{"sorted":{"type":"boolean"},"unsorted":{"type":"boolean"},"empty":{"type":"boolean"}}},"PageDataFrame":{"type":"object","properties":{"total_pages":{"type":"integer","format":"int32"},"total_elements":{"type":"integer","format":"int64"},"number_of_elements":{"type":"integer","format":"int32"},"number":{"type":"integer","format":"int32"},"first":{"type":"boolean"},"last":{"type":"boolean"},"sort":{"$ref":"#/components/schemas/Sort"},"size":{"type":"integer","format":"int32"},"content":{"type":"array","items":{"$ref":"#/components/schemas/DataFrame"}},"pageable":{"$ref":"#/components/schemas/Pageable"},"empty":{"type":"boolean"}}}}}}

Desktop (please complete the following information):

  • OS: macos11.4
  • Python Version:
$ pipx --version
0.16.4
$ python --version
Python 2.7.17
  • openapi-python-client version 0.10.1, 0.10.2
@chamini2 chamini2 added the 🐞bug Something isn't working label Aug 19, 2021
@karolzlot
Copy link

I have exactly the same error. The same on Win10 and on WSL2-Ubuntu.

pipx run openapi-python-client --version
openapi-python-client version: 0.10.3

@dbanty
Copy link
Collaborator

dbanty commented Sep 5, 2021

It seems this might be an issue with calling subprocesses within pipx (which definitely used to work). As a workaround, if you install the external tools we need then this will run (e.g. pipx install black && pipx install isort && pipx install autoflake).

I'm working on a more permanent solution to this.

@dbanty
Copy link
Collaborator

dbanty commented Sep 5, 2021

I just realized the issue... in 0.10.2 I added check=True to the subprocess calls so that they wouldn't fail silently. I guess they used to be failing silently when used from pipx 🤦. I'm still going to try and find a way to successfully call these but at least in the worst case I can catch the errors and emit a warning.

@dbanty
Copy link
Collaborator

dbanty commented Sep 5, 2021

Unfortunately I didn't find a way to reliably call the integrations when using pipx run but it will no longer error out and will instead emit warnings for any post-hooks that are missing (so if you have black but not autoflake available on your PATH it'll still call black).

I also added a note to the README on how to properly use pipx install with the --include-deps option and you can now customize which commands run after generating with the config file (so you can turn them all off to ignore the warnings or tweak them as necessary).

In other words, once I release 0.10.4 it should be approximately back to how it worked before 0.10.2 and allow some more knobs to turn to tweak it to just how you like it.

@dbanty dbanty added this to the 0.10.4 milestone Sep 5, 2021
@dbanty dbanty self-assigned this Sep 5, 2021
dbanty added a commit that referenced this issue Sep 5, 2021
dbanty added a commit that referenced this issue Sep 5, 2021
dbanty added a commit that referenced this issue Sep 5, 2021
@chamini2
Copy link
Author

Tested it and it's working. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐞bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants