bndr / pipreqs

pipreqs - Generate pip requirements.txt file based on imports of any project. Looking for maintainers to move this project forward.
Apache License 2.0
6.38k stars 388 forks source link

Error when used on a project containing Cython PYX files #231

Closed HunterAP23 closed 3 years ago

HunterAP23 commented 3 years ago

I have multiple PYX files that use Cython syntax for defining functions and variables in a C-like way. I have this function definition: cdef void my_func(str msg):

Pipreqs sees the cdef void part of the function declaration as a syntax error and exits:

  File "<unknown>", line 5
    cdef void my_func(str msg):
         ^
SyntaxError: invalid syntax

I could just ignore any PYX files from being parsed by pipreqs, but I don't want to have any missing dependencies for the project by doing so.

HunterAP23 commented 3 years ago

Ignore this issue, it was due to user error The file in question had a .py extension instead of the correct .pyx extension.