skillfed

tag-expressions

Built-in functions, types, exceptions, and other objects.

tag-expressions v2.0.1 176.1K downloads/30d#10,252 on PyPI5
Copyleft license DORMANT released

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-expressions

uv

uv add tag-expressions

poetry

poetry add tag-expressions

Installing 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

Development Status :: 5 - Production/StableEnvironment :: ConsoleLicense :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)Operating System :: MacOS :: MacOS XOperating System :: POSIXOperating System :: POSIX :: LinuxProgramming Language :: PythonProgramming Language :: Python :: 2Programming Language :: Python :: 2.7Programming Language :: Python :: 3Programming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.3Programming Language :: Python :: 3.4Programming Language :: Python :: 3.5Programming Language :: Python :: 3.6Programming Language :: Python :: 3.7Programming Language :: Python :: 3.8Programming Language :: Python :: 3.9Programming Language :: Python :: ImplementationProgramming Language :: Python :: Implementation :: CPythonProgramming Language :: Python :: Implementation :: PyPyTopic :: Software Development :: Testing

Tags

tag expression parserlogical tag filteringboolean tag evaluationtag expression evaluatorand or not tag logicshunting yard parsertag-based filtering
bdd-testingtag-filtering

More Testing packages