Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix pre-commit errors with black #89

Merged
merged 1 commit into from
Nov 10, 2021
Merged

Conversation

joao-p-marques
Copy link
Member

https://github.com/OCA/product-attribute/runs/4165598273?check_suite_focus=true#step:4:112

Traceback (most recent call last):
  File "/home/runner/.cache/pre-commit/repowzndsk7_/py_env-python3/bin/black", line 5, in <module>
    from black import patched_main
  File "/home/runner/.cache/pre-commit/repowzndsk7_/py_env-python3/lib/python3.9/site-packages/black/__init__.py", line 52, in <module>
    from typed_ast import ast3, ast27
  File "/home/runner/.cache/pre-commit/repowzndsk7_/py_env-python3/lib/python3.9/site-packages/typed_ast/ast3.py", line 40, in <module>
    from typed_ast import _ast3
ImportError: /home/runner/.cache/pre-commit/repowzndsk7_/py_env-python3/lib/python3.9/site-packages/typed_ast/_ast3.cpython-39-x86_64-linux-gnu.so: undefined symbol: _PyUnicode_DecodeUnicodeEscape

Appears to be an error introduced by https://github.com/python/typed_ast with Python 3.9. As explained in https://github.com/python/typed_ast#python-38, this library won't be supporting Python 3.8+

Black fixes this after release 21, but we can't bump the version in older branches without reformatting, so we need to pin the Python version instead.

@Tecnativa
TT32912

ping @yajo @pedrobaeza @sbidoul

Copy link
Member

@pedrobaeza pedrobaeza left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What a nuisance the things that the maintainers of the libraries do...

We need to unfold this change massively. @sbidoul can you do it or instruct me how to do it in the OCA's server?

@joao-p-marques
Copy link
Member Author

I just wanted to push a test PR into one of the affected repos to check, will do it in the next few minutes...

@sbidoul
Copy link
Member

sbidoul commented Nov 10, 2021

We could also pin python 3.9.7. The problem is due to the GitHub action runners now using python 3.9.8 since last night and the "old" version on black used on branch 14 depends on a library names typed_ast which apparently is not compatible...

@joao-p-marques
Copy link
Member Author

We could also pin python 3.9.7. The problem is due to the GitHub action runners now using python 3.9.8 since last night and the "old" version on black used on branch 14 depends on a library names typed_ast which apparently is not compatible...

Oh ok, that seems less conflicting, although it is kinda dangerous if typed_ast won't get support for this Python version, but again the solution would be to pin to 3.7... 🤷‍♂️

I will change it to 3.9.7 then

@joao-p-marques
Copy link
Member Author

I just wanted to push a test PR into one of the affected repos to check, will do it in the next few minutes...

I couldn't deploy the copier change as is in another repo, but I opened OCA/partner-contact#1176 to test the change manually, and I tried a copier copy locally and the file is generated correctly.

https://github.com/OCA/product-attribute/runs/4165598273?check_suite_focus=true#step:4:112

```
Traceback (most recent call last):
  File "/home/runner/.cache/pre-commit/repowzndsk7_/py_env-python3/bin/black", line 5, in <module>
    from black import patched_main
  File "/home/runner/.cache/pre-commit/repowzndsk7_/py_env-python3/lib/python3.9/site-packages/black/__init__.py", line 52, in <module>
    from typed_ast import ast3, ast27
  File "/home/runner/.cache/pre-commit/repowzndsk7_/py_env-python3/lib/python3.9/site-packages/typed_ast/ast3.py", line 40, in <module>
    from typed_ast import _ast3
ImportError: /home/runner/.cache/pre-commit/repowzndsk7_/py_env-python3/lib/python3.9/site-packages/typed_ast/_ast3.cpython-39-x86_64-linux-gnu.so: undefined symbol: _PyUnicode_DecodeUnicodeEscape
```

Appears to be an error introduced by https://github.com/python/typed_ast with Python 3.9. As explained in https://github.com/python/typed_ast#python-38, this library won't be supporting Python 3.8+

Black fixes this after release 21, but we can't bump the version in older branches without reformatting, so we need to pin the Python version instead.

TT32912
@sbidoul
Copy link
Member

sbidoul commented Nov 10, 2021

Thanks for addressing this! I'll deploy tonight or tomorrow.

@sbidoul
Copy link
Member

sbidoul commented Nov 10, 2021

And my motivation for automating OCA/maintainer-tools#486 is increasing :)

@sbidoul
Copy link
Member

sbidoul commented Nov 10, 2021

Applied and tested on server-tools 14.0 and 15.0. Deployment in progress on all other repos.

@pedrobaeza pedrobaeza deleted the fix-black-ast branch November 10, 2021 20:15
@pedrobaeza
Copy link
Member

Thanks!

@simahawk
Copy link
Contributor

I was about to tackle this and trying to understand why some PRs where suddenly passing 😅
Thanks for the fix! 🙌

@tafaRU
Copy link
Member

tafaRU commented Nov 11, 2021

Thanks!

pedrobaeza added a commit to OCA/OpenUpgrade that referenced this pull request Nov 11, 2021
@houssine78
Copy link
Sponsor

thanks a lot !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

7 participants