Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pipenv support (Python) #117

Closed
dideler opened this issue Jan 3, 2019 · 6 comments
Closed

Pipenv support (Python) #117

dideler opened this issue Jan 3, 2019 · 6 comments

Comments

@dideler
Copy link

dideler commented Jan 3, 2019

Pipenv is a popular package and virtualenv manager for Python.

Like Ruby's Bundler which has Gemfile and Gemfile.lock, Pipenv has Pipfile and Pipfile.lock.

Note that Pipenv can produce a requirements.txt file, which I tried to use with licensed, but no luck.

$ pipenv lock --requirements > requirements.txt

$ head requirements.txt
-i https://pypi.org/simple
-e .
absl-py==0.6.1
astor==0.7.1
boto3==1.9.62
boto==2.49.0
botocore==1.12.62
bz2file==0.98
certifi==2018.11.29
chardet==3.0.4

$ licensed list
Displaying dependencies for datascience core package

$ cat .licensed.yaml
sources:
  pip: true
@dideler dideler changed the title Pipenv support Pipenv support (Python) Jan 3, 2019
@dideler
Copy link
Author

dideler commented Jan 3, 2019

Read the licensed pip docs and specified the virtualenv directory in .licensed.yaml.

sources:
  pip: true
python:
  virtual_env_dir: "/Users/dennis/.local/share/virtualenvs/core-06DYXQgl"

Trying again errors with the following trace

$ licensed list
Displaying dependencies for datascience core package
  pip dependencies:
Traceback (most recent call last):
	22: from /Users/dennis/.rbenv/versions/2.6.0/bin/licensed:23:in `<main>'
	21: from /Users/dennis/.rbenv/versions/2.6.0/bin/licensed:23:in `load'
	20: from /Users/dennis/.rbenv/versions/2.6.0/lib/ruby/gems/2.6.0/gems/licensed-1.5.2/exe/licensed:5:in `<top (required)>'
	19: from /Users/dennis/.rbenv/versions/2.6.0/lib/ruby/gems/2.6.0/gems/thor-0.20.3/lib/thor/base.rb:466:in `start'
	18: from /Users/dennis/.rbenv/versions/2.6.0/lib/ruby/gems/2.6.0/gems/thor-0.20.3/lib/thor.rb:387:in `dispatch'
	17: from /Users/dennis/.rbenv/versions/2.6.0/lib/ruby/gems/2.6.0/gems/thor-0.20.3/lib/thor/invocation.rb:126:in `invoke_command'
	16: from /Users/dennis/.rbenv/versions/2.6.0/lib/ruby/gems/2.6.0/gems/thor-0.20.3/lib/thor/command.rb:27:in `run'
	15: from /Users/dennis/.rbenv/versions/2.6.0/lib/ruby/gems/2.6.0/gems/licensed-1.5.2/lib/licensed/cli.rb:30:in `list'
	14: from /Users/dennis/.rbenv/versions/2.6.0/lib/ruby/gems/2.6.0/gems/licensed-1.5.2/lib/licensed/cli.rb:59:in `run'
	13: from /Users/dennis/.rbenv/versions/2.6.0/lib/ruby/gems/2.6.0/gems/licensed-1.5.2/lib/licensed/command/list.rb:12:in `run'
	12: from /Users/dennis/.rbenv/versions/2.6.0/lib/ruby/gems/2.6.0/gems/licensed-1.5.2/lib/licensed/command/list.rb:12:in `each'
	11: from /Users/dennis/.rbenv/versions/2.6.0/lib/ruby/gems/2.6.0/gems/licensed-1.5.2/lib/licensed/command/list.rb:14:in `block in run'
	10: from /Users/dennis/.rbenv/versions/2.6.0/lib/ruby/gems/2.6.0/gems/licensed-1.5.2/lib/licensed/command/list.rb:14:in `chdir'
	 9: from /Users/dennis/.rbenv/versions/2.6.0/lib/ruby/gems/2.6.0/gems/licensed-1.5.2/lib/licensed/command/list.rb:15:in `block (2 levels) in run'
	 8: from /Users/dennis/.rbenv/versions/2.6.0/lib/ruby/gems/2.6.0/gems/licensed-1.5.2/lib/licensed/command/list.rb:15:in `each'
	 7: from /Users/dennis/.rbenv/versions/2.6.0/lib/ruby/gems/2.6.0/gems/licensed-1.5.2/lib/licensed/command/list.rb:20:in `block (3 levels) in run'
	 6: from /Users/dennis/.rbenv/versions/2.6.0/lib/ruby/gems/2.6.0/gems/licensed-1.5.2/lib/licensed/command/list.rb:33:in `dependencies'
	 5: from /Users/dennis/.rbenv/versions/2.6.0/lib/ruby/gems/2.6.0/gems/licensed-1.5.2/lib/licensed/source/pip.rb:22:in `dependencies'
	 4: from /Users/dennis/.rbenv/versions/2.6.0/lib/ruby/gems/2.6.0/gems/licensed-1.5.2/lib/licensed/source/pip.rb:22:in `map'
	 3: from /Users/dennis/.rbenv/versions/2.6.0/lib/ruby/gems/2.6.0/gems/licensed-1.5.2/lib/licensed/source/pip.rb:23:in `block in dependencies'
	 2: from /Users/dennis/.rbenv/versions/2.6.0/lib/ruby/gems/2.6.0/gems/licensed-1.5.2/lib/licensed/source/pip.rb:45:in `package_info'
	 1: from /Users/dennis/.rbenv/versions/2.6.0/lib/ruby/gems/2.6.0/gems/licensed-1.5.2/lib/licensed/source/pip.rb:54:in `pip_command'
/Users/dennis/.rbenv/versions/2.6.0/lib/ruby/gems/2.6.0/gems/licensed-1.5.2/lib/licensed/shell.rb:17:in `execute': command exited with status 2 (Licensed::Shell::Error)
  /Users/dennis/.local/share/virtualenvs/core-06DYXQgl/bin/pip --disable-pip-version-check show "-i https://pypi.org/simple
"
    Usage:
      pip show [options] <package> ...

    no such option: -i

Edit: The virtualenv directory specified is the one reported by pipenv --venv

@jonabc
Copy link
Contributor

jonabc commented Jan 3, 2019

@dideler what version of pip are you using?

@dideler
Copy link
Author

dideler commented Jan 3, 2019

$ /Users/dennis/.local/share/virtualenvs/core-06DYXQgl/bin/pip --version
pip 18.1 from /Users/dennis/.local/share/virtualenvs/core-06DYXQgl/lib/python3.6/site-packages/pip (python 3.6)

@jonabc
Copy link
Contributor

jonabc commented Jan 3, 2019

ah ok so it looks like the two opening lines of requirements.txt are unexpected.

-i https://pypi.org/simple
-e .

Is there a way to have pipenv generate the requirements file without those lines? Otherwise I'd be happy to accept a PR if you wanted to submit a fix 😄 . Seems like licensed could ignore any lines that aren't of the format <package>=<version>?

@dideler
Copy link
Author

dideler commented Jan 3, 2019

Thanks @jonabc, manually removed those lines and it works!

I don't think there is a way for pipenv to not generate those lines. (Note the -e . is because of a local package dependency that was added to the Pipfile with pipenv install --editable .)

I'll try to submit a patch once I've finished going through all our remaining dependencies I'm auditing.

@jonabc
Copy link
Contributor

jonabc commented May 19, 2019

Closed by #167 🎉

@jonabc jonabc closed this as completed May 19, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants