Skip to main content

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

Project description

RequirementsLib: Requirement Management Library for Pip and Pipenv
===================================================================

.. image:: https://img.shields.io/pypi/v/requirementslib.svg
:target: https://pypi.python.org/pypi/requirementslib

.. image:: https://img.shields.io/pypi/l/requirementslib.svg
:target: https://pypi.python.org/pypi/requirementslib

.. image:: https://travis-ci.org/techalchemy/requirementslib.svg?branch=master
:target: https://travis-ci.org/techalchemy/requirementslib

.. image:: https://ci.appveyor.com/api/projects/status/n16s8fhn71o0v0tl/branch/master?svg=true
:target: https://ci.appveyor.com/project/techalchemy/requirementslib/branch/master

.. image:: https://img.shields.io/pypi/pyversions/requirementslib.svg
:target: https://pypi.python.org/pypi/requirementslib

.. image:: https://img.shields.io/badge/Say%20Thanks-!-1EAEDB.svg
:target: https://saythanks.io/to/techalchemy

.. image:: https://readthedocs.org/projects/requirementslib/badge/?version=master
:target: http://requirementslib.readthedocs.io/en/master/?badge=master
:alt: 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


.. _PyPI: https://www.pypi.org/project/requirementslib
.. _Github: https://github.com/techalchemy/requirementslib


.. _`Summary`:

Summary
********

RequirementsLib provides a simple layer for building and interacting with
requirements in both the `Pipfile <https://github.com/pypa/pipfile/>`_ format
and the `requirements.txt <https://github.com/pypa/pip/>`_ format. This library
was originally built for converting between these formats in `Pipenv <https://github.com/pypa/pipenv>`_.

.. _`Usage`:

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
*************

* `Pip <https://github.com/pypa/pip>`_
* `Pipenv <https://github.com/pypa/pipenv>`_
* `Pipfile <https://github.com/pypa/pipfile>`_

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

Uploaded Source

Built Distribution

requirementslib-0.0.3-py2.py3-none-any.whl (11.9 kB view details)

Uploaded Python 2 Python 3

File details

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

File metadata

File hashes

Hashes for requirementslib-0.0.3.tar.gz
Algorithm Hash digest
SHA256 cbe245650681a7b25d4d82d967b60c8b5c773a3cf11b057740e23023d24969c1
MD5 b7ff737fdb885259cf362574b5380751
BLAKE2b-256 0e6ff8de1da61f89595274207528dfe097de59728e921533b45e812281b0ea9a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for requirementslib-0.0.3-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 c30418fa603dba77c81e85007d4e61fff77c3745439af938369c4995d2806af7
MD5 25905644b25e343785015d5002185c04
BLAKE2b-256 bd334af2a4fdac574320754655eccd71c2b4a7d2a133f064974f72d9d502126e

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