Issue when using with the black (formatting) module
- Dominant language
- Python
- Stars
- 7.5k
- Forks
- 424
- PR merge metrics
- No merged PRs in 30d
Description
```
ERROR: Failed on file: .\.venv\Lib\site-packages\black\linegen.py
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\V\AppData\Local\Programs\Python\Python311\Lib\site-packages\pipreqs\pipreqs.py", line 131, in get_all_imports
raise exc
File "C:\Users\V\AppData\Local\Programs\Python\Python311\Lib\site-packages\pipreqs\pipreqs.py", line 117, in get_all_imports
tree = ast.parse(contents)
^^^^^^^^^^^^^^^^^^^
File "C:\Users\V\AppData\Local\Programs\Python\Python311\Lib\ast.py", line 50, in parse
return compile(source, filename, mode, flags,
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "", line 412
Ø: Set[str] = set()
^
SyntaxError: invalid character '˜' (U+02DC)
```
This seems to be occurring due to this line in this file - https://github.com/psf/black/blob/a552f7096a9f6e016c9bb1df1e0a77a17caeec1c/src/black/linegen.py#L471 due to the weird variable name.
Because Black is such a popular library, and the variable name seems to be valid, any workarounds for using pipreqs to generate a requirements.txt file?
Contributor guide
Research direction
Start in pipreqs.py, especially get_all_imports and its ast.parse call, then reproduce the failure against Black's linegen.py at the linked location. Done means pipreqs can process this Black file without the reported SyntaxError; the issue does not identify an existing test to run.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- cli, tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100