Skip to main content
https://img.shields.io/pypi/v/dparse.svg https://img.shields.io/travis/pyupio/dparse.svg https://codecov.io/gh/pyupio/dparse/branch/master/graph/badge.svg

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

Pipfile.lock

yes

yes

poetry.lock

yes

no

setup.py

no (# 2)

no (# 2)

zc.buildout

no (# 3)

no (# 3)

setup.cfg

no (# 4)

no (# 4)

pyproject.toml

yes

no

Installation

To install dparse, run:

$ pip install dparse

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

$ pip install dparse[pipenv]

If you want to parse conda YML files, install the conda extra:

$ pip install dparse[conda]

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": []
    }
  ]
}

Python 2.7

This tool requires latest Python patch versions starting with version 3.5. We did support Python 2.7 in the past but, as for other Python 3.x minor versions, it reached its End-Of-Life and as such we are not able to support it anymore.

We understand you might still have Python 2.7 projects running. At the same time, Safety itself has a commitment to encourage developers to keep their software up-to-date, and it would not make sense for us to work with officially unsupported Python versions, or even those that reached their end of life.

If you still need to use Safety with Python 2.7, please use version 0.4.1 of Dparse available at PyPi. Alternatively, you can run Safety from a Python 3 environment to check the requirements file for your Python 2.7 project.

Release files for dparse 0.6.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for dparse 0.6.4
File Size Uploaded
dparse-0.6.4.tar.gz 27.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for dparse 0.6.4
File Interpreter ABI Platform
dparse-0.6.4-py3-none-any.whl Python 3 none any Details

Total release size: 39.8 kB

Release files / dparse-0.6.4.tar.gz

Download URL dparse-0.6.4.tar.gz
Size 27.9 kB
Tags Source
SHA-256 checksum
How to use checksums
90b29c39e3edc36c6284c82c4132648eaf28a01863eb3c231c2512196132201a
BLAKE2b-256 checksum
How to use checksums
29ee96c65e17222b973f0d3d0aa9bad6a59104ca1b0eb5b659c25c2900fccd85
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.11.9

Release files / dparse-0.6.4-py3-none-any.whl

Download URL dparse-0.6.4-py3-none-any.whl
Size 11.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
fbab4d50d54d0e739fbb4dedfc3d92771003a5b9aa8545ca7a7045e3b174af57
BLAKE2b-256 checksum
How to use checksums
5626035d1c308882514a1e6ddca27f9d3e570d67a0e293e7b4d910a70c8fe32b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.11.9

Release history Release notifications | RSS feed

This release

0.6.4 This release

2 release files

0.6.3

2 release files

0.6.2

2 release files

0.6.1

2 release files

0.6.0

2 release files

0.5.2

2 release files

0.5.1

2 release files

0.5.0

2 release files

0.4.1

2 release files

0.4.0

2 release files

0.3.0

2 release files

0.2.1

2 release files

0.2.0

2 release files

0.1.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page