rasbt / watermark

An IPython magic extension for printing date and time stamps, version numbers, and hardware information
Other
894 stars 92 forks source link

setup.py fails unless all install_requires are already installed #67

Closed jamesmyatt closed 4 years ago

jamesmyatt commented 4 years ago

Because of how the version is managed (https://github.com/rasbt/watermark/blob/master/setup.py#L12), setup.py will fail if there are any mandatory dependencies that are not installed. This means that it cannot run setup.py to get the install_requires unless all of the install_requires are already installed!

This is discussed as option 6 of https://packaging.python.org/guides/single-sourcing-package-version/.

This doesn't show up in CI because ipython is installed separately before watermark is installed.

See here for an example: https://travis-ci.org/github/rasbt/watermark/jobs/739884501

rasbt commented 4 years ago

Thanks for the note. Trying it out in an env that doesn't have ipython installed. It seems to collect and install ipython fine without issues though:

$ ~/Desktop/watermark % ipython
zsh: command not found: ipython
sebastian@MBP2018 ~/Desktop/watermark % pip install watermark
Collecting watermark
  Downloading watermark-2.0.2-py2.py3-none-any.whl (5.3 kB)
Collecting ipython
  Downloading ipython-7.18.1-py3-none-any.whl (786 kB)
     |████████████████████████████████| 786 kB 69 kB/s 
Collecting appnope; sys_platform == "darwin"
  Downloading appnope-0.1.0-py2.py3-none-any.whl (4.0 kB)
Requirement already satisfied: setuptools>=18.5 in /Users/sebastian/miniconda3/envs/w1/lib/python3.7/site-packages (from ipython->watermark) (50.3.0.post20201006)
Collecting pexpect>4.3; sys_platform != "win32"
  Downloading pexpect-4.8.0-py2.py3-none-any.whl (59 kB)
     |████████████████████████████████| 59 kB 6.2 MB/s 
Collecting prompt-toolkit!=3.0.0,!=3.0.1,<3.1.0,>=2.0.0
  Downloading prompt_toolkit-3.0.8-py3-none-any.whl (355 kB)
     |████████████████████████████████| 355 kB 5.9 MB/s 
Collecting backcall
  Downloading backcall-0.2.0-py2.py3-none-any.whl (11 kB)
Collecting traitlets>=4.2
  Downloading traitlets-5.0.5-py3-none-any.whl (100 kB)
     |████████████████████████████████| 100 kB 6.6 MB/s 
Collecting decorator
  Downloading decorator-4.4.2-py2.py3-none-any.whl (9.2 kB)
Collecting jedi>=0.10
  Downloading jedi-0.17.2-py2.py3-none-any.whl (1.4 MB)
     |████████████████████████████████| 1.4 MB 7.3 MB/s 
Collecting pickleshare
  Downloading pickleshare-0.7.5-py2.py3-none-any.whl (6.9 kB)
Collecting pygments
  Downloading Pygments-2.7.2-py3-none-any.whl (948 kB)
     |████████████████████████████████| 948 kB 43.6 MB/s 
Collecting ptyprocess>=0.5
  Downloading ptyprocess-0.6.0-py2.py3-none-any.whl (39 kB)
Collecting wcwidth
  Downloading wcwidth-0.2.5-py2.py3-none-any.whl (30 kB)
Collecting ipython-genutils
  Downloading ipython_genutils-0.2.0-py2.py3-none-any.whl (26 kB)
Collecting parso<0.8.0,>=0.7.0
  Downloading parso-0.7.1-py2.py3-none-any.whl (109 kB)
     |████████████████████████████████| 109 kB 9.0 MB/s 
Installing collected packages: appnope, ptyprocess, pexpect, wcwidth, prompt-toolkit, backcall, ipython-genutils, traitlets, decorator, parso, jedi, pickleshare, pygments, ipython, watermark
Successfully installed appnope-0.1.0 backcall-0.2.0 decorator-4.4.2 ipython-7.18.1 ipython-genutils-0.2.0 jedi-0.17.2 parso-0.7.1 pexpect-4.8.0 pickleshare-0.7.5 prompt-toolkit-3.0.8 ptyprocess-0.6.0 pygments-2.7.2 traitlets-5.0.5 watermark-2.0.2 wcwidth-0.2.5
$ ~/Desktop/watermark

But it is probably a good idea to change the CI so that ipython is not installed explicitely before installing watermark