{"id":5403,"library":"pymeta3","title":"PyMeta3","description":"PyMeta3 is a Python 3 compatible fork of PyMeta, an implementation of OMeta, an object-oriented pattern-matching language. It provides a compact syntax based on Parsing Expression Grammars (PEGs) for common lexing, parsing, and tree-transforming activities in a way that's easy to reason about for Python programmers. The current version is 0.5.1, with the last update released in February 2015, suggesting a low release cadence.","status":"maintenance","version":"0.5.1","language":"en","source_language":"en","source_url":"https://github.com/wbond/pymeta3","tags":["parsing","PEG","OMeta","pattern-matching","grammar","metaprogramming"],"install":[{"cmd":"pip install PyMeta3","lang":"bash","label":"Install PyMeta3"}],"dependencies":[{"reason":"Explicitly a Python 3 compatible fork, therefore requires Python 3.x to run.","package":"Python","optional":false}],"imports":[{"symbol":"OMeta","correct":"from pymeta.grammar import OMeta"}],"quickstart":{"code":"from pymeta.grammar import OMeta\n\nexampleGrammar = \"\"\"\nones ::= '1' '1' => 1\ntwos ::= '2' '2' => 2\nstuff ::= (<ones> | <twos>)+\n\"\"\"\n\nExample = OMeta.makeGrammar(exampleGrammar, {})\ng = Example(\"11221111\")\nresult, error = g.apply(\"stuff\")\n\nprint(f\"Result: {result}\")\nprint(f\"Error: {error}\")","lang":"python","description":"This example demonstrates how to define a simple grammar using PyMeta3, create a grammar object, and apply a rule to an input string. It defines rules 'ones' and 'twos' to match sequences of '1's and '2's respectively, and a 'stuff' rule that matches one or more occurrences of 'ones' or 'twos'. The `apply` method attempts to parse the input according to the specified rule and returns the result and any error encountered."},"warnings":[{"fix":"Always use `pip install PyMeta3` in a Python 3 environment. Do not confuse it with the older `pymeta` package.","message":"PyMeta3 is a fork specifically for Python 3. Attempting to use the original PyMeta (designed for Python 2) with Python 3, or PyMeta3 with Python 2, will lead to compatibility issues and breaking changes. Ensure your environment is Python 3.x.","severity":"breaking","affected_versions":"< 0.5.1 (original PyMeta) and Python 2.x (for PyMeta3)"},{"fix":"Double-check the package name and description on PyPI before installation. Use `pip install PyMeta3` specifically.","message":"There are multiple Python packages with similar names, which can lead to confusion and incorrect installations. These include `pymeta` (for Rust metaprogramming), `PythonMeta` (for meta-analysis), and `pymeta` (for document metadata extraction). Ensure you are installing `PyMeta3` for the OMeta-based pattern matching library.","severity":"gotcha","affected_versions":"All versions"},{"fix":"While still functional for its intended purpose, users should be aware of the limited ongoing support. Consider the implications for long-term projects or environments requiring frequent updates.","message":"The library has not seen a release since February 2015. This indicates a low level of active development and maintenance, which might mean unaddressed bugs, lack of support for newer Python features, or security vulnerabilities.","severity":"deprecated","affected_versions":"0.5.1 and potentially earlier"}],"env_vars":null,"last_verified":"2026-04-13T00:00:00.000Z","next_check":"2026-07-12T00:00:00.000Z"}