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

create requirements.txt without virtualenv? #26

Closed
AlJohri opened this issue Sep 1, 2018 · 10 comments
Closed

create requirements.txt without virtualenv? #26

AlJohri opened this issue Sep 1, 2018 · 10 comments

Comments

@AlJohri
Copy link

AlJohri commented Sep 1, 2018

@uranusjr reopening pypa/pipenv#2800 (comment) here.

would the passa lock command be able to do what I want? and if not, would you be open to supporting it?

thanks!

cc @techalchemy

@AlJohri
Copy link
Author

AlJohri commented Sep 1, 2018

was looking through the organization and also noticed a few other repos where this might also go like pipfile-cli, or pent. let me know if it makes more sense there

hoping to not maintain a script like (pypa/pipenv#2800 (comment)) from project to project

@uranusjr
Copy link
Member

uranusjr commented Sep 1, 2018

For now the command is passa freeze. pipfile-cli will be archived to favour this project instead once this is ready for standalone production use (I need to clean up the messaging part, see the reporter PR).

Currently the most convinient way to use code in this project is to get a packaged passa.zip. I probably need to set up a build service (I know Appveyor can do this; it is probably the best choice atm), but for now you can use this link.

Once downloaded, run it inside your project, like this

pipenv run python passa.zip freeze

You can interact with it like a normal CLI application (--help, <cmd> --help, etc.). This can actually replace many of the features in Pipenv (it is the goal), so feel free to use it (instead of Pipenv) in your workflow and report any problems.

@AlJohri
Copy link
Author

AlJohri commented Sep 1, 2018

  1. what's the difference between the zip and just doing pip install --upgrade git+https://github.com/sarugaku/passa.git#egg=passa (or the tagged github releases)

  2. I got this error:

screen shot 2018-09-01 at 2 46 22 pm

  1. just curious why you're suggesting pipenv run python ... or pipenv install passa if you the goal is to replace it? wouldn't I want to install it globally?

@uranusjr
Copy link
Member

uranusjr commented Sep 1, 2018

Appveyor artifact is up: https://ci.appveyor.com/project/sarugaku/passa/build/artifacts

I’ll investigate the problem in a moment. Does it help to supply the --project argument manually? (Also, what is the Python version you’re using? argparse behaviour is a little inconsistent across versions, unfortunately.)

@uranusjr
Copy link
Member

uranusjr commented Sep 1, 2018

Can’t reproduce with 2.7 :( I’ll continue to explore. It’d be best if you could provide a step-by-step procedure that could reproduce this.

Regarding zip vs pip (missed that question previously), Passa needs to be run inside the virtual environment like “traditional” Python tools (in contrast to Pipenv, which manages and finds the virtual environment for you), so if you use pip, you need to install it inside the virtual environment. But Passa has quite a lot of dependencies itself, and would contaminate your environment. The zip distribution prevents this by bundling all dependencies inside.

I much prefer this approach, and might remove the entry on PyPI because it doesn’t really make sense for Passa to be used that way.

@AlJohri
Copy link
Author

AlJohri commented Sep 1, 2018

$ python --version
Python 3.6.5
$ cd ~/Development/heliograf/apps/api/
$ ls Pipfile*
Pipfile       Pipfile.lock
$ pipenv shell
Loading .env environment variables...
Launching subshell in virtual environment…
 . /Users/johria/.local/share/virtualenvs/api-IzJWx2po/bin/activate
$ mv ~/Downloads/passa.zip .
$ python passa.zip freeze
usage: passa freeze [-h] [--project project] [--target TARGET] [--dev]
                    [--no-default] [--include-hashes | --no-include-hashes]
passa freeze: error: argument --project: invalid build_project value: '/Users/johria/Development/heliograf/apps/api'

@uranusjr
Copy link
Member

uranusjr commented Sep 1, 2018

I think I made progress. So this error is generated by argparse for TypeError and ValueError (that’s quite magical). The most likely source of this error is during TOML parsing, maybe there’s something wrong with your Pipfile, I guess?

I just pushed a commit with better error messaging. Try if it emits something more useful.

@AlJohri
Copy link
Author

AlJohri commented Sep 1, 2018

Pipfile: https://gist.github.com/AlJohri/5a74a073f77a3a9b186f46605ab89892

I downloaded the latest on appveyor to retest (build 1.0.8) but I got the same error as before

@uranusjr
Copy link
Member

uranusjr commented Sep 2, 2018

I know what’s going on: I’m validating the Pipfile more strictly than Pipenv, and the name fields in all [[source]] sections are required. I’m still evaluating if this is a good thing, but in any case there should be better error messages. I’ll work on that later. For now, it should be enough to fix the problem by adding a name field to the first source section.

@uranusjr
Copy link
Member

uranusjr commented Sep 4, 2018

Closing this since the topic issue is resolved. The error message improvement is tracked in #29.

@uranusjr uranusjr closed this as completed Sep 4, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants