Skip to main content

A tree-sitter parser for requirements.txt files

Project description

CI discord matrix pypi

A tree-sitter parser for pip requirements files.

Python package

Installation

pip install tree-sitter-requirements

Usage

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

Editors

  ☑ Neovim
  ☐ Helix
  ☐ Emacs
  ☐ Zed

Changelog

v0.3.3

  • Fix library compilation

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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

tree_sitter_requirements-0.3.3-cp38-abi3-win_amd64.whl (21.8 kB view details)

Uploaded CPython 3.8+ Windows x86-64

tree_sitter_requirements-0.3.3-cp38-abi3-musllinux_1_1_x86_64.whl (19.3 kB view details)

Uploaded CPython 3.8+ musllinux: musl 1.1+ x86-64

tree_sitter_requirements-0.3.3-cp38-abi3-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl (19.1 kB view details)

Uploaded CPython 3.8+ manylinux: glibc 2.17+ x86-64 manylinux: glibc 2.5+ x86-64

tree_sitter_requirements-0.3.3-cp38-abi3-macosx_10_9_universal2.whl (30.4 kB view details)

Uploaded CPython 3.8+ macOS 10.9+ universal2 (ARM64, x86-64)

File details

Details for the file tree_sitter_requirements-0.3.3-cp38-abi3-win_amd64.whl.

File metadata

File hashes

Hashes for tree_sitter_requirements-0.3.3-cp38-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 c96c7f7928ebc13887b4ac769cbdcf41c28c0ab0f7fa0d5c9d5f3115064e7b15
MD5 fd1586fede79c67c295061e7b6c60dba
BLAKE2b-256 8bbc8b85585a0a17d0773143babca85b5e6885b0b93d3f10344e0cce3d9b056d

See more details on using hashes here.

Provenance

File details

Details for the file tree_sitter_requirements-0.3.3-cp38-abi3-musllinux_1_1_x86_64.whl.

File metadata

File hashes

Hashes for tree_sitter_requirements-0.3.3-cp38-abi3-musllinux_1_1_x86_64.whl
Algorithm Hash digest
SHA256 364a46688f3f1cfe24e6880c432fc20511d9fbdf95c96351617a3d94232c227f
MD5 122caf3edeb43dbc3bcfe014bc066075
BLAKE2b-256 feff9ad3798d957fcce041acdac57f5c423829ee9acb63a2daf8569c8b5e5e24

See more details on using hashes here.

Provenance

File details

Details for the file tree_sitter_requirements-0.3.3-cp38-abi3-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for tree_sitter_requirements-0.3.3-cp38-abi3-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 9dbe3f8a3c9b6f540db10e5b3766bdfa0a7c97d452b8d6c785330c224b639c5a
MD5 ebbad08df2cffb22315f798a0cee4d95
BLAKE2b-256 386cc80a018a955b69e64e78a4163933b9356e4f30fc80123af62c9b30d9e7e8

See more details on using hashes here.

Provenance

File details

Details for the file tree_sitter_requirements-0.3.3-cp38-abi3-macosx_10_9_universal2.whl.

File metadata

File hashes

Hashes for tree_sitter_requirements-0.3.3-cp38-abi3-macosx_10_9_universal2.whl
Algorithm Hash digest
SHA256 d5c8730e785f5b4f8761cf0fc85dfd4108804f4f1c30a875355ee4f6be2f856e
MD5 bc72918a52fe8b2bf69f38e72a1463f5
BLAKE2b-256 f7d756465739c714a9799cae750d88d638f1b34f33527637f9f377a199d92806

See more details on using hashes here.

Provenance

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page