Convert requirements between formats
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
example
install_requires
.gitignore
LICENSE
README.md
setup.py
tests.py

README.md

install_requires

Convert between dependency describing formats.

Input formats:

  • Pipfile
  • Pipfile.lock
  • pyproject.toml (poetry)
  • requirements.txt

Output formats:

  • setup.py (return install_requires and dependency_links)
  • requirements.txt (return list of lines)

Install

Install with needed extra requirements:

pip install install-requires[pipfile]
pip install install-requires[poetry]

Or from your setup.py:

from pip._internal import main as pip

pip(['install', 'install-requires[pipfile]'])
pip(['install', 'install-requires[poetry]'])

CLI usage

install-requires example/Pipfile requirements.txt

Available conversions:

  1. Pipfile -> requirements.txt
  2. Pipfile.lock -> requirements.txt
  3. pyproject.toml -> requirements.txt

API usage

Pass input format, output format and path to file that must be parsed into convert function:

from pathlib import Path
from install_requires import convert

path = Path(__file__).parent
convert('pyproject.toml', 'setup.py', path)

Available conversions:

  1. Pipfile -> requirements.txt
  2. Pipfile.lock -> requirements.txt
  3. pyproject.toml -> requirements.txt
  4. Pipfile -> setup.py
  5. Pipfile.lock -> setup.py
  6. pyproject.toml -> setup.py
  7. requirements.txt -> setup.py

See example for more details.