pre-commit removes `# -*- coding: utf-8 -*-` pragma
See original GitHub issueHello,
My CICD is running pre-commit run
And it wants to remove the first line of percent file generate with
jupytext --to py notebook.ipynb --set-formats "ipynb,py:percent"
The first line is:
# -*- coding: utf-8 -*-
Related to the following hook: https://github.com/pre-commit/pre-commit-hooks/blob/master/pre_commit_hooks/fix_encoding_pragma.py
I would like to know what is the best way to handle this issue? Remove the line? Add some setting in pre-commit or jupytext?
Issue Analytics
- State:
- Created 2 years ago
- Comments:11 (5 by maintainers)
Top Results From Across the Web
Supported hooks - pre-commit
pycln - A formatter for finding and removing unused import statements. github.com/nbQA-dev/nbQA. nbqa - Run any standard Python code quality tool on a...
Read more >pre-commit-hooks - Git at Google
Add # -*- coding: utf-8 -*- to the top of python files. To remove the coding pragma pass --remove (useful in a python3-only...
Read more >.pre-commit-config.yaml · TencentARC/GFPGANv1 at main
... and remove incorrect entry for pkg-resources==0.0.0 - id: fix-encoding-pragma # Remove the coding pragma: # -*- coding: utf-8 -*- args: ["--remove"] ...
Read more >.pre-commit-config.yaml · master · Zihao Wei / A-ESRGAN · GitLab
id: fix-encoding-pragma # Remove the coding pragma: # -*- coding: utf-8 -*-. 44. args: ["--remove"]. 45. - id: mixed-line-ending # Replace or check...
Read more >Pre-commit Pylint "exit code: 32" upon committing, no issues ...
The issue was caused by #"--ignore-long-lines", # Ignores long lines. in the .pre-commit-config.yaml . I assume it conflicts with the line ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Oh that’s interesting - maybe it’s time to remove this - I’ll give it a try and keep you posted.
I just look into the code and I saw: https://github.com/mwouts/jupytext/blob/cbfe2ff9e06610f2ddefd4d98646a551c25fba86/jupytext/header.py#L63-L67
I just tried now with an empty notebook, and it works, no first encoding line added. So It means have some non ascii characters in the notebook I was facing the issue with.
Sorry!