{"id":8696,"library":"tag-expressions","title":"Tag Expressions","description":"Tag Expressions is a Python library that provides an implementation for parsing and evaluating Cucumber Tag Expressions. It allows you to check if a set of tags matches a given boolean expression string. The current version is 2.0.1, with releases typically occurring for maintenance or minor feature additions, following a stable core API.","status":"active","version":"2.0.1","language":"en","source_language":"en","source_url":"https://github.com/timofurrer/tag-expressions","tags":["tagging","expressions","cucumber","boolean-logic","parser"],"install":[{"cmd":"pip install tag-expressions","lang":"bash","label":"Install latest version"}],"dependencies":[],"imports":[{"symbol":"evaluate","correct":"from tag_expressions import evaluate"}],"quickstart":{"code":"from tag_expressions import evaluate\n\n# Basic tag evaluation\nassert evaluate('tag1', ['tag1']) is True\nassert evaluate('tag1', ['tag2']) is False\n\n# AND operator\nassert evaluate('tag1 and tag2', ['tag1', 'tag2']) is True\nassert evaluate('tag1 and tag2', ['tag1']) is False\n\n# OR operator\nassert evaluate('tag1 or tag2', ['tag1']) is True\nassert evaluate('tag1 or tag2', ['tag2']) is True\n\n# NOT operator\nassert evaluate('not tag1', ['tag2']) is True\nassert evaluate('not tag1', ['tag1']) is False\n\n# Combined expression\nassert evaluate('(tag1 or tag2) and not tag3', ['tag1', 'tag4']) is True\nassert evaluate('(tag1 or tag2) and not tag3', ['tag2', 'tag4']) is True\nassert evaluate('(tag1 or tag2) and not tag3', ['tag1', 'tag3']) is False\n\nprint(\"All tag expressions evaluated successfully!\")","lang":"python","description":"This quickstart demonstrates how to import and use the `evaluate` function with various boolean tag expressions and tag lists."},"warnings":[{"fix":"Ensure your project is running on Python 3.8 or newer. If you need Python 2 compatibility, you must use a version prior to 2.0.0 (e.g., `pip install 'tag-expressions<2.0.0'`).","message":"Version 2.0.0 dropped support for Python 2.x. The library is now Python 3.8+ only.","severity":"breaking","affected_versions":">=2.0.0"},{"fix":"Always pass a list or other iterable of tag strings, even if there's only one tag. For example, `evaluate('tag1', ['tag1'])` not `evaluate('tag1', 'tag1')`.","message":"The `evaluate` function expects the `tags` argument to be an iterable (e.g., a list or set) of strings, not a single string.","severity":"gotcha","affected_versions":"all"},{"fix":"Refer to the Cucumber Tag Expressions documentation for the supported grammar and behavior to avoid unexpected evaluation results. Only `and`, `or`, `not`, and parentheses are supported.","message":"This library implements the *Cucumber* Tag Expressions grammar, which has specific syntax and operator precedence. It is not a general-purpose boolean expression parser.","severity":"gotcha","affected_versions":"all"}],"env_vars":null,"last_verified":"2026-04-16T00:00:00.000Z","next_check":"2026-07-15T00:00:00.000Z","problems":[{"fix":"Provide a list or other iterable of tag strings as the second argument to `evaluate`. Example: `evaluate('my_expression', ['tag1', 'tag2'])`.","cause":"The `evaluate` function was called without the required `tags` argument.","error":"TypeError: evaluate() missing 1 required positional argument: 'tags'"},{"fix":"Wrap your single tag string in a list. Example: `evaluate('my_expression', ['my_tag'])` instead of `evaluate('my_expression', 'my_tag')`.","cause":"A single string was passed as the `tags` argument to `evaluate` instead of an iterable of strings.","error":"TypeError: argument of type 'str' is not iterable"},{"fix":"Add `from tag_expressions import evaluate` at the top of your Python file.","cause":"The `evaluate` function was used without being correctly imported.","error":"NameError: name 'evaluate' is not defined"}]}