Skip to content

Issues using main branch with pip only #119

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
multimeric opened this issue Aug 4, 2020 · 3 comments
Closed

Issues using main branch with pip only #119

multimeric opened this issue Aug 4, 2020 · 3 comments
Labels
🐞bug Something isn't working

Comments

@multimeric
Copy link

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
@multimeric multimeric added the 🐞bug Something isn't working label Aug 4, 2020
dbanty added a commit that referenced this issue Aug 4, 2020
@dbanty
Copy link
Collaborator

dbanty commented Aug 4, 2020

Alright so as I read it, the issues are, in order:

  1. Cannot install openapi-python-client from source via pip. Unfortunately this would require us to commit a setup.py file which would have to be kept up to date with the pyproject.toml. Maybe a GitHub action or something could be used to keep it up to date.
  2. Pydantic missing from requirements- that is a mistake and I'm fixing it right now.
  3. importlib_metadata not getting installed. Not sure why this happens, it works in CI and, as far as I know, works with the published version. Maybe if we do the generated setup.py this will work as well.
  4. The ability to install generated clients without Poetry. Maybe we can have an option to generate a client with requirements.txt and setup.py instead of the pyproject.toml.

@dbanty
Copy link
Collaborator

dbanty commented Aug 4, 2020

@TMiguelT I opened #120 and #121 for the two pip enhancements. Pydantic should be properly included in metadata on main now. If that all sounds good to you you can go ahead and close this issue.

@multimeric
Copy link
Author

Yep, sounds good! The 3rd point is a bit confusing to solve, it might be to do with my environment more than anything.

@dbanty dbanty closed this as completed Aug 5, 2020
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

No branches or pull requests

2 participants