fossology / fossology-python

Python wrapper for the Fossology API
https://fossology.github.io/fossology-python
MIT License
17 stars 8 forks source link

API incompatibility with latest fossology release + fossology-python's release policy #48

Closed alpianon closed 3 years ago

alpianon commented 3 years ago

Today I installed fossology-python on a new machine but while testing it I got the following error when trying to upload a package:

Traceback (most recent call last):
  File "/usr/local/lib/python3.7/dist-packages/fossology/uploads.py", line 232, in upload_file
    upload = self.detail_upload(response.json()["message"], wait_time)
  File "/usr/local/lib/python3.7/dist-packages/tenacity/__init__.py", line 333, in wrapped_f
    return self(f, *args, **kw)
  File "/usr/local/lib/python3.7/dist-packages/tenacity/__init__.py", line 423, in __call__
    do = self.iter(retry_state=retry_state)
  File "/usr/local/lib/python3.7/dist-packages/tenacity/__init__.py", line 360, in iter
    return fut.result()
  File "/usr/lib/python3.7/concurrent/futures/_base.py", line 425, in result
    return self.__get_result()
  File "/usr/lib/python3.7/concurrent/futures/_base.py", line 384, in __get_result
    raise self._exception
  File "/usr/local/lib/python3.7/dist-packages/tenacity/__init__.py", line 426, in __call__
    result = fn(*args, **kwargs)
  File "/usr/local/lib/python3.7/dist-packages/fossology/uploads.py", line 62, in detail_upload
    return Upload.from_json(response.json())
  File "/usr/local/lib/python3.7/dist-packages/fossology/obj.py", line 428, in from_json
    return cls(**json_dict)
TypeError: __init__() missing 1 required positional argument: 'hash'

I realized that this is due to the fact that I am using fossology 3.9.0 (release) that supports API v.1.0.16 while latest version of fossology-python supports API v.1.1.1, which is incompatible with API v.1.0.16, and is not supported by any official release of fossology yet. Thus I am left with two options:

Both options would be sub-optimal for me.

I think that I should be better to have consistency between fossology and fossology-python releases, and to keep at least two development branches, one compatible with the latest fossology release (say, "stable" branch), and one compatible with the current master branch of fossology (say, "dev" branch) but with improvements and bug fixes backported to the stable branch.

Since I need it, I could help in maintaining the backport part.

What do you think?

deveaud-m commented 3 years ago

@alpianon that's an interesting issue, thanks for raising that up!

I guess we need to create a way of supporting the last official version of Fossology API (currently 1.0.16) additionally to adding new features for the next release. Maybe by using an API version switch in the main Fossology object, latest would be use by default. This can easily be tested in CI by testing against different Fossology version (latest + last release).

I'll implement something and assign you to test.