You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Support later python features such as Python 3.10 feature "Structural Pattern Matching" #324
If I want to use the match-case pattern, I can see parse error in the output. I could not find any information which Python versions are officially supported by this plugin. The only information I could find is the file "setup.tmpl" with the newest Python version 3.7.
Please use the following screenshot as the easiest way to reproduce it. This is not how I want to use the match-case in production.
To Reproduce
Steps (or project) to reproduce the behavior:
Initialise a gauge project: gauge init python
Use the following piece of code:
@step("Almost all words have vowels <table>")
def assert_words_vowel_count(table: Table):
for row in table:
word = str(row[0])
match word:
case "Gauge":
assert number_of_vowels(word) == 3
case "Mingle":
assert number_of_vowels(word) == 2
case "Snap" | "GoCD":
assert number_of_vowels(word) == 1
case "Rhythm":
assert number_of_vowels(word) == 0
case _:
assert False
Run the gauge command
See error
Logs
Failed to parse c:\xxx\gauge_match_case_example\step_impl\step_impl.py: The only possible keyword before an atomtrailers is 'await', not 'match'
Expected behavior
I can use Python 3.10 features like the Structural Pattern Matching.
At some point in #96 redbaron was replaced with parso, and then replaced again with redbaron in #221 with seemingly little discussion. At least parso is still supported, redbaron/baron is definitely dead.
I guess at some point parso didnt do so well with python 3.9 (#220) and hence @bugdiver removed the parso support and made redbaron the default (and redbaron was quite well maintained back then)
We could bring back the option to swap parsers based on the previous commits
changed the title [-]Python 3.10 feature "Structural Pattern Matching" not supported[/-][+]Support later python features such as Python 3.10 feature "Structural Pattern Matching" [/+]on Nov 2, 2025
Activity
chadlwilson commentedon Sep 26, 2024
The problem is likely that the parsing is based on https://github.com/PyCQA/baron which seems dead, and likely does not support many things introduced in Python 3.8+, simply given its age.
sriv commentedon Sep 26, 2024
we may need to look at an alternative like rope (https://rope.readthedocs.io/en/latest/library.html)
chadlwilson commentedon Sep 26, 2024
Related to #233 also.
At some point in #96 redbaron was replaced with parso, and then replaced again with redbaron in #221 with seemingly little discussion. At least parso is still supported, redbaron/baron is definitely dead.
sriv commentedon Sep 26, 2024
I guess at some point parso didnt do so well with python 3.9 (#220) and hence @bugdiver removed the parso support and made redbaron the default (and redbaron was quite well maintained back then)
We could bring back the option to swap parsers based on the previous commits
[-]Python 3.10 feature "Structural Pattern Matching" not supported[/-][+]Support later python features such as Python 3.10 feature "Structural Pattern Matching" [/+]