hedyhli / starcli

:sparkles: Browse trending GitHub projects from your command line
https://pypi.org/project/starcli/
MIT License
550 stars 50 forks source link

Bug: CONTRIBUTING.md - When using pipenv, must use --pre to install "black>=19.10b0" from requirements_dev.txt #62

Closed jSadoski closed 4 years ago

jSadoski commented 4 years ago

Description

I know the current docs do not use pipenv, but I think it would be worthwhile to mention this issue in the docs to avoid confusion for others.

Command:

$ pipenv install --dev -r requirements_dev.txt
Creating a virtualenv for this project…
Pipfile: /Users/joe/Projects/jsadoski/starcli/Pipfile
Using /Library/Frameworks/Python.framework/Versions/3.7/bin/python3 (3.7.0) to create virtualenv…
⠇ Creating virtual environment...Already using interpreter /Library/Frameworks/Python.framework/Versions/3.7/bin/python3
Using base prefix '/Library/Frameworks/Python.framework/Versions/3.7'
New python executable in /Users/joe/.local/share/virtualenvs/starcli-3WcASgFr/bin/python3
Also creating executable in /Users/joe/.local/share/virtualenvs/starcli-3WcASgFr/bin/python
Installing setuptools, pip, wheel...done.

✔ Successfully created virtual environment! 
Virtualenv location: /Users/joe/.local/share/virtualenvs/starcli-3WcASgFr
Creating a Pipfile for this project…
Requirements file provided! Importing into Pipfile…
Pipfile.lock not found, creating…
Locking [dev-packages] dependencies…
✘ Locking Failed! 
[pipenv.exceptions.ResolutionFailure]:   File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/pipenv/resolver.py", line 69, in resolve
[pipenv.exceptions.ResolutionFailure]:       req_dir=requirements_dir
[pipenv.exceptions.ResolutionFailure]:   File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/pipenv/utils.py", line 726, in resolve_deps
[pipenv.exceptions.ResolutionFailure]:       req_dir=req_dir,
[pipenv.exceptions.ResolutionFailure]:   File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/pipenv/utils.py", line 480, in actually_resolve_deps
[pipenv.exceptions.ResolutionFailure]:       resolved_tree = resolver.resolve()
[pipenv.exceptions.ResolutionFailure]:   File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/pipenv/utils.py", line 395, in resolve
[pipenv.exceptions.ResolutionFailure]:       raise ResolutionFailure(message=str(e))
[pipenv.exceptions.ResolutionFailure]:       pipenv.exceptions.ResolutionFailure: ERROR: ERROR: Could not find a version that matches black>=19.10b0
[pipenv.exceptions.ResolutionFailure]:       Skipped pre-versions: 18.3a0, 18.3a0, 18.3a1, 18.3a1, 18.3a2, 18.3a2, 18.3a3, 18.3a3, 18.3a4, 18.3a4, 18.4a0, 18.4a0, 18.4a1, 18.4a1, 18.4a2, 18.4a2, 18.4a3, 18.4a3, 18.4a4, 18.4a4, 18.5b0, 18.5b0, 18.5b1, 18.5b1, 18.6b0, 18.6b0, 18.6b1, 18.6b1, 18.6b2, 18.6b2, 18.6b3, 18.6b3, 18.6b4, 18.6b4, 18.9b0, 18.9b0, 19.3b0, 19.3b0, 19.10b0, 19.10b0
[pipenv.exceptions.ResolutionFailure]: Warning: Your dependencies could not be resolved. You likely have a mismatch in your sub-dependencies.
  First try clearing your dependency cache with $ pipenv lock --clear, then try the original command again.
 Alternatively, you can use $ pipenv install --skip-lock to bypass this mechanism, then run $ pipenv graph to inspect the situation.
  Hint: try $ pipenv lock --pre if it is a pre-release dependency.
