Skip to main content

A tool for converting between pip-style and pipfile requirements.

Project description

https://img.shields.io/pypi/v/requirementslib.svg https://img.shields.io/pypi/l/requirementslib.svg https://travis-ci.org/techalchemy/requirementslib.svg?branch=master https://ci.appveyor.com/api/projects/status/n16s8fhn71o0v0tl/branch/master?svg=true https://img.shields.io/pypi/pyversions/requirementslib.svg https://img.shields.io/badge/Say%20Thanks-!-1EAEDB.svg Documentation Status

Installation

Install from PyPI:

$ pipenv install --pre requirementslib

Install from Github:

$ pipenv install -e git+https://github.com/techalchemy/requirementslib.git#egg=requirementslib

Summary

RequirementsLib provides a simple layer for building and interacting with requirements in both the Pipfile format and the requirements.txt format. This library was originally built for converting between these formats in Pipenv.

Usage

Import the library and create a requirement object from requirements.txt format:

>>> from requirementslib import Requirement
>>> r = Requirement.from_line('-e git+https://github.com/pypa/pipenv.git@master#egg=pipenv')
>>> print(r)
Requirement(name='pipenv', vcs='git', req=VCSRequirement(editable=True, uri='git+https://github.com/pypa/pipenv.git', path=None, vcs='git', ref='master', subdirectory=None, name='pipenv', link=<Link git+https://github.com/pypa/pipenv.git@master#egg=pipenv>, req=<Requirement: "-e git+https://github.com/pypa/pipenv.git@master#egg=pipenv">), markers=None, specifiers=None, index=None, editable=True, hashes=[], extras=[])

>>> r.as_pipfile()
{'pipenv': {'editable': True, 'ref': 'master', 'git': 'https://github.com/pypa/pipenv.git'}}

Or move from Pipfile format to requirements.txt:

>>> r = Requirement.from_pipfile(name='pythonfinder', indexes=[], pipfile={'path': '../pythonfinder', 'editable': True})
>>> r.as_line()
'-e ../pythonfinder'

Integrations

Project details


Release history Release notifications | RSS feed

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

requirementslib-0.0.5.tar.gz (13.3 kB view details)

Uploaded Source

Built Distribution

requirementslib-0.0.5-py2.py3-none-any.whl (12.0 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file requirementslib-0.0.5.tar.gz.

File metadata

File hashes

Hashes for requirementslib-0.0.5.tar.gz
Algorithm Hash digest
SHA256 bfec8cd89307196fa11d7ecc8ffdc15d0a2ca5122d5f8cd6372d8f1919b9d32e
MD5 95b7ea0778ac9dec4c6981c935d613ff
BLAKE2b-256 75a8c0c34a9d9f6eec3554c302f6d015accd1fee8e9ff0d4f21a064f70e12e5d

See more details on using hashes here.

File details

Details for the file requirementslib-0.0.5-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for requirementslib-0.0.5-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 db8a26dc4f458e861cb3b547521169e719ed9e63a3f6d4351ef3f728967fe720
MD5 7663c424b6d57425d6817c7433acd182
BLAKE2b-256 cbf0c2afaed7bb94d77a1d92835a05c43de399ac77836cfc52832637fedd22e8

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page