dparse


Namedparse JSON
Version 0.6.3 PyPI version JSON
download
home_pagehttps://github.com/pyupio/dparse
SummaryA parser for Python dependency files
upload_time2023-06-26 15:38:35
maintainer
docs_urlNone
authorJannis Gebauer
requires_python>=3.6
licenseMIT license
keywords dparse
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI
coveralls test coverage No coveralls.
            =================
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


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_) |
+------------------+------------+-----------+

.. _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

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

.. code-block:: console

    $ pip install dparse[pipenv]

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

.. code-block:: console

    $ 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.


=======
History
=======

0.6.3 (2023-06-26)
------------------

* Use the modern tomli/tomllib to parse TOML files. (thanks @mgorny)
* Drop Python 3.5 from our CI.

0.6.2 (2022-09-19)
------------------

* Fixed bug: always call the parent from the PATH in the resolve_file function.

0.6.1 (2022-09-19)
------------------

* Fixed a bug in the resolve_file function.

0.6.0 (2022-09-09)
------------------

* Adds support for parsing poetry.lock files
* Adds a way to resolve all the linked dependencies in one Dependency File
* Throws exceptions if found in the parsing process (This may be a breaking change)

0.5.2 (2022-08-09)
------------------

* Install pyyaml only when asked for with extras (conda extra)
* Add support for piptools requirements.in
* Use ConfigParser directly
* Removed a regex used in the index server validation, fixing a possible ReDos security issue

0.5.1 (2020-04-26)
------------------

* Fixed package metadata removing 2.7 support
* Install pipenv only when asked for with extras

0.5.0 (2020-03-14)
------------------

A bug with this package allows it to be installed on Python 2.7 environments,
even though it should not work on such version. You should stick with version
0.4.1 version instead for Python 2.7 support.

* Dropped Python 2.7, 3.3, 3.4 support
* Removed six package
* Removed pinned dependencies of tests
* Dropped setup.py tests support in favor of tox

0.4.1 (2018-04-06)
------------------

