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.

How to keep setup.py install_requires and Pipfile in sync

See original GitHub issue

I am working on a Python package with pipenv and am faced with the challenge of keeping setup(install_requires=...) in sync with my Pipfile’s runtime dependencies. Is there a recommended approach?

[Answer 2019-08-23] Best practise as also discussed below:

For applications that are deployed or distributed in installers, I just use Pipfile.

For applications that are distributed as packages with setup.py, I put all my dependencies in install_requires.

Then I make my Pipfile depend on setup.py by running pipenv install '-e .'.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:38
  • Comments:49 (17 by maintainers)

github_iconTop GitHub Comments

39reactions
Madoshakalakacommented, Nov 18, 2019

check out this pipenv-setup package

It syncs pipfile/lockfile to setup.py

$ pipenv-setup sync

package e1839a8 is local, omitted in setup.py
setup.py successfully updated
23 packages from Pipfile.lock synced to setup.py

you can do $ pipenv-setup sync --dev to sync development dependencies to extra requires. or $ pipenv-setup sync --pipfile to sync pipfile instead

and $ pipenv-setup check to do checks only

one command to solve them all 💯

30reactions
Korijncommented, Aug 23, 2019

For applications that are deployed or distributed in installers, I just use Pipfile.

For applications that are distributed as packages with setup.py, I put all my dependencies in install_requires.

Then I make my Pipfile depend on setup.py by running pipenv install '-e .'.

[Update 2019-08-23] I keep the dev packages in Pipfile nowadays, only the runtime dependencies get to live in setup.py.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How do I sync values in setup.py / install_requires with ...
Within your setup.py : Define a function to read a section: def locked_requirements(section): """Look through the 'Pipfile.lock' to fetch ...
Read more >
Simplifying Python Builds. A Single Source of Truth for…
Use the following code to gather packages from your Pipfile and set them for your install_requires keyword argument in a Python setup.py.
Read more >
Advanced Usage of Pipenv - Python Packaging Authority
pipenv install --ignore-pipfile is nearly equivalent to pipenv sync , but pipenv ... Library dependencies are specified via install_requires in setup.py .
Read more >
pipenv-setup
A beautiful python package development tool: sync dependencies in Pipfile or Pipfile.lock to setup.py . Never need again to change dependencies manually in ......
Read more >
Dependency Management - PyScaffold 4.1 documentation
The greatest advantage in packaging Python code (when compared to other forms of ... of abstract dependencies using setuptools ' install_requires .
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