A parser for Python dependency files
Project description
=================
Dependency Parser
=================
.. image:: https://img.shields.io/pypi/v/dparse.svg
:target: https://pypi.python.org/pypi/dparse
.. image:: https://img.shields.io/travis/pyupio/dparse.svg
:target: https://travis-ci.org/pyupio/dparse
.. image:: https://codecov.io/gh/pyupio/dparse/branch/master/graph/badge.svg
:target: https://codecov.io/gh/pyupio/dparse
.. image:: https://readthedocs.org/projects/dparse/badge/?version=latest
:target: https://dparse.readthedocs.io/en/latest/?badge=latest
:alt: Documentation Status
.. image:: https://pyup.io/repos/github/jayfk/dparse/shield.svg
:target: https://pyup.io/repos/github/pyupio/dparse/
:alt: Updates
A parser for Python dependency files
* Free software: MIT license
* Documentation: https://dparse.readthedocs.io.
Supported Files
---------------
+------------------+------------+-----------+
| File | parse | update |
+==================+============+===========+
| requirements.txt | yes | yes |
+------------------+------------+-----------+
| conda.yml | yes | yes |
+------------------+------------+-----------+
| tox.ini | yes | yes |
+------------------+------------+-----------+
| Pipfile | yes | yes |
+------------------+------------+-----------+
| Pifile.lock | yes | yes |
+------------------+------------+-----------+
| setup.py | no (# 2_) | no (# 2_) |
+------------------+------------+-----------+
| zc.buildout | no (# 3_) | no (# 3_) |
+------------------+------------+-----------+
| setup.cfg | no (# 4_) | no (# 4_) |
+------------------+------------+-----------+
.. _2: https://github.com/pyupio/dparse/issues/2
.. _3: https://github.com/pyupio/dparse/issues/3
.. _4: https://github.com/pyupio/dparse/issues/8
************
Installation
************
To install dparse, run:
.. code-block:: console
$ pip install dparse
*****
Usage
*****
To use dparse in a Python project::
from dparse import parse, filetypes
content = """
South==1.0.1 --hash=sha256:abcdefghijklmno
pycrypto>=2.6
"""
df = parse(content, file_type=filetypes.requirements_txt)
print(df.json())
{
"file_type": "requirements.txt",
"content": "\nSouth==1.0.1 --hash=sha256:abcdefghijklmno\npycrypto>=2.6\n",
"path": null,
"sha": null,
"dependencies": [
{
"name": "South",
"specs": [
[
"==",
"1.0.1"
]
],
"line": "South==1.0.1 --hash=sha256:abcdefghijklmno",
"source": "pypi",
"meta": {},
"line_numbers": null,
"index_server": null,
"hashes": [
"--hash=sha256:abcdefghijklmno"
],
"dependency_type": "requirements.txt",
"extras": []
},
{
"name": "pycrypto",
"specs": [
[
">=",
"2.6"
]
],
"line": "pycrypto>=2.6",
"source": "pypi",
"meta": {},
"line_numbers": null,
"index_server": null,
"hashes": [],
"dependency_type": "requirements.txt",
"extras": []
}
]
}
=======
History
=======
0.4.0 (2018-04-06)
------------------
* pipenv is now an optional dependency that's only used when updating a Pipfile. Install it with dparse[pipenv]
* Added support for invalid toml Pipfiles (thanks @pombredanne)
0.3.0 (2018-03-01)
------------------
* Added support for setup.cfg files (thanks @kexepal)
* Dependencies from Pipfiles now include the section (thanks @paulortman)
* Multiline requirements are now ignored if they are marked
* Added experimental support for Pipfiles
0.2.1 (2017-07-19)
------------------
* Internal refactoring
0.2.0 (2017-07-19)
------------------
* Removed setuptools dependency
0.1.1 (2017-07-14)
------------------
* Fixed a bug that was causing the parser to throw errors on invalid requirements.
0.1.0 (2017-07-11)
------------------
* Initial, not much to see here.
Dependency Parser
=================
.. image:: https://img.shields.io/pypi/v/dparse.svg
:target: https://pypi.python.org/pypi/dparse
.. image:: https://img.shields.io/travis/pyupio/dparse.svg
:target: https://travis-ci.org/pyupio/dparse
.. image:: https://codecov.io/gh/pyupio/dparse/branch/master/graph/badge.svg
:target: https://codecov.io/gh/pyupio/dparse
.. image:: https://readthedocs.org/projects/dparse/badge/?version=latest
:target: https://dparse.readthedocs.io/en/latest/?badge=latest
:alt: Documentation Status
.. image:: https://pyup.io/repos/github/jayfk/dparse/shield.svg
:target: https://pyup.io/repos/github/pyupio/dparse/
:alt: Updates
A parser for Python dependency files
* Free software: MIT license
* Documentation: https://dparse.readthedocs.io.
Supported Files
---------------
+------------------+------------+-----------+
| File | parse | update |
+==================+============+===========+
| requirements.txt | yes | yes |
+------------------+------------+-----------+
| conda.yml | yes | yes |
+------------------+------------+-----------+
| tox.ini | yes | yes |
+------------------+------------+-----------+
| Pipfile | yes | yes |
+------------------+------------+-----------+
| Pifile.lock | yes | yes |
+------------------+------------+-----------+
| setup.py | no (# 2_) | no (# 2_) |
+------------------+------------+-----------+
| zc.buildout | no (# 3_) | no (# 3_) |
+------------------+------------+-----------+
| setup.cfg | no (# 4_) | no (# 4_) |
+------------------+------------+-----------+
.. _2: https://github.com/pyupio/dparse/issues/2
.. _3: https://github.com/pyupio/dparse/issues/3
.. _4: https://github.com/pyupio/dparse/issues/8
************
Installation
************
To install dparse, run:
.. code-block:: console
$ pip install dparse
*****
Usage
*****
To use dparse in a Python project::
from dparse import parse, filetypes
content = """
South==1.0.1 --hash=sha256:abcdefghijklmno
pycrypto>=2.6
"""
df = parse(content, file_type=filetypes.requirements_txt)
print(df.json())
{
"file_type": "requirements.txt",
"content": "\nSouth==1.0.1 --hash=sha256:abcdefghijklmno\npycrypto>=2.6\n",
"path": null,
"sha": null,
"dependencies": [
{
"name": "South",
"specs": [
[
"==",
"1.0.1"
]
],
"line": "South==1.0.1 --hash=sha256:abcdefghijklmno",
"source": "pypi",
"meta": {},
"line_numbers": null,
"index_server": null,
"hashes": [
"--hash=sha256:abcdefghijklmno"
],
"dependency_type": "requirements.txt",
"extras": []
},
{
"name": "pycrypto",
"specs": [
[
">=",
"2.6"
]
],
"line": "pycrypto>=2.6",
"source": "pypi",
"meta": {},
"line_numbers": null,
"index_server": null,
"hashes": [],
"dependency_type": "requirements.txt",
"extras": []
}
]
}
=======
History
=======
0.4.0 (2018-04-06)
------------------
* pipenv is now an optional dependency that's only used when updating a Pipfile. Install it with dparse[pipenv]
* Added support for invalid toml Pipfiles (thanks @pombredanne)
0.3.0 (2018-03-01)
------------------
* Added support for setup.cfg files (thanks @kexepal)
* Dependencies from Pipfiles now include the section (thanks @paulortman)
* Multiline requirements are now ignored if they are marked
* Added experimental support for Pipfiles
0.2.1 (2017-07-19)
------------------
* Internal refactoring
0.2.0 (2017-07-19)
------------------
* Removed setuptools dependency
0.1.1 (2017-07-14)
------------------
* Fixed a bug that was causing the parser to throw errors on invalid requirements.
0.1.0 (2017-07-11)
------------------
* Initial, not much to see here.
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
dparse-0.4.0.tar.gz
(24.4 kB
view hashes)
Built Distribution
dparse-0.4.0-py2-none-any.whl
(11.0 kB
view hashes)