* Fixed a packaging error.

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.

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/pyupio/dparse",
    "name": "dparse",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.6",
    "maintainer_email": "",
    "keywords": "dparse",
    "author": "Jannis Gebauer",
    "author_email": "support@pyup.io",
    "download_url": "https://files.pythonhosted.org/packages/22/35/e224f4e70799bbb8e9f6c69a8dbe966d640bf43dea11fc5ef77df120f8ed/dparse-0.6.3.tar.gz",
    "platform": null,
    "description": "=================\nDependency Parser\n=================\n\n\n.. image:: https://img.shields.io/pypi/v/dparse.svg\n        :target: https://pypi.python.org/pypi/dparse\n\n.. image:: https://img.shields.io/travis/pyupio/dparse.svg\n        :target: https://travis-ci.org/pyupio/dparse\n\n.. image:: https://codecov.io/gh/pyupio/dparse/branch/master/graph/badge.svg\n  :target: https://codecov.io/gh/pyupio/dparse\n\n\nA parser for Python dependency files\n\n\nSupported Files\n---------------\n\n+------------------+------------+-----------+\n| File             | parse      | update    |\n+==================+============+===========+\n| requirements.txt | yes        | yes       |\n+------------------+------------+-----------+\n| conda.yml        | yes        | yes       |\n+------------------+------------+-----------+\n| tox.ini          | yes        | yes       |\n+------------------+------------+-----------+\n| Pipfile          | yes        | yes       |\n+------------------+------------+-----------+\n| Pipfile.lock     | yes        | yes       |\n+------------------+------------+-----------+\n| poetry.lock      | yes        | no        |\n+------------------+------------+-----------+\n| setup.py         | no (# 2_)  | no (# 2_) |\n+------------------+------------+-----------+\n| zc.buildout      | no (# 3_)  | no (# 3_) |\n+------------------+------------+-----------+\n| setup.cfg        | no (# 4_)  | no (# 4_) |\n+------------------+------------+-----------+\n\n.. _2: https://github.com/pyupio/dparse/issues/2\n.. _3: https://github.com/pyupio/dparse/issues/3\n.. _4: https://github.com/pyupio/dparse/issues/8\n\n************\nInstallation\n************\n\nTo install dparse, run:\n\n.. code-block:: console\n\n    $ pip install dparse\n\nIf you want to update Pipfiles, install the pipenv extra:\n\n.. code-block:: console\n\n    $ pip install dparse[pipenv]\n\nIf you want to parse conda YML files, install the conda extra:\n\n.. code-block:: console\n\n    $ pip install dparse[conda]\n\n*****\nUsage\n*****\n\nTo use dparse in a Python project::\n\n    from dparse import parse, filetypes\n\n    content = \"\"\"\n    South==1.0.1 --hash=sha256:abcdefghijklmno\n    pycrypto>=2.6\n    \"\"\"\n\n    df = parse(content, file_type=filetypes.requirements_txt)\n\n    print(df.json())\n\n\n\n\n    {\n      \"file_type\": \"requirements.txt\",\n      \"content\": \"\\nSouth==1.0.1 --hash=sha256:abcdefghijklmno\\npycrypto>=2.6\\n\",\n      \"path\": null,\n      \"sha\": null,\n      \"dependencies\": [\n        {\n          \"name\": \"South\",\n          \"specs\": [\n            [\n              \"==\",\n              \"1.0.1\"\n            ]\n          ],\n          \"line\": \"South==1.0.1 --hash=sha256:abcdefghijklmno\",\n          \"source\": \"pypi\",\n          \"meta\": {},\n          \"line_numbers\": null,\n          \"index_server\": null,\n          \"hashes\": [\n            \"--hash=sha256:abcdefghijklmno\"\n          ],\n          \"dependency_type\": \"requirements.txt\",\n          \"extras\": []\n        },\n        {\n          \"name\": \"pycrypto\",\n          \"specs\": [\n            [\n              \">=\",\n              \"2.6\"\n            ]\n          ],\n          \"line\": \"pycrypto>=2.6\",\n          \"source\": \"pypi\",\n          \"meta\": {},\n          \"line_numbers\": null,\n          \"index_server\": null,\n          \"hashes\": [],\n          \"dependency_type\": \"requirements.txt\",\n          \"extras\": []\n        }\n      ]\n    }\n\n**********\nPython 2.7\n**********\n\nThis tool requires latest Python patch versions starting with version 3.5. We\ndid support Python 2.7 in the past but, as for other Python 3.x minor versions,\nit reached its End-Of-Life and as such we are not able to support it anymore.\n\nWe understand you might still have Python 2.7 projects running. At the same\ntime, Safety itself has a commitment to encourage developers to keep their\nsoftware up-to-date, and it would not make sense for us to work with officially\nunsupported Python versions, or even those that reached their end of life.\n\nIf you still need to use Safety with Python 2.7, please use version 0.4.1 of\nDparse available at PyPi. Alternatively, you can run Safety from a Python 3\nenvironment to check the requirements file for your Python 2.7 project.\n\n\n=======\nHistory\n=======\n\n0.6.3 (2023-06-26)\n------------------\n\n* Use the modern tomli/tomllib to parse TOML files. (thanks @mgorny)\n* Drop Python 3.5 from our CI.\n\n0.6.2 (2022-09-19)\n------------------\n\n* Fixed bug: always call the parent from the PATH in the resolve_file function.\n\n0.6.1 (2022-09-19)\n------------------\n\n* Fixed a bug in the resolve_file function.\n\n0.6.0 (2022-09-09)\n------------------\n\n* Adds support for parsing poetry.lock files\n* Adds a way to resolve all the linked dependencies in one Dependency File\n* Throws exceptions if found in the parsing process (This may be a breaking change)\n\n0.5.2 (2022-08-09)\n------------------\n\n* Install pyyaml only when asked for with extras (conda extra)\n* Add support for piptools requirements.in\n* Use ConfigParser directly\n* Removed a regex used in the index server validation, fixing a possible ReDos security issue\n\n0.5.1 (2020-04-26)\n------------------\n\n* Fixed package metadata removing 2.7 support\n* Install pipenv only when asked for with extras\n\n0.5.0 (2020-03-14)\n------------------\n\nA bug with this package allows it to be installed on Python 2.7 environments,\neven though it should not work on such version. You should stick with version\n0.4.1 version instead for Python 2.7 support.\n\n* Dropped Python 2.7, 3.3, 3.4 support\n* Removed six package\n* Removed pinned dependencies of tests\n* Dropped setup.py tests support in favor of tox\n\n0.4.1 (2018-04-06)\n------------------\n\n* Fixed a packaging error.\n\n0.4.0 (2018-04-06)\n------------------\n\n* pipenv is now an optional dependency that's only used when updating a Pipfile. Install it with dparse[pipenv]\n* Added support for invalid toml Pipfiles (thanks @pombredanne)\n\n\n0.3.0 (2018-03-01)\n------------------\n\n* Added support for setup.cfg files (thanks @kexepal)\n* Dependencies from Pipfiles now include the section (thanks @paulortman)\n* Multiline requirements are now ignored if they are marked\n* Added experimental support for Pipfiles\n\n0.2.1 (2017-07-19)\n------------------\n\n* Internal refactoring\n\n0.2.0 (2017-07-19)\n------------------\n\n* Removed setuptools dependency\n\n\n0.1.1 (2017-07-14)\n------------------\n\n* Fixed a bug that was causing the parser to throw errors on invalid requirements.\n\n0.1.0 (2017-07-11)\n------------------\n\n* Initial, not much to see here.\n",
    "bugtrack_url": null,
    "license": "MIT license",
    "summary": "A parser for Python dependency files",
    "version": "0.6.3",
    "project_urls": {
        "Homepage": "https://github.com/pyupio/dparse"
    },
    "split_keywords": [
        "dparse"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "a0d04ed375a914d3cdbddb19fb7a72431e511c4cb102c54137d8fc2e563f3567",
                "md5": "549fd5674baa43807ceccccce69b50d5",
                "sha256": "0d8fe18714056ca632d98b24fbfc4e9791d4e47065285ab486182288813a5318"
            },
            "downloads": -1,
            "filename": "dparse-0.6.3-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "549fd5674baa43807ceccccce69b50d5",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.6",
            "size": 12962,
            "upload_time": "2023-06-26T15:38:33",
            "upload_time_iso_8601": "2023-06-26T15:38:33.513194Z",
            "url": "https://files.pythonhosted.org/packages/a0/d0/4ed375a914d3cdbddb19fb7a72431e511c4cb102c54137d8fc2e563f3567/dparse-0.6.3-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "2235e224f4e70799bbb8e9f6c69a8dbe966d640bf43dea11fc5ef77df120f8ed",
                "md5": "424bdc7c2c2db90fc926308cadc24d60",
                "sha256": "27bb8b4bcaefec3997697ba3f6e06b2447200ba273c0b085c3d012a04571b528"
            },
            "downloads": -1,
            "filename": "dparse-0.6.3.tar.gz",
            "has_sig": false,
            "md5_digest": "424bdc7c2c2db90fc926308cadc24d60",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.6",
            "size": 20316,
            "upload_time": "2023-06-26T15:38:35",
            "upload_time_iso_8601": "2023-06-26T15:38:35.085261Z",
            "url": "https://files.pythonhosted.org/packages/22/35/e224f4e70799bbb8e9f6c69a8dbe966d640bf43dea11fc5ef77df120f8ed/dparse-0.6.3.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-06-26 15:38:35",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "pyupio",
    "github_project": "dparse",
    "travis_ci": true,
    "coveralls": false,
    "github_actions": true,
    "tox": true,
    "lcname": "dparse"
}
        
Elapsed time: 0.14018s