ERROR: ERROR: Could not find a version that matches black>=19.10b0
Skipped pre-versions: 18.3a0, 18.3a0, 18.3a1, 18.3a1, 18.3a2, 18.3a2, 18.3a3, 18.3a3, 18.3a4, 18.3a4, 18.4a0, 18.4a0, 18.4a1, 18.4a1, 18.4a2, 18.4a2, 18.4a3, 18.4a3, 18.4a4, 18.4a4, 18.5b0, 18.5b0, 18.5b1, 18.5b1, 18.6b0, 18.6b0, 18.6b1, 18.6b1, 18.6b2, 18.6b2, 18.6b3, 18.6b3, 18.6b4, 18.6b4, 18.9b0, 18.9b0, 19.3b0, 19.3b0, 19.10b0, 19.10b0
There are incompatible versions in the resolved dependencies.
[pipenv.exceptions.ResolutionFailure]:       req_dir=requirements_dir
[pipenv.exceptions.ResolutionFailure]:   File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/pipenv/utils.py", line 726, in resolve_deps
[pipenv.exceptions.ResolutionFailure]:       req_dir=req_dir,
[pipenv.exceptions.ResolutionFailure]:   File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/pipenv/utils.py", line 480, in actually_resolve_deps
[pipenv.exceptions.ResolutionFailure]:       resolved_tree = resolver.resolve()
[pipenv.exceptions.ResolutionFailure]:   File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/pipenv/utils.py", line 395, in resolve
[pipenv.exceptions.ResolutionFailure]:       raise ResolutionFailure(message=str(e))
[pipenv.exceptions.ResolutionFailure]:       pipenv.exceptions.ResolutionFailure: ERROR: ERROR: Could not find a version that matches black>=19.10b0
[pipenv.exceptions.ResolutionFailure]:       Skipped pre-versions: 18.3a0, 18.3a0, 18.3a1, 18.3a1, 18.3a2, 18.3a2, 18.3a3, 18.3a3, 18.3a4, 18.3a4, 18.4a0, 18.4a0, 18.4a1, 18.4a1, 18.4a2, 18.4a2, 18.4a3, 18.4a3, 18.4a4, 18.4a4, 18.5b0, 18.5b0, 18.5b1, 18.5b1, 18.6b0, 18.6b0, 18.6b1, 18.6b1, 18.6b2, 18.6b2, 18.6b3, 18.6b3, 18.6b4, 18.6b4, 18.9b0, 18.9b0, 19.3b0, 19.3b0, 19.10b0, 19.10b0
[pipenv.exceptions.ResolutionFailure]: Warning: Your dependencies could not be resolved. You likely have a mismatch in your sub-dependencies.
  First try clearing your dependency cache with $ pipenv lock --clear, then try the original command again.
 Alternatively, you can use $ pipenv install --skip-lock to bypass this mechanism, then run $ pipenv graph to inspect the situation.
  Hint: try $ pipenv lock --pre if it is a pre-release dependency.
ERROR: ERROR: Could not find a version that matches black>=19.10b0
Skipped pre-versions: 18.3a0, 18.3a0, 18.3a1, 18.3a1, 18.3a2, 18.3a2, 18.3a3, 18.3a3, 18.3a4, 18.3a4, 18.4a0, 18.4a0, 18.4a1, 18.4a1, 18.4a2, 18.4a2, 18.4a3, 18.4a3, 18.4a4, 18.4a4, 18.5b0, 18.5b0, 18.5b1, 18.5b1, 18.6b0, 18.6b0, 18.6b1, 18.6b1, 18.6b2, 18.6b2, 18.6b3, 18.6b3, 18.6b4, 18.6b4, 18.9b0, 18.9b0, 19.3b0, 19.3b0, 19.10b0, 19.10b0
There are incompatible versions in the resolved dependencies.

Python version

Python 3.7.0

your operating system (and terminal type if needed)

$ sw_vers
ProductName:    Mac OS X
ProductVersion: 10.15.5
BuildVersion:   19F101

$ bash --version
GNU bash, version 5.0.18(1)-release (x86_64-apple-darwin19.5.0)
Copyright (C) 2019 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>

This is free software; you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

starcli version

Current with ce0ba54.

