tag-expressions
Built-in functions, types, exceptions, and other objects.
What it is and what it does
tag-expressions is a Python port of Cucumber's tag expression evaluator. It takes a logical expression written with tags and boolean operators (and, or, not) and compiles it into an evaluable form, then checks whether a given set of tags satisfies that expression. The package uses a modified Shunting Yard algorithm to parse infix expressions into an internal representation that respects operator precedence: parentheses, then or, then and, then not.
It's designed for test filtering and tagging scenarios, particularly in BDD frameworks like Cucumber and radish. You write an expression like '(a and b) or (c and d)', compile it once, then evaluate it repeatedly against different tag lists to determine whether they match the filter criteria.
Use it for:
- Filter test cases in BDD frameworks by tag combinations without re-parsing the expression each time
- Build dynamic test selection logic where users specify tag filters as human-readable boolean expressions
- Implement tag-based feature gating or conditional logic in test runners or CI pipelines
- Parse and evaluate user-supplied tag queries in applications that organize content or items by tags
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Parses and evaluates logical tag expressions using a modified Shunting Yard algorithm, supporting and, or, and not operators to filter data based on tag membership.
Yes, if you need to evaluate logical tag expressions in a test or filtering context. The package is stable, dependency-free, and supports modern Python versions. The copyleft license is a consideration for proprietary use. Dormancy is not a blocker for a mature, focused library with no external dependencies, but verify it meets your Python version and licensing requirements before adopting.
Install
tag-expressions on PyPI
pip
pip install tag-expressionsuv
uv add tag-expressionspoetry
poetry add tag-expressionsInstalling tag-expressions
Before you install
Low install friction with no runtime dependencies. Repository is dormant (last commit 2024-11-23, 629 days since release), but the package is marked Production/Stable and supports modern Python versions through 3.13.
License in practice
Licensed under GPLv3+, a copyleft license requiring derivative works to be distributed under the same terms. Use in proprietary software may require careful review of your distribution model.
Quickstart
from tagexpressions import parse
expression = '(a and b) or (c and d)'
compiled = parse(expression)
data = ['a', 'b', 'c', 'd']
result = compiled.evaluate(data) # True
Verify before relying
- Whether the package is actively maintained or if dormancy poses a risk for future Python compatibility
- Real-world usage frequency beyond the stated 176,087 monthly downloads ranking
Package facts
| License | not declared (copyleft) |
| Python support | not specified |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | none |
| Maintenance | dormant — 629 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 176,087/month — #10,252 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: tag_expressions-2.0.1-py3-none-any.whl
Tags
More Testing packages
Pluggy provides a plugin system that lets you…
permissive · top 100 on PyPI
pytestpytest is a testing framework that lets you…
permissive · top 100 on PyPI
virtualenvvirtualenv creates isolated Python environments…
permissive · top 100 on PyPI
coverageCoverage.py measures which lines of Python code…
permissive · top 1,000 on PyPI
pytest-asynciopytest-asyncio is a pytest plugin that enables…
permissive · top 1,000 on PyPI
pytest-json-ctrfA pytest plugin that generates test reports in…
permissive · top 1,000 on PyPI
cucumber-tag-expressionsParses and evaluates boolean tag expressions…
permissive · top 5,000 on PyPI
boolean.pyParse, simplify, and compare boolean…
permissive · top 1,000 on PyPI
simpleevalEvaluates mathematical and logical expressions…
permissive · top 5,000 on PyPI
levalLeval evaluates limited expressions safely by…
permissive · top 15,000 on PyPI
license-expressionParses, validates, simplifies, and normalizes…
permissive · top 1,000 on PyPI
py-expression-evalParses and evaluates mathematical expressions…
permissive · top 15,000 on PyPI
greeneryParses and manipulates regular expressions by…
permissive · top 15,000 on PyPI
cucumber-expressionsCucumber Expressions provides a simpler, more…
permissive · top 5,000 on PyPI
snuggsSnuggs evaluates s-expressions (Lisp-like…
permissive · top 15,000 on PyPI
astevalAsteval is a safe Python expression and…
permissive · top 5,000 on PyPI