Skip to content
A parser for Python dependency files
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.github initial skeleton Jul 11, 2017
docs
dparse
tests
.editorconfig
.gitignore
.travis.yml
CONTRIBUTING.rst
HISTORY.rst
LICENSE
MANIFEST.in
README.rst
codecov.yml
requirements_dev.txt
setup.py fixed a packaging error, new release 0.4.1 Apr 6, 2018
tox.ini

README.rst

Dependency Parser

Documentation Status Updates

A parser for Python dependency files

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)

Installation

To install dparse, run:

$ pip install dparse

If you want to update Pipfiles, install the pipenv extra:

$ pip install dparse[pipenv]

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": []
    }
  ]
}
You can’t perform that action at this time.