any suggestions to the cause of the problem? (if possible) Adding the --pre flag allows the installation of black (from: microsoft/vscode-python#5171).

$ pipenv install --dev -r requirements_dev.txt --pre
Requirements file provided! Importing into Pipfile…
Pipfile.lock not found, creating…
Locking [dev-packages] dependencies…
✔ Success! 
Locking [packages] dependencies…
Updated Pipfile.lock (fc8d65)!
Installing dependencies from Pipfile.lock (fc8d65)…
  🐍   ▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉ 46/46 — 00:00:14
To activate this project's virtualenv, run pipenv shell.
Alternatively, run a command inside the virtualenv with pipenv run.
hedyhli commented 4 years ago

Thanks for letting me know, I don't use pipenv myself and had always wanted to switch to poetry but never got to. Feel free to add that and open a pr. I'm thinking maybe make all the requirements_dev == instead of >= so that everyone is "locked" on the same version, with the help if dependabot

hedyhli commented 4 years ago

Also I'm not sure if https://github.com/hedythedev/starcli/blob/ce9a81cb376c3c456e5e0454df904ac7c0ec1523/requirements_dev.txt#L1 Will work for pipenv

jSadoski commented 4 years ago

I was able to use https://github.com/hedythedev/starcli/blob/ce9a81cb376c3c456e5e0454df904ac7c0ec1523/requirements_dev.txt#L1 when using the flag -r requirements_dev.txt without any issues. It looks like it was able to follow that.

 $ pipenv install -r requirements_dev.txt --pre
Creating a virtualenv for this project…
Pipfile: /Users/joe/Projects/starcli/Pipfile
Using /Library/Frameworks/Python.framework/Versions/3.7/bin/python3 (3.7.0) to create virtualenv…
⠇ Creating virtual environment...Already using interpreter /Library/Frameworks/Python.framework/Versions/3.7/bin/python3
Using base prefix '/Library/Frameworks/Python.framework/Versions/3.7'
New python executable in /Users/joe/.local/share/virtualenvs/starcli-xuCJWWkt/bin/python3
Also creating executable in /Users/joe/.local/share/virtualenvs/starcli-xuCJWWkt/bin/python
Installing setuptools, pip, wheel...done.

✔ Successfully created virtual environment! 
Virtualenv location: /Users/joe/.local/share/virtualenvs/starcli-xuCJWWkt
Creating a Pipfile for this project…
Requirements file provided! Importing into Pipfile…
Pipfile.lock not found, creating…
Locking [dev-packages] dependencies…
Locking [packages] dependencies…
✔ Success! 
Updated Pipfile.lock (9a05bf)!
Installing dependencies from Pipfile.lock (9a05bf)…
  🐍   ▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉ 46/46 — 00:00:13
To activate this project's virtualenv, run pipenv shell.
Alternatively, run a command inside the virtualenv with pipenv run.

 $ pipenv run python -m starcli --help
Usage: __main__.py [OPTIONS]

  Find trending repos on GitHub

Options:
  -l, --lang TEXT                 Language filter eg: python
  -S, --spoken-language TEXT      Spoken Language filter eg: en for English,
                                  zh for Chinese, etc

  -d, --date-created TEXT         Specify repo creation date in ISO8601 format
                                  YYYY-MM-DD

  -t, --topics TEXT               Search by topic. Can be specified multiple
                                  times. Multiple topics will be conjugated
                                  using &

  -u, --last-updated TEXT         Filter repos based on time of last update in
                                  ISO8601 format YYYY-MM-DD

  -L, --layout [list|table|grid]  The output format (list, table, or grid),
                                  default is list

  -s, --stars TEXT                Range of stars required, default is '>=100'
  -r, --limit-results INTEGER     Limit the number of results shown. Default:
                                  7

  -o, --order [desc|asc]          Specify the order of repos by stars that is
                                  shown, 'desc' or 'asc', default: desc

  --long-stats                    Print the actual stats[1300 instead of 1.3k]
  -D, --date-range [today|this-week|this-month]
                                  View stars received within time range,
                                  choose from: today, this-week, this-month

  --debug                         Turn on debugging mode
  --help                          Show this message and exit.
hedyhli commented 4 years ago

I just tried out dependabot 😋

jSadoski commented 4 years ago

P.S. Locking to black>=19.10b0 still requires --pre. It seems Pipenv just doesn't allow pre-releases without this flag.

Frequently Encountered Pipenv Problems: Your dependencies could not be resolved

Pipenv does not install pre-releases (i.e. a version with an alpha/beta/etc. suffix, such as 1.0b1) by default. You will need to pass the --pre flag in your command, or set

[pipenv]
allow_prereleases = true
$ pipenv install -h
Usage: pipenv install [OPTIONS] [PACKAGES]...

  Installs provided packages and adds them to Pipfile, or (if no packages
  are given), installs all packages from Pipfile.

Options:
...
  --pre                    Allow pre-releases.
...
hedyhli commented 4 years ago

Yeah, since all of black releases are pre-releases since black is still in beta even after 2 years creation