pygmars
Craft simple regex-based small language lexers and parsers. Build parsers from grammars and accept Pygments lexers as an input. Derived from NLTK.
Decision gist · record as of 2026-08-14
Yes, if you need lightweight regex-based lexing and parsing without dependencies. The library is stable and permissively licensed, but maintenance is aging (394 days since last release). Install it for copyright detection, manifest parsing, or simple DSL parsing; avoid it if you need active upstream development or support for complex recursive grammars.AI-flagged interpretation of the facts on this page — verify before relying
Before you install
- Requires Python 3.9 or later.
- Low install friction with no runtime dependencies.
- Maintenance status is aging—last release was 394 days ago, though the repository remains active and the package is marked Production/Stable.
License · maintenance · safety
Apache-2.0 (permissive) — Licensed under Apache-2.0 (permissive), allowing commercial and private use with minimal restrictions. Derived from NLTK; copyright held by nexB Inc. and the NLTK Project.
last release 2025-07-16 (394 days) · last repo commit 2025-07-16 · 6 stars
0 known vulnerabilities (OSV.dev, 2026-08-14) · 123,835 downloads/mo, #11,898 on PyPI
Alternatives
Verify before relying
pip install pygmars
from pygmars.lex import Lexer
from pygmars.parse import Parser, Grammar
lexer = Lexer()
tokens = lexer.lex("your text here")
parser = Parser(Grammar(rules))
tree = parser.parse(tokens)- Whether the package's aging maintenance status (394 days since last release) affects stability or security for new use cases.
- How well the library handles complex or deeply nested grammar rules in practice.
- Whether Pygments integration covers all 130+ supported languages or a subset.
What it is and what it does
Pygmars is a lightweight lexing and parsing library that builds on simplified, remixed code from NLTK's regex-based tagging and chunking. It transforms sequences of text into labeled Token objects (assigning labels, tracking position and line number), then applies regular-expression-based grammar rules to recognize token sequences and build a parse tree. Each rule has a left-hand side label (non-terminal) and a right-hand side pattern over token labels.
The library is designed for cases where NLTK is overkill—it has no dependencies, a small footprint, and integrates with Pygments lexers to enable lightweight parsing of many programming languages. It was originally built to parse copyright statements in ScanCode Toolkit and is now used for extracting metadata from package manifests and other lightweight language parsing tasks where a full NLP toolkit is unnecessary.
Use it for
- Parse copyright and author statements from source files by building grammars on top of existing Pygments lexers.
- Extract metadata (such as dependencies) from package manifest files using lightweight regex-based grammar rules.
- Build simple domain-specific language parsers without the overhead of a full NLP framework.
- Tokenize and label text in programming languages supported by Pygments, then apply lightweight grammar-based analysis.
- Integrate lexing and parsing into tools that need lightweight language understanding without external dependencies.
Worth the install?
AI-flagged interpretation of the facts on this page. Verify before relying on it.
Yes, if you need lightweight regex-based lexing and parsing without dependencies.
The library is stable and permissively licensed, but maintenance is aging (394 days since last release). Install it for copyright detection, manifest parsing, or simple DSL parsing; avoid it if you need active upstream development or support for complex recursive grammars.
Install
pygmars on PyPI
Before you install
Low install friction with no runtime dependencies. Maintenance status is aging—last release was 394 days ago, though the repository remains active and the package is marked Production/Stable.
Requires Python 3.9 or later.
License in practice
Licensed under Apache-2.0 (permissive), allowing commercial and private use with minimal restrictions. Derived from NLTK; copyright held by nexB Inc. and the NLTK Project.
Quickstart
pip install pygmars
from pygmars.lex import Lexer
from pygmars.parse import Parser, Grammar
lexer = Lexer()
tokens = lexer.lex("your text here")
parser = Parser(Grammar(rules))
tree = parser.parse(tokens)
Verify before relying
- Whether the package's aging maintenance status (394 days since last release) affects stability or security for new use cases.
- How well the library handles complex or deeply nested grammar rules in practice.
- Whether Pygments integration covers all 130+ supported languages or a subset.
Package facts
| License | Apache-2.0 permissive |
| Python support | Supports the current Python release >=3.9 |
| Install friction | Low. Pure-Python wheel |
| Runtime dependencies | None |
| Maintenance | Aging 394 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 123,835 / month, #11,898 on PyPI 30-day window, as of 2026-08-14 |
| Known vulnerabilities | None known OSV.dev, checked 2026-08-14 |
| Classifiers | Development Status :: 5 - Production/StableIntended Audience :: DevelopersProgramming Language :: Python :: 3Programming Language :: Python :: 3 :: OnlyTopic :: Software DevelopmentTopic :: Utilities |
Evidence: pygmars-1.0.0-py3-none-any.whl
Tags
Let your AI agent find packages like this
Example. Real query, live index.
You found this page by searching. An agent finds it by wishing: SkillFed indexes 14,416 PyPI packages by what they can do, searchable in plain language.
wish › “regex-based lexer parser”
- pygmarsPygmars builds lightweight lexers and parsers using regular…
- interegularInteregular checks whether pairs of Python regular expressions can…
- rplyRPLY is a pure Python parser generator that creates lexers and…
Give your agent the search over MCP, or paste the wish link into any chat.
More Software Development packages
Provides backported and experimental type hints for Python 3.9+, allowing use of newer typing features on older Python versions and enabling early experimentation with type system PEPs before they enter the standard library.
NumPy provides an N-dimensional array object and a comprehensive suite of mathematical, linear algebra, Fourier transform, and random number functions for scientific computing in Python.
FastAPI is a Python web framework for building REST APIs using type hints, with automatic request validation, serialization, and interactive API documentation.
Provides a way to document function parameters, class attributes, return types, and variables inline using Python's `Annotated` type hint syntax instead of traditional docstrings.
Typer builds command-line applications from Python functions using type hints, automatically generating help text, argument parsing, and shell completion.
Install it if you are building CLIs in Python.
Distlib provides low-level packaging utilities for building, distributing, and managing Python software—including metadata handling, version specifiers, wheel support, script installation, and dependency resolution.
See also PyMeta3 · rply · pyparsing · textparser · ipython-pygments-lexers · sly · parsy · Pygments · spark-parser · javalang