ducminh-phan / reformat-gherkin

Formatter for Gherkin language
MIT License
22 stars 13 forks source link

Cattrs Error with Python3.9 #44

Closed jhoover4 closed 3 years ago

jhoover4 commented 3 years ago

Describe the bug

Looks like this is having trouble running with Python3.9 for me. It seems to be an issue with Cattrs.

To Reproduce

Using Pre-Commit, I get this error:

reformat-gherkin.........................................................Failed
- hook id: reformat-gherkin
- exit code: 1

Traceback (most recent call last):
  File "/Users/jordan.hoover/.cache/pre-commit/repoaku2szup/py_env-python3/bin/reformat-gherkin", line 5, in <module>
    from reformat_gherkin.cli import main
  File "/Users/jordan.hoover/.cache/pre-commit/repoaku2szup/py_env-python3/lib/python3.9/site-packages/reformat_gherkin/cli.py", line 6, in <module>
    from .core import reformat
  File "/Users/jordan.hoover/.cache/pre-commit/repoaku2szup/py_env-python3/lib/python3.9/site-packages/reformat_gherkin/core.py", line 16, in <module>
    from .parser import parse
  File "/Users/jordan.hoover/.cache/pre-commit/repoaku2szup/py_env-python3/lib/python3.9/site-packages/reformat_gherkin/parser.py", line 5, in <module>
    from cattr.converters import Converter
  File "/Users/jordan.hoover/.cache/pre-commit/repoaku2szup/py_env-python3/lib/python3.9/site-packages/cattr/__init__.py", line 2, in <module>
    from .converters import Converter, UnstructureStrategy
  File "/Users/jordan.hoover/.cache/pre-commit/repoaku2szup/py_env-python3/lib/python3.9/site-packages/cattr/converters.py", line 15, in <module>
    from ._compat import (
  File "/Users/jordan.hoover/.cache/pre-commit/repoaku2szup/py_env-python3/lib/python3.9/site-packages/cattr/_compat.py", line 87, in <module>
    from typing import _Union
ImportError: cannot import name '_Union' from 'typing' (/usr/local/Cellar/python@3.9/3.9.2/Frameworks/Python.framework/Versions/3.9/lib/python3.9/typing.py)

My pre-commit-config.yaml looks like this:

repos:
  - repo: https://github.com/ducminh-phan/reformat-gherkin
    rev: v2.0.0
    hooks:
      - id: reformat-gherkin

Steps to reproduce the behaviour

See above

Expected behaviour

Expected reformat-gherkin to run with .pre-commit correctly without errors.

Actual behaviour

I received the error as noted above.

Environment

Additional context

May be related to this issue: https://github.com/Tinche/cattrs/issues/46, which seems to have been fixed.

From the Poetry file it seems like the latest version should be being used, so I'm not sure whats happening here :/. https://github.com/ducminh-phan/reformat-gherkin/blob/master/pyproject.toml#L34

ducminh-phan commented 3 years ago

@jhoover4 Could you try again with rev: v2.0.2 instead of rev: v2.0.0?

jhoover4 commented 3 years ago

Wow yep that worked 🤦 . Sorry I looked at the releases not the tags. Might want to add it there?

But thanks for the quick help! Much appreciated.