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

Deptry fails to parse jupyter notebooks with special syntax and line continuation characters #653

Closed
jmbond opened this issue Apr 1, 2024 · 2 comments · Fixed by #656
Closed
Assignees
Labels
bug Something isn't working

Comments

@jmbond
Copy link

jmbond commented Apr 1, 2024

When parsing jupyter notebooks that uses magic functions (starting with %), call outs to shell (starting with !) or line continuation characters (lines ending with \), deptry fails.

These parsing errors can be seen by running the sample notebooks in this repo. There I have created three notebooks that showcase the errors, one containing a magic function, one calling out to shell, and one using a continuation character. The warnings are provided below:

$ deptry -ddg dev .
Scanning 4 files...
Warning: Skipping processing of notebook-exclamation.ipynb because of the following error: "SyntaxError: invalid syntax. Got unexpected token '!' at byte offset 0".
Warning: Skipping processing of notebook-line-continuation.ipynb because of the following error: "SyntaxError: invalid syntax. Got unexpected token Newline at byte offset 9".
Warning: Skipping processing of notebook-percent.ipynb because of the following error: "SyntaxError: invalid syntax. Got unexpected token '%' at byte offset 19".

pyproject.toml: DEP002 'numpy' defined as a dependency but not used in the codebase
pyproject.toml: DEP002 'jupyter' defined as a dependency but not used in the codebase
Found 2 dependency issues.

For more information, see the documentation: https://deptry.com/

I would expect deptry to be able to parse these notebooks.

My system:

$ uname -a
Linux XXXX 5.15.146.1-microsoft-standard-WSL2 #1 SMP Thu Jan 11 04:09:03 UTC 2024 x86_64 x86_64 x86_64 GNU/Linux
$ python --version
Python 3.12.2
$ deptry --version
deptry 0.15.0
@jmbond jmbond added the bug Something isn't working label Apr 1, 2024
@mkniewallner mkniewallner self-assigned this Apr 1, 2024
@jmbond
Copy link
Author

jmbond commented Apr 2, 2024

This was quick, thanks! Love your project!

@mkniewallner
Copy link
Collaborator

Thanks for the feedback and the report 🙂 we'll make a release in the coming days.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants