question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

generate pip {dev-}requirements.txt from Pipfile.lock

See original GitHub issue

Maybe add argument to pipenv lock --gen-pip-lockfiles(or something similar) which would generate both files automatically after vendoring. This is a must for external tools(or Heroku for example), for building packages etc …

Quick invoke task for those who stumble upon this

@task
def vendor(ctx):
    with io.open('Pipfile.lock') as f:
        data = json.load(f)
        prod = []
        dev = []
        for name, meta in data['develop'].items():
            dev.append('{}{}'.format(name, meta['version']))
        for name, meta in data['default'].items():
            prod.append('{}{}'.format(name, meta['version']))

    with io.open('requirements.txt', 'wt') as r:
        r.truncate(0)
        r.seek(0)
        r.write(u'\n'.join(sorted(prod)))
    with io.open('dev-requirements.txt', 'wt') as r:
        r.truncate(0)
        r.seek(0)
        r.write(u'\n'.join(sorted(dev)))

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Reactions:1
  • Comments:7 (5 by maintainers)

github_iconTop GitHub Comments

38reactions
alecbzcommented, Jan 26, 2018

This is now possible: pipenv lock --requirements will produce a requirements file for the non-dev requirements and pipenv lock --requirements --dev will produce one for just the dev requirements.

12reactions
nateprewittcommented, Feb 22, 2017

@frankh, this was a typo at the time, it should have been pipenv install --requirements. However, we’ve also changed this since then. The current version of pipenv will provide requirements with the command pipenv lock --requirements.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Generate requirements.txt from Pipfile.lock #3493 - GitHub
When I run pipenv lock -r it ignores existing Pipfile.lock and does locking process again. There is a workaround for this: $ pipenv...
Read more >
Python HOW: Create requirements.txt Using pipenv
This creates a Pipfile.lock file (or updates an existing one) in the project's directory, and of course your requirements.txt file with the required ......
Read more >
How to freeze a requirement with pipenv? - Stack Overflow
This is the way that I was prompted by pipenv to generate a requirements.txt file from the project's Pipfile: pipenv lock --requirements.
Read more >
Advanced Usage of Pipenv - Read the Docs
☤ Generating a requirements.txt ¶. You can convert a Pipfile and Pipfile.lock into a requirements.txt ...
Read more >
Setting up a Python development environment with pipenv
Generate your own pipfile.lock · Put the requirements.txt file in your project directory · Run pipenv lock · Run pipenv install --ignore-pipfile - ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found