ozgur/python-firebase

Missing dependencies

ulidtko opened this issue · 3 comments

Hi!

While installing version 3.0.1 from PyPI, I've found that these packages need to be added to requirements.txt and install_requires=[...] in setup.py:

  • python_jwt
  • gcloud
  • sseclient
  • requests_toolbelt

These are runtime dependencies of python-firebase and need to be installed together with it. Otherwise, the package installs "successfully" but doesn't work:

ulidtko@pasocon /tmp> python -m venv test
ulidtko@pasocon /tmp> cd test
ulidtko@pasocon /t/test> source bin/activate.fish 
(test) ulidtko@pasocon /t/test> 
(test) ulidtko@pasocon /t/test> pip list | grep firebase
WARNING: You are using pip version 20.1.1; however, version 20.2.1 is available.
You should consider upgrading via the '/tmp/test/bin/python -m pip install --upgrade pip' command.
(test) ulidtko@pasocon /t/test [0|1]> 
(test) ulidtko@pasocon /t/test [0|1]> pip install firebase
Collecting firebase
  Using cached firebase-3.0.1-py3-none-any.whl (18 kB)
Collecting requests
  Downloading requests-2.24.0-py2.py3-none-any.whl (61 kB)
     |████████████████████████████████| 61 kB 173 kB/s 
Collecting certifi>=2017.4.17
  Downloading certifi-2020.6.20-py2.py3-none-any.whl (156 kB)
     |████████████████████████████████| 156 kB 4.2 MB/s 
Collecting idna<3,>=2.5
  Downloading idna-2.10-py2.py3-none-any.whl (58 kB)
     |████████████████████████████████| 58 kB 5.9 MB/s 
Collecting urllib3!=1.25.0,!=1.25.1,<1.26,>=1.21.1
  Downloading urllib3-1.25.10-py2.py3-none-any.whl (127 kB)
     |████████████████████████████████| 127 kB 10.9 MB/s 
Collecting chardet<4,>=3.0.2
  Downloading chardet-3.0.4-py2.py3-none-any.whl (133 kB)
     |████████████████████████████████| 133 kB 10.4 MB/s 
Installing collected packages: certifi, idna, urllib3, chardet, requests, firebase
Successfully installed certifi-2020.6.20 chardet-3.0.4 firebase-3.0.1 idna-2.10 requests-2.24.0 urllib3-1.25.10
WARNING: You are using pip version 20.1.1; however, version 20.2.1 is available.
You should consider upgrading via the '/tmp/test/bin/python -m pip install --upgrade pip' command.
(test) ulidtko@pasocon /t/test> python -c 'import firebase'
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/tmp/test/lib/python3.8/site-packages/firebase/__init__.py", line 14, in <module>
    import python_jwt as jwt
ModuleNotFoundError: No module named 'python_jwt'

As a workaround, hand-installing the dependencies helps. However, installing deps is a job of pip, not of the user. If you add the deps into setup.py, pip will install them together with python-firebase fixing the issue.

What's the version number of python_jwt?

@b4oshany what do you mean? which "the" version number?

You can find all past released versions of python_jwt here: https://pypi.org/project/python-jwt/#history

@b4oshany,

If what you're asking is "which version should I put into requirements.txt" — then the best answer would be python_jwt < 4.0.0.

Please see https://semver.org

python_jwt version 3.2.6 worked fine for my limited testing at the time. 3.3.0 is already available.

python-firebase should allow free choice of dependency versions (i.e. python_jwt==3.2.6 would be bad) — except for major updates. Per SemVer convention linked above, major version bumps signal breaking changes: as a consumer of that library, you might need to change the code before it works with (hypothetic currently) python_jwt 4.0.0.

Same goes for the other dependencies.

python_jwt < 4.0.0
requests_toolbelt ~= 0.9.1
sseclient ~= 0.0.26
gcloud == 0.18.3 # FIXME abandoned since 2016, https://pypi.org/project/gcloud/

Roughly this, as a first sketch.

Let me know if you want to see this as a PR.