Skip to content

Issues using main branch with pip only #119

Closed
@multimeric

Description

@multimeric

Describe the bug
I hit numerous bugs when installing this library and also the generated client library when using only pip, and not poetry.

To Reproduce
Trying to install:

  1. python -m pip venv venv
  2. source venv/bin/activate
  3. pip install -U git+https://github.com/triaxtec/openapi-python-client.git
    At this point, it doesn't seem to understand the project metadata, so I get:
Building wheels for collected packages: UNKNOWN
  Building wheel for UNKNOWN (PEP 517) ... done
  Created wheel for UNKNOWN: filename=UNKNOWN-0.0.0-py3-none-any.whl size=1796 sha256=92844cf4cacb74a84fbabc818a001c29fe7a6faff33c6489dfa821a73ac35332
  Stored in directory: /tmp/pip-ephem-wheel-cache-kywezuda/wheels/dd/d2/00/2654ebf9b83eac4fd4dd88ce1bbd33bb59776258f92e53c164
Successfully built UNKNOWN
Installing collected packages: UNKNOWN
  Attempting uninstall: UNKNOWN
    Found existing installation: UNKNOWN 0.0.0
    Uninstalling UNKNOWN-0.0.0:
      Successfully uninstalled UNKNOWN-0.0.0
Successfully installed UNKNOWN-0.0.0

This also doesn't seem to install the openapi-python-client executable.

If I instead setup poetry and:

  1. poetry add git+https://github.com/triaxtec/openapi-python-client.git@main
  2. openapi-python-client generate --url https://api.biocontainers.pro/ga4gh/trs/v2/openapi.json
    Here, I get:
Traceback (most recent call last):
  File "/tmp/tmp.pvDxeqwflB/venv/bin/openapi-python-client", line 6, in <module>
    from pkg_resources import load_entry_point
  File "/tmp/tmp.pvDxeqwflB/venv/lib/python3.7/site-packages/pkg_resources/__init__.py", line 3261, in <module>
    @_call_aside
  File "/tmp/tmp.pvDxeqwflB/venv/lib/python3.7/site-packages/pkg_resources/__init__.py", line 3245, in _call_aside
    f(*args, **kwargs)
  File "/tmp/tmp.pvDxeqwflB/venv/lib/python3.7/site-packages/pkg_resources/__init__.py", line 3274, in _initialize_master_working_set
    working_set = WorkingSet._build_master()
  File "/tmp/tmp.pvDxeqwflB/venv/lib/python3.7/site-packages/pkg_resources/__init__.py", line 584, in _build_master
    ws.require(__requires__)
  File "/tmp/tmp.pvDxeqwflB/venv/lib/python3.7/site-packages/pkg_resources/__init__.py", line 901, in require
    needed = self.resolve(parse_requirements(requirements))
  File "/tmp/tmp.pvDxeqwflB/venv/lib/python3.7/site-packages/pkg_resources/__init__.py", line 787, in resolve
    raise DistributionNotFound(req, requirers)
pkg_resources.DistributionNotFound: The 'importlib_metadata<2.0.0,>=1.6.0' distribution was not found and is required by openapi-python-client
  1. pip install importlib_metadata -U
  2. openapi-python-client generate --url https://api.biocontainers.pro/ga4gh/trs/v2/openapi.json again
    This gives me:
Traceback (most recent call last):
  File "/tmp/tmp.pvDxeqwflB/venv/bin/openapi-python-client", line 11, in <module>
    load_entry_point('openapi-python-client', 'console_scripts', 'openapi-python-client')()
  File "/tmp/tmp.pvDxeqwflB/venv/lib/python3.7/site-packages/pkg_resources/__init__.py", line 490, in load_entry_point
    return get_distribution(dist).load_entry_point(group, name)
  File "/tmp/tmp.pvDxeqwflB/venv/lib/python3.7/site-packages/pkg_resources/__init__.py", line 2862, in load_entry_point
    return ep.load()
  File "/tmp/tmp.pvDxeqwflB/venv/lib/python3.7/site-packages/pkg_resources/__init__.py", line 2462, in load
    return self.resolve()
  File "/tmp/tmp.pvDxeqwflB/venv/lib/python3.7/site-packages/pkg_resources/__init__.py", line 2468, in resolve
    module = __import__(self.module_name, fromlist=['__name__'], level=0)
  File "/tmp/tmp.pvDxeqwflB/venv/src/openapi-python-client/openapi_python_client/__init__.py", line 17, in <module>
    from .parser import GeneratorData, import_string_from_reference
  File "/tmp/tmp.pvDxeqwflB/venv/src/openapi-python-client/openapi_python_client/parser/__init__.py", line 5, in <module>
    from .openapi import GeneratorData, import_string_from_reference
  File "/tmp/tmp.pvDxeqwflB/venv/src/openapi-python-client/openapi_python_client/parser/openapi.py", line 8, in <module>
    from .. import schema as oai
  File "/tmp/tmp.pvDxeqwflB/venv/src/openapi-python-client/openapi_python_client/schema/__init__.py", line 41, in <module>
    from .components import Components
  File "/tmp/tmp.pvDxeqwflB/venv/src/openapi-python-client/openapi_python_client/schema/components.py", line 3, in <module>
    from pydantic import BaseModel
