--- id: textx version: "4.4.0" license: unclear license_treatment: permissive maintenance: active --- # textX — Meta-language for DSL implementation inspired by Xtext License: permissive · Maintenance: active · Downloads: 299.7K/mo ## What it is and what it does textX is a Python framework for implementing Domain-Specific Languages by writing a grammar definition. From that grammar, it automatically generates a parser and meta-model (abstract syntax tree) that can parse and instantiate models conforming to your language. It uses a PEG parser (via Arpeggio) with unlimited lookahead and no grammar ambiguities, following the design principles of Xtext but implemented entirely in Python. You define your DSL syntax as a textX grammar, optionally provide custom Python classes for specific rules, and then use the generated meta-model to parse text into Python object graphs. This is useful when you need to build support for a new textual language, file format, or configuration syntax without writing a parser from scratch. Use it for: - Build a custom configuration file format with validation and programmatic access to parsed settings - Create a domain-specific language for modeling (e.g., state machines, workflows, or diagrams) and interpret or transform the models - Parse and process existing textual file formats or languages where you want programmatic control over the abstract syntax - Implement a code generation tool that reads a textual specification and produces output in another language - Define a query or expression language for a specialized application domain ## Worth the install? AI-flagged interpretation of the facts above — verify before relying. textX is a meta-language for building Domain-Specific Languages (DSLs) in Python by defining a grammar that automatically generates a parser and meta-model for your language. Yes. textX is actively maintained, has no known vulnerabilities, low install friction, and is well-suited for anyone building a textual DSL in Python. The framework is production-stable (Development Status 5), has been in development since 2014, and is appropriate for research, commercial, and open-source use under the MIT license. ## Install pip install textx uv add textx poetry add textx ## Installing textX Before you install: Low install friction with only two runtime dependencies (Arpeggio and importlib-metadata). The package is actively maintained with a recent release and no known vulnerabilities. License in practice: MIT license permits commercial and private use with minimal restrictions, making it suitable for both open-source and proprietary projects. Quickstart: from textx import metamodel_from_str grammar = """Model: items*=Item; Item: 'item' name=ID;""" mm = metamodel_from_str(grammar) model = mm.model_from_str("item foo item bar") Requires Python 3.8 or later; Arpeggio must be installed as a runtime dependency. Verify before relying: - Whether textX's PEG parser approach handles all grammar patterns needed for your specific DSL use case - Performance characteristics when parsing large or deeply nested models ## Package facts - License: not declared (permissive) - Python support: supports_current - Install friction: low - Maintenance: active - Downloads: 299.7K/month (top 15,000 on PyPI) - Known vulnerabilities: none known ## Tags DSL parser generator, domain-specific language framework, grammar-based parser python, meta-language implementation, textual language parser, xtext alternative python, PEG parser DSL builder, dsl-framework, parser-generator, language-implementation [View on SkillFed](https://skillfed.io/packages/textx) · [View on PyPI](https://pypi.org/project/textx/)