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/pipenv.svg
:target: https://pypi.python.org/pypi/pipenv
.. 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
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/projects/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>`_
===================================================================
.. image:: https://img.shields.io/pypi/v/requirementslib.svg
:target: https://pypi.python.org/pypi/requirementslib
.. image:: https://img.shields.io/pypi/l/pipenv.svg
:target: https://pypi.python.org/pypi/pipenv
.. 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
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/projects/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.1.tar.gz
(12.8 kB
view details)
Built Distribution
File details
Details for the file requirementslib-0.0.1.tar.gz
.
File metadata
- Download URL: requirementslib-0.0.1.tar.gz
- Upload date:
- Size: 12.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5639a0294f4388be8fbdbb4be429f71e0b0157a83042c799b7db232ce2121b16 |
|
MD5 | 9acb48c795c4d176068e4c388d245b86 |
|
BLAKE2b-256 | ddc75dc72a99590c7d1f6bea03e0b9eae4489f8c443fb66e75482f64c74d3337 |
File details
Details for the file requirementslib-0.0.1-py2.py3-none-any.whl
.
File metadata
- Download URL: requirementslib-0.0.1-py2.py3-none-any.whl
- Upload date:
- Size: 11.6 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 24839afecf6baa2cedf50c2063e6082528b6904bd5748273596e8c604f52ceed |
|
MD5 | d207aadc9d73b73136e58b09c809d850 |
|
BLAKE2b-256 | ec08510386260e1a306d68a233af61d9cc0d2d66fe81b35f4354ce9d656cac77 |