ModuleNotFoundError: No module named 'pydantic'
  1. poetry add pydantic
  2. openapi-python-client generate --url https://api.biocontainers.pro/ga4gh/trs/v2/openapi.json again, now gives me:
Traceback (most recent call last):
  File "/tmp/tmp.pvDxeqwflB/venv/bin/openapi-python-client", line 6, in <module>
    from pkg_resources import load_entry_point
  File "/tmp/tmp.pvDxeqwflB/venv/lib/python3.7/site-packages/pkg_resources/__init__.py", line 3261, in <module>
    @_call_aside
  File "/tmp/tmp.pvDxeqwflB/venv/lib/python3.7/site-packages/pkg_resources/__init__.py", line 3245, in _call_aside
    f(*args, **kwargs)
  File "/tmp/tmp.pvDxeqwflB/venv/lib/python3.7/site-packages/pkg_resources/__init__.py", line 3274, in _initialize_master_working_set
    working_set = WorkingSet._build_master()
  File "/tmp/tmp.pvDxeqwflB/venv/lib/python3.7/site-packages/pkg_resources/__init__.py", line 584, in _build_master
    ws.require(__requires__)
  File "/tmp/tmp.pvDxeqwflB/venv/lib/python3.7/site-packages/pkg_resources/__init__.py", line 901, in require
    needed = self.resolve(parse_requirements(requirements))
  File "/tmp/tmp.pvDxeqwflB/venv/lib/python3.7/site-packages/pkg_resources/__init__.py", line 787, in resolve
    raise DistributionNotFound(req, requirers)
pkg_resources.DistributionNotFound: The 'importlib_metadata<2.0.0,>=1.6.0' distribution was not found and is required by openapi-python-client
  1. pip install 'importlib_metadata<2.0.0,>=1.6.0'
  2. openapi-python-client generate --url https://api.biocontainers.pro/ga4gh/trs/v2/openapi.json. This time it works
  3. Finally, I try to install the generated code using pip:
pip install ga4gh-tool-discovery-api-client/
Processing ./ga4gh-tool-discovery-api-client
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
    Preparing wheel metadata ... done
Building wheels for collected packages: UNKNOWN
  Building wheel for UNKNOWN (PEP 517) ... done
  Created wheel for UNKNOWN: filename=UNKNOWN-0.0.0-py3-none-any.whl size=980 sha256=cd1f4deff053e280188e11954b12a08920fa7bcff7a3dd3e08525a6bf5fab62f
  Stored in directory: /home/michael/.cache/pip/wheels/08/8a/62/8b06f89059e834612fc1f707dc3644ba65660421ddbf78c83a
Successfully built UNKNOWN
Installing collected packages: UNKNOWN
  Attempting uninstall: UNKNOWN
    Found existing installation: UNKNOWN 0.0.0
    Uninstalling UNKNOWN-0.0.0:
      Successfully uninstalled UNKNOWN-0.0.0
Successfully installed UNKNOWN-0.0.0

Expected behavior
I would hope that simply running these commands would generate and install the API client:

pip install git+https://github.com/triaxtec/openapi-python-client.git
openapi-python-client generate --url https://api.biocontainers.pro/ga4gh/trs/v2/openapi.json
pip install ga4gh-tool-discovery-api-client

OpenAPI Spec File
https://api.biocontainers.pro/ga4gh/trs/v2/openapi.json

Desktop (please complete the following information):

  • OS: Ubuntu 18.04
  • Python Version: 3.7.8
  • openapi-python-client version: 0.4.2 3afa089
  • pip: 20.1.1

Metadata

Metadata

Assignees

No one assigned

    Labels

    🐞bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions