Registry / data / pymeta3

pymeta3

JSON →
library0.5.1pypypi✓ verified 24d ago

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.

pip install PyMeta3
INSTALL
IMPORT
SIG · PYMETA3
P
pymeta3
datapythonv0.5.1
Install
2.4s avg
Import
832ms
Disk
17MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v0.5.1 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.95 runs
installs and imports cleanly · install 0.0s · import 0.858s · 19.3MB
glibc
py 3.103.95 runs
installs and imports cleanly · install 2.4s · import 0.806s · 20MB
17MB installed
● package 17MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

OMeta
from pymeta.grammar import OMeta

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.

from pymeta.grammar import OMeta exampleGrammar = """ ones ::= '1' '1' => 1 twos ::= '2' '2' => 2 stuff ::= (<ones> | <twos>)+ """ Example = OMeta.makeGrammar(exampleGrammar, {}) g = Example("11221111") result, error = g.apply("stuff") print(f"Result: {result}") print(f"Error: {error}")
Debug
Known issues
breakingPyMeta3 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.
fix
Always use `pip install PyMeta3` in a Python 3 environment. Do not confuse it with the older `pymeta` package.
affects: < 0.5.1 (original PyMeta) and Python 2.x (for PyMeta3)
gotchaThere 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.
fix
Double-check the package name and description on PyPI before installation. Use `pip install PyMeta3` specifically.
affects: All versions
deprecatedThe 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.
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.
affects: 0.5.1 and potentially earlier
Errors
Common errors & fixes
ModuleNotFoundError: No module named 'pymeta'
This error often occurs when developers intend to use `pymeta3` (the Python 3 compatible version) but mistakenly try to import the older `pymeta` package, or if `pymeta3` itself is not correctly installed and a general `pymeta` import is attempted.
fix
Ensure `pymeta3` is installed with `pip install PyMeta3` and then import from `pymeta.grammar` as in `from pymeta.grammar import OMeta`.
ModuleNotFoundError: No module named 'pymeta.grammar'
This error indicates that the `pymeta3` package, or its `pymeta.grammar` submodule, cannot be found. This typically happens if `pymeta3` is not installed, or if there's an issue with the Python environment or path.
fix
Install the `pymeta3` package using `pip install PyMeta3`. If it's already installed, verify your Python environment and ensure `pymeta3` is accessible by the interpreter being used.
AttributeError: module 'numpy' has no attribute 'bool'
This error arises when `pymeta3` or one of its dependencies attempts to use `numpy.bool`, which was deprecated in newer versions of NumPy (v1.20 and later) and subsequently removed. `pymeta3` was last updated in 2015, making it susceptible to such compatibility issues with newer libraries.
fix
To resolve this, you can downgrade your NumPy version to one that supports `numpy.bool` (e.g., `pip install numpy<1.24`) or modify the code (if possible) to replace `np.bool` with the built-in `bool` type.
Upgrade
Version history
0.5.1latest on PyPI · released Feb 22, 2015
Audit
Dependencies
PythonrequiredExplicitly a Python 3 compatible fork, therefore requires Python 3.x to run.
Agent activity
10 hits · last 30 days
node
8
Resources