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 lock --requirements" includes dev requirements #245

Closed
blueyed opened this issue Mar 1, 2017 · 9 comments
Closed

"pipenv lock --requirements" includes dev requirements #245

blueyed opened this issue Mar 1, 2017 · 9 comments
Labels
Type: Enhancement 💡 This is a feature or enhancement request.

Comments

@blueyed
Copy link
Contributor

blueyed commented Mar 1, 2017

It should behave like pipenv install, where you have to specify --dev to install development packages explicitly.

My use case it pip install -r <(pipenv lock --requirements) -t build/upload to generate a directory with the packages required for the app - that should not include development packages (by default).

@nateprewitt
Copy link
Member

This should be simple to set up, we currently have dev hardcoded to True for the lock command. I think this was Kenneth's original intent to just do a simple dump of everything for requirements.txt.

If @kennethreitz signs off on adding the --dev option to pipenv lock that will fix everything with a one line change. We can look into a PR at that point.

Thanks for bringing this up, @blueyed :)

@nateprewitt nateprewitt added the Type: Enhancement 💡 This is a feature or enhancement request. label Mar 1, 2017
@kennethreitz
Copy link
Contributor

kennethreitz commented Mar 1, 2017 via email

@kennethreitz
Copy link
Contributor

i might change my mind later.

@blueyed
Copy link
Contributor Author

blueyed commented Mar 2, 2017

So what would be the recommended way to achieve a clean install without dev deps then currently?

@nateprewitt
Copy link
Member

In the current version of pipenv, you'd need to run the command on a Pipfile without dev dependencies. That's unfortunately the only way at the moment.

I did think some more on the --dev parameter yesterday though and don't think that's the right approach if we ever decide to address this. A --dev parameter without the accompanying --requirements param has confusing semantics. The use of --dev in other situations would imply we're locking dependencies including dev. This suggests pipenv lock without --dev only locks the default section which isn't, and likely won't ever be, the case. There's nothing to tie that param directly to requirements without creating a secondary param specifically for dev-requirements which is also undesirable.

If maintaining the requirements.txt backwards compatibility is fundamental for your project right now, I'd suggest using something like the script below.

from pipenv.project import Project
from pipenv.utils import convert_deps_to_pip

# Create pip-compatible dependency list
packages = Project().parsed_pipfile.get('packages', {})
deps = convert_deps_to_pip(packages, r=False)

with open('requirements.txt', 'w') as f:
    f.write('\n'.join(deps))

@blueyed
Copy link
Contributor Author

blueyed commented Mar 3, 2017

Yes, I came to the same conclusion.

There should be a separate command for it (generating a requirements file/output) probably.

@gsemet
Copy link
Contributor

gsemet commented Oct 23, 2017

+1 to get 2 commands:

  • pipenv lock -r to generate requirements.txt
  • pipenv lock -d to generate requirements-dev.txt

@blueyed
Copy link
Contributor Author

blueyed commented Oct 23, 2017

Sorry to be deconstructive, but this is surely not happening through commenting on an issue that has been ignored from the beginning: I've even digged into the code and created a PR IIRC - but this project is just a bit too confusing.
(unsubscribing)

@jcox-dev
Copy link

For those that find your way here, this seems to have been addressed in https://github.com/kennethreitz/pipenv/pull/972

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Enhancement 💡 This is a feature or enhancement request.
Projects
None yet
Development

No branches or pull requests

5 participants