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

This version

0.0.8

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.8.tar.gz (13.9 kB view details)

Uploaded Source

Built Distribution

requirementslib-0.0.8-py2.py3-none-any.whl (12.6 kB view details)

Uploaded Python 2 Python 3

File details

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

File metadata

File hashes

Hashes for requirementslib-0.0.8.tar.gz
Algorithm Hash digest
SHA256 9b116607b3ba1ae1a3d55b9b4c243ba14ed70dd017af6858734bed7e81689c19
MD5 e9d8ef5af15da924aeb2326ba71a257a
BLAKE2b-256 be06c8df542d65e1403588d66eca9aaddc332cce59ad1b404e9ecb423d254c46

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for requirementslib-0.0.8-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 4c2bba388ebeb15e57de3eacdf4f385fe6bf14619c3e156829b35fc3aa77d61e
MD5 54dfdc67dfef42f8a06bb28f4195676e
BLAKE2b-256 becfd680ca1891b1e53de6d120f8018939ff899fd4d99353cb6f328b866777b9

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