tree-sitter-requirements


Nametree-sitter-requirements JSON
Version 0.3.2 PyPI version JSON
download
home_page
SummaryA tree-sitter parser for requirements.txt files
upload_time2024-02-29 12:26:50
maintainer
docs_urlNone
author
requires_python>=3.8
licenseMIT
keywords tree-sitter parser lexer
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            ========================
tree-sitter-requirements
========================

|CI| |discord| |matrix| |pypi|

A tree-sitter parser for pip requirements files.

Python package
--------------

Installation
^^^^^^^^^^^^

.. code-block:: bash

   pip install tree-sitter-requirements


Usage
^^^^^

.. code-block:: python

   import tree_sitter_requirements as requirements

   with open('requirements.txt', 'r') as rf:
      # parse a requirements.txt file
      tree = requirements.parse(rf.read())
      # get the highlight groups
      hl_groups = requirements.highlights(tree)
      # run an arbitrary query
      packages = requirements.query("""
      (requirement (package) @package)
      """, tree.root_node)


References
----------

* `Requirements File Format <https://pip.pypa.io/en/stable/reference/requirements-file-format/>`_
* `Dependency Specifiers <https://packaging.python.org/en/latest/specifications/dependency-specifiers/>`_
* `Version Specifiers <https://packaging.python.org/en/latest/specifications/version-specifiers/>`_
* `VCS Support <https://pip.pypa.io/en/stable/topics/vcs-support/>`_

Editors
-------

| |c| Neovim
| |u| Helix
| |u| Emacs
| |u| Zed

.. |u| unicode:: U+00A0 U+00A0 U+2610
.. |c| unicode:: U+00A0 U+00A0 U+2611


Changelog
---------

v0.3.2
^^^^^^

* Fix platform detection code

v0.3.1
^^^^^^

* Replace deprecated resource API

v0.3.0
^^^^^^

* Change bindings layout

v0.2.0
^^^^^^

* Move to ``tree-sitter-grammars`` org

v0.1.5
^^^^^^

* Resolve ``_version_list`` conflict
* Fix inline comments

v0.1.4
^^^^^^

* Make URL scheme case-insensitive

v0.1.3
^^^^^^

* Support per-requirement options
* Parse paths and URLs in options

v0.1.2
^^^^^^

* Support environment variables in URLs

v0.1.1
^^^^^^

* Fix environment markers

.. |CI| image:: https://img.shields.io/github/actions/workflow/status/tree-sitter-grammars/tree-sitter-requirements/test.yml?logo=github&label=CI
   :target: https://github.com/tree-sitter-grammars/tree-sitter-requirements/actions/workflows/test.yml
   :alt: CI

.. |discord| image:: https://img.shields.io/discord/1063097320771698699?logo=discord&label=discord
   :target: https://discord.gg/w7nTvsVJhm
   :alt: discord

.. |matrix| image:: https://img.shields.io/matrix/tree-sitter-chat%3Amatrix.org?logo=matrix&label=matrix
   :target: https://matrix.to/#/#tree-sitter-chat:matrix.org
   :alt: matrix

.. |pypi| image:: https://img.shields.io/pypi/v/tree-sitter-requirements?logo=pypi&logoColor=ffd242
   :target: https://pypi.org/project/tree-sitter-requirements/
   :alt: pypi

            

