A tree-sitter parser for requirements.txt files
Project description
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 mf:
# parse a requirements.txt file
tree = requirements.parse(mf.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
Changelog
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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distributions
File details
Details for the file tree_sitter_requirements-0.1.5-cp38-abi3-macosx_10_9_universal2.whl
.
File metadata
- Download URL: tree_sitter_requirements-0.1.5-cp38-abi3-macosx_10_9_universal2.whl
- Upload date:
- Size: 28.6 kB
- Tags: CPython 3.8+, macOS 10.9+ universal2 (ARM64, x86-64)
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | bb0769e750f61280e62273a18858c31d1581858f2ee81e5fe74eee49f714b94f |
|
MD5 | eafafe3941c8524f36d081fe3cdc7b86 |
|
BLAKE2b-256 | fcd911b63c20bf8bb6b522013b4f98bcd55fac04e327d1cf904c7d01e60bf335 |
Provenance
File details
Details for the file tree_sitter_requirements-0.1.5-cp37-abi3-win_amd64.whl
.
File metadata
- Download URL: tree_sitter_requirements-0.1.5-cp37-abi3-win_amd64.whl
- Upload date:
- Size: 20.9 kB
- Tags: CPython 3.7+, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4c43f21681e92cc9413d0b57f4bfcbe274ae7c521cafd8ff834cec222f51bd75 |
|
MD5 | 5befef6e0ce4a8a90d7a2d790e4d88a8 |
|
BLAKE2b-256 | 384e9fd77f368df174383a12941ceb3c77180996b1519b1485a841bf17171c38 |
Provenance
File details
Details for the file tree_sitter_requirements-0.1.5-cp37-abi3-musllinux_1_1_x86_64.whl
.
File metadata
- Download URL: tree_sitter_requirements-0.1.5-cp37-abi3-musllinux_1_1_x86_64.whl
- Upload date:
- Size: 18.4 kB
- Tags: CPython 3.7+, musllinux: musl 1.1+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 961f434d1fc51eccc21ce05c53d4ef55f161b15d3fcf0eb17bfc62b272544700 |
|
MD5 | 6138a2642bf7ef31f092298ac0da404c |
|
BLAKE2b-256 | 2e221cd560b493a4bfcf3230cdcce10957c1bdd44535d529d3116217aef49dc8 |
Provenance
File details
Details for the file tree_sitter_requirements-0.1.5-cp37-abi3-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl
.
File metadata
- Download URL: tree_sitter_requirements-0.1.5-cp37-abi3-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 18.1 kB
- Tags: CPython 3.7+, manylinux: glibc 2.17+ x86-64, manylinux: glibc 2.5+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7d892fff1939b8195cd470b8221a0c663da22d03d2ace48f1093df072455750b |
|
MD5 | 2ddeac29bca9c5c02c71dfdeb8ba59d5 |
|
BLAKE2b-256 | 34e30b91a5b5c06cab4b28c5f5233aad2286a783dc8fe616acc93e0ebaeb86d5 |