ipfs-shipyard/py-ipfs-http-client

Version bypass

Opened this issue · 1 comments

When an ipfs version changes, some things don't change.
For example, the ipfs add command may not change at all. So it doesn't make sense to brake that functionality.

I understand tracking the compatible version of each command may be too much, but I think it makes sense to let people bypass the version checks.

There should be a flag like unsafe_bypass_version_check on the connect function.

I have been using popen calls to ipfs command line for well over a year waiting for this to resolve. Although the readme on this api claims it's tested against v0.8.0 it does not work from a pip3 install:


$ pip3 install --upgrade ipfshttpclient
Requirement already satisfied: ipfshttpclient in /usr/local/lib/python3.9/dist-packages (0.7.0)
Requirement already satisfied: requests>=2.11 in /usr/lib/python3/dist-packages (from ipfshttpclient) (2.25.1)
Requirement already satisfied: multiaddr>=0.0.7 in /usr/local/lib/python3.9/dist-packages (from ipfshttpclient) (0.0.9)
Requirement already satisfied: base58 in /usr/local/lib/python3.9/dist-packages (from multiaddr>=0.0.7->ipfshttpclient) (2.1.1)
Requirement already satisfied: netaddr in /usr/local/lib/python3.9/dist-packages (from multiaddr>=0.0.7->ipfshttpclient) (0.8.0)
Requirement already satisfied: varint in /usr/local/lib/python3.9/dist-packages (from multiaddr>=0.0.7->ipfshttpclient) (1.0.2)
Requirement already satisfied: six in /usr/lib/python3/dist-packages (from multiaddr>=0.0.7->ipfshttpclient) (1.16.0)

$ python3
Python 3.9.2 (default, Feb 28 2021, 17:03:44)
[GCC 10.2.1 20210110] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import ipfshttpclient as api
>>> client = api.connect()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python3.9/dist-packages/ipfshttpclient/client/__init__.py", line 119, in connect
    assert_version(client.apply_workarounds()["Version"])
  File "/usr/local/lib/python3.9/dist-packages/ipfshttpclient/client/__init__.py", line 69, in assert_version
    raise exceptions.VersionMismatch(version, minimum, maximum)
ipfshttpclient.exceptions.VersionMismatch: Unsupported daemon version '0.8.0' (not in range: 0.4.23 ≤ … < 0.8.0)
>>>

Notice the last message indicates allowable version must be less than 0.8.0 !!!

The issue is line 68 of client/init :
if minimum > version or version >= maximum:
should be:
if minimum > version or version > maximum:
according to your documentation at least. You should revise your docs to state whether the version check is inclusive or not.

I am using ipfshttpclient v0.7.0 on Debian 11 bullseye, pip version 22.0.2