Raw data

            {
    "_id": null,
    "home_page": "",
    "name": "tree-sitter-requirements",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.8",
    "maintainer_email": "",
    "keywords": "tree-sitter,parser,lexer",
    "author": "",
    "author_email": "ObserverOfTime <chronobserver@disroot.org>",
    "download_url": "",
    "platform": null,
    "description": "========================\ntree-sitter-requirements\n========================\n\n|CI| |discord| |matrix| |pypi|\n\nA tree-sitter parser for pip requirements files.\n\nPython package\n--------------\n\nInstallation\n^^^^^^^^^^^^\n\n.. code-block:: bash\n\n   pip install tree-sitter-requirements\n\n\nUsage\n^^^^^\n\n.. code-block:: python\n\n   import tree_sitter_requirements as requirements\n\n   with open('requirements.txt', 'r') as rf:\n      # parse a requirements.txt file\n      tree = requirements.parse(rf.read())\n      # get the highlight groups\n      hl_groups = requirements.highlights(tree)\n      # run an arbitrary query\n      packages = requirements.query(\"\"\"\n      (requirement (package) @package)\n      \"\"\", tree.root_node)\n\n\nReferences\n----------\n\n* `Requirements File Format <https://pip.pypa.io/en/stable/reference/requirements-file-format/>`_\n* `Dependency Specifiers <https://packaging.python.org/en/latest/specifications/dependency-specifiers/>`_\n* `Version Specifiers <https://packaging.python.org/en/latest/specifications/version-specifiers/>`_\n* `VCS Support <https://pip.pypa.io/en/stable/topics/vcs-support/>`_\n\nEditors\n-------\n\n| |c| Neovim\n| |u| Helix\n| |u| Emacs\n| |u| Zed\n\n.. |u| unicode:: U+00A0 U+00A0 U+2610\n.. |c| unicode:: U+00A0 U+00A0 U+2611\n\n\nChangelog\n---------\n\nv0.3.2\n^^^^^^\n\n* Fix platform detection code\n\nv0.3.1\n^^^^^^\n\n* Replace deprecated resource API\n\nv0.3.0\n^^^^^^\n\n* Change bindings layout\n\nv0.2.0\n^^^^^^\n\n* Move to ``tree-sitter-grammars`` org\n\nv0.1.5\n^^^^^^\n\n* Resolve ``_version_list`` conflict\n* Fix inline comments\n\nv0.1.4\n^^^^^^\n\n* Make URL scheme case-insensitive\n\nv0.1.3\n^^^^^^\n\n* Support per-requirement options\n* Parse paths and URLs in options\n\nv0.1.2\n^^^^^^\n\n* Support environment variables in URLs\n\nv0.1.1\n^^^^^^\n\n* Fix environment markers\n\n.. |CI| image:: https://img.shields.io/github/actions/workflow/status/tree-sitter-grammars/tree-sitter-requirements/test.yml?logo=github&label=CI\n   :target: https://github.com/tree-sitter-grammars/tree-sitter-requirements/actions/workflows/test.yml\n   :alt: CI\n\n.. |discord| image:: https://img.shields.io/discord/1063097320771698699?logo=discord&label=discord\n   :target: https://discord.gg/w7nTvsVJhm\n   :alt: discord\n\n.. |matrix| image:: https://img.shields.io/matrix/tree-sitter-chat%3Amatrix.org?logo=matrix&label=matrix\n   :target: https://matrix.to/#/#tree-sitter-chat:matrix.org\n   :alt: matrix\n\n.. |pypi| image:: https://img.shields.io/pypi/v/tree-sitter-requirements?logo=pypi&logoColor=ffd242\n   :target: https://pypi.org/project/tree-sitter-requirements/\n   :alt: pypi\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "A tree-sitter parser for requirements.txt files",
    "version": "0.3.2",
    "project_urls": {
        "Homepage": "https://github.com/tree-sitter-grammars/tree-sitter-requirements",
        "Issues": "https://github.com/tree-sitter-grammars/tree-sitter-requirements/issues",
        "Sponsor": "https://github.com/sponsors/ObserverOfTime"
    },
    "split_keywords": [
        "tree-sitter",
        "parser",
        "lexer"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "e45dc9db99b4c0e981b584bada0e0d67646a1acd3b50c386f36ab838e1117ab6",
                "md5": "15e4fe857db32bd8b04bdaa240c8d591",
                "sha256": "207f1d12e7da5889b22b4e518a20c8258bb530b692cb4a4befece865d06c4758"
            },
            "downloads": -1,
            "filename": "tree_sitter_requirements-0.3.2-cp38-abi3-macosx_10_9_universal2.whl",
            "has_sig": false,
            "md5_digest": "15e4fe857db32bd8b04bdaa240c8d591",
            "packagetype": "bdist_wheel",
            "python_version": "cp38",
            "requires_python": ">=3.8",
            "size": 30363,
            "upload_time": "2024-02-29T12:26:50",
            "upload_time_iso_8601": "2024-02-29T12:26:50.506456Z",
            "url": "https://files.pythonhosted.org/packages/e4/5d/c9db99b4c0e981b584bada0e0d67646a1acd3b50c386f36ab838e1117ab6/tree_sitter_requirements-0.3.2-cp38-abi3-macosx_10_9_universal2.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "f1540059f9eac4defa05ed568a2d02a0d45cadf60e777770a26cb4cfcc9d1a9a",
                "md5": "e3205850bfc0468ddab9ef2a3669c82a",
                "sha256": "279669d50b7ccb68cfb6532ff807d8d0c00527149a6ac9106c05cc641827d330"
            },
            "downloads": -1,
            "filename": "tree_sitter_requirements-0.3.2-cp38-abi3-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl",
            "has_sig": false,
            "md5_digest": "e3205850bfc0468ddab9ef2a3669c82a",
            "packagetype": "bdist_wheel",
            "python_version": "cp38",
            "requires_python": ">=3.8",
            "size": 19049,
            "upload_time": "2024-02-29T12:26:52",
            "upload_time_iso_8601": "2024-02-29T12:26:52.182824Z",
            "url": "https://files.pythonhosted.org/packages/f1/54/0059f9eac4defa05ed568a2d02a0d45cadf60e777770a26cb4cfcc9d1a9a/tree_sitter_requirements-0.3.2-cp38-abi3-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "82221450921cbd6735fe8ed580403e8b1d9f75bd619afaadfa534651550283e9",
                "md5": "550081919239ecfb401a8e0c234e007a",
                "sha256": "6fd57223d7105b915f65eb0f859b0f126b60d7332950bc8afd999bbbbacc8bf8"
            },
            "downloads": -1,
            "filename": "tree_sitter_requirements-0.3.2-cp38-abi3-musllinux_1_1_x86_64.whl",
            "has_sig": false,
            "md5_digest": "550081919239ecfb401a8e0c234e007a",
            "packagetype": "bdist_wheel",
            "python_version": "cp38",
            "requires_python": ">=3.8",
            "size": 19329,
            "upload_time": "2024-02-29T12:26:53",
            "upload_time_iso_8601": "2024-02-29T12:26:53.410717Z",
            "url": "https://files.pythonhosted.org/packages/82/22/1450921cbd6735fe8ed580403e8b1d9f75bd619afaadfa534651550283e9/tree_sitter_requirements-0.3.2-cp38-abi3-musllinux_1_1_x86_64.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "c6e20f3b675f6268ad6a891138efb415b8e692874a43fc45d3894f3c91abae4d",
                "md5": "9b8ab89893a0689f3358dd427d84cb2f",
                "sha256": "1aea9afdc589599096d25fde976d41009fd04aab7cf7cc1e7cbd132633bf2b01"
            },
            "downloads": -1,
            "filename": "tree_sitter_requirements-0.3.2-cp38-abi3-win_amd64.whl",
            "has_sig": false,
            "md5_digest": "9b8ab89893a0689f3358dd427d84cb2f",
            "packagetype": "bdist_wheel",
            "python_version": "cp38",
            "requires_python": ">=3.8",
            "size": 21754,
            "upload_time": "2024-02-29T12:26:54",
            "upload_time_iso_8601": "2024-02-29T12:26:54.893685Z",
            "url": "https://files.pythonhosted.org/packages/c6/e2/0f3b675f6268ad6a891138efb415b8e692874a43fc45d3894f3c91abae4d/tree_sitter_requirements-0.3.2-cp38-abi3-win_amd64.whl",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-02-29 12:26:50",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "tree-sitter-grammars",
    "github_project": "tree-sitter-requirements",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "tree-sitter-requirements"
}
        
Elapsed time: 0.19309s