[Pulp-list] Pulp 3 Python client

Dennis Kliban dkliban at redhat.com
Fri Oct 25 07:51:00 UTC 2019


The docs are out of date[0]. The bindings should use an OpenAPI schema
requested with the 'bindings' GET parameter. Here is an example[1]. I'll
update the docs.

[0]
https://docs.pulpproject.org/en/3.0/nightly/integration-guide/index.html#client-in-a-language-of-your-choice
[1]
https://github.com/pulp/pulp-openapi-generator/blob/master/generate.sh#L7

On Tue, Oct 22, 2019 at 11:04 AM Bin Li (BLOOMBERG/ 120 PARK) <
bli111 at bloomberg.net> wrote:

> I tried adding the client api by using openapi generator and installing
> from pypi. It looks the client api method name are different.
>
> the pypi module has short name.
> >>> dir(pulpcore.client.pulp_rpm.api.RemotesRpmApi)
> ['__class__', '__delattr__', '__dict__', '__dir__', '__doc__', '__eq__',
> '__format__', '__ge__', '__getattribute__', '__gt__', '__hash__',
> '__init__', '__init_subclass__', '__le__', '__lt__', '__module__',
> '__ne__', '__new__', '__reduce__', '__reduce_ex__', '__repr__',
> '__setattr__', '__sizeof__', '__str__', '__subclasshook__', '__weakref__',
> 'create', 'create_with_http_info', 'delete', 'delete_with_http_info',
> 'list', 'list_with_http_info', 'partial_update',
> 'partial_update_with_http_info', 'read', 'read_with_http_info', 'sync',
> 'sync_with_http_info', 'update', 'update_with_http_info']
>
>
> Openapi generated classes has longer name.
> >>> dir(pulp3_client.api.RemotesRpmApi)
> ['__class__', '__delattr__', '__dict__', '__dir__', '__doc__', '__eq__',
> '__format__', '__ge__', '__getattribute__', '__gt__', '__hash__',
> '__init__', '__init_subclass__', '__le__', '__lt__', '__module__',
> '__ne__', '__new__', '__reduce__', '__reduce_ex__', '__repr__',
> '__setattr__', '__sizeof__', '__str__', '__subclasshook__', '__weakref__',
> 'remotes_rpm_rpm_create', 'remotes_rpm_rpm_create_with_http_info',
> 'remotes_rpm_rpm_delete', 'remotes_rpm_rpm_delete_with_http_info',
> 'remotes_rpm_rpm_list', 'remotes_rpm_rpm_list_with_http_info',
> 'remotes_rpm_rpm_partial_update',
> 'remotes_rpm_rpm_partial_update_with_http_info', 'remotes_rpm_rpm_read',
> 'remotes_rpm_rpm_read_with_http_info', 'remotes_rpm_rpm_sync',
> 'remotes_rpm_rpm_sync_with_http_info', 'remotes_rpm_rpm_update',
> 'remotes_rpm_rpm_update_with_http_info']
>
>
> I am wondering why they are different and which one I should use?
>
> Thanks
>
>
> From: daviddavis at redhat.com At: 10/17/19 11:16:35
> To: Bin Li (BLOOMBERG/ 120 PARK ) <bli111 at bloomberg.net>
> Cc: dkliban at redhat.com, pulp-list at redhat.com
> Subject: Re: [Pulp-list] Pulp 3 Python client
>
> Yes, up until we the 3.0 GA in December, we're not supporting release to
> release upgrades. So upgrading from release to release (or nightly to
> nightly) is not guaranteed to work.
>
> David
>
>
> On Thu, Oct 17, 2019 at 11:12 AM Bin Li (BLOOMBERG/ 120 PARK) <
> bli111 at bloomberg.net> wrote:
>
>> Yeah, I pulled nightly build and it worked. Thanks a lot. Do you know if
>> it is required to erase the database when update from previous nightly
>> build? I had some weird 500 errors until I drop all db tables and rerun the
>> migration.
>>
>> From: dkliban at redhat.com At: 10/16/19 12:29:21
>> To: Bin Li (BLOOMBERG/ 120 PARK ) <bli111 at bloomberg.net>
>> Cc: pulp-list at redhat.com
>> Subject: Re: [Pulp-list] Pulp 3 Python client
>>
>> I've just confirmed that the latest pulp-rpm-client package on PyPI no
>> longer has this problem. However, this latest package only works with the
>> code on master branch. A new pulp_rpm package should be published to PyPI
>> soon.
>>
>> On Tue, Oct 8, 2019 at 4:29 PM Dennis Kliban <dkliban at redhat.com> wrote:
>>
>>> This is a known problem with the OpenAPI schema[0]. Once the PRs for is
>>> 5550[1] are merged, a new version of the client will be published to PyPI
>>> and this problem will be resolved. I believe that should take place on
>>> October 9th[2].
>>>
>>> [0] https://pulp.plan.io/issues/5093
>>> [1] https://pulp.plan.io/issues/5550
>>> [2] https://www.redhat.com/archives/pulp-dev/2019-October/msg00031.html
>>>
>>> On Tue, Oct 8, 2019 at 2:13 PM Bin Li (BLOOMBERG/ 120 PARK) <
>>> bli111 at bloomberg.net> wrote:
>>>
>>>> I have tried to follow the blog
>>>> https://pulpproject.org/2018/09/04/generate-pulp-3-python-client-using-swagger-codegen/
>>>> and got a syntax error.
>>>> File
>>>> "/opt/utils/venv/pulp/3.6.5/lib64/python3.6/site-packages/pulp3_client/models/update_record.py",
>>>> line 79
>>>> def __init__(self, href=None, created=None, type=None, id=None,
>>>> updated_date=None, description=None, issued_date=None, fromstr=None,
>>>> status=None, title=None, summary=None, version=None, type=None,
>>>> severity=None, solution=None, release=None, rights=None, pushcount=None,
>>>> pkglist=None, references=None): # noqa: E501
>>>> ^
>>>> SyntaxError: duplicate argument 'type' in function definition
>>>>
>>>> Type is declared twice in the __init__. There is a duplicate key 'type'
>>>> in attribute_map models/update_record.py.
>>>>
>>>> attribute_map = {
>>>> 'href': '_href',
>>>> 'created': '_created',
>>>> 'type': '_type',
>>>> 'id': 'id',
>>>> 'updated_date': 'updated_date',
>>>> 'description': 'description',
>>>> 'issued_date': 'issued_date',
>>>> 'fromstr': 'fromstr',
>>>> 'status': 'status',
>>>> 'title': 'title',
>>>> 'summary': 'summary',
>>>> 'version': 'version',
>>>> 'type': 'type',
>>>> 'severity': 'severity',
>>>> 'solution': 'solution',
>>>> 'release': 'release',
>>>> 'rights': 'rights',
>>>> 'pushcount': 'pushcount',
>>>> 'pkglist': 'pkglist',
>>>> 'references': 'references'
>>>> }
>>>>
>>>> Anyone knows how this can be fixed?
>>>>
>>>> Thanks
>>>>
>>>> _______________________________________________
>>>> Pulp-list mailing list
>>>> Pulp-list at redhat.com
>>>> https://www.redhat.com/mailman/listinfo/pulp-list
>>>
>>>
>> _______________________________________________
>> Pulp-list mailing list
>> Pulp-list at redhat.com
>> https://www.redhat.com/mailman/listinfo/pulp-list
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listman.redhat.com/archives/pulp-list/attachments/20191025/b92ccb4e/attachment.htm>


More information about the Pulp-list mailing list