diff --git a/pipreqs/pipreqs.py b/pipreqs/pipreqs.py index efccefc..fc1ab81 100644 --- a/pipreqs/pipreqs.py +++ b/pipreqs/pipreqs.py @@ -157,8 +157,6 @@ def get_all_imports(path, encoding="utf-8", extra_ignore_dirs=None, follow_links continue else: logging.error("Failed on file: %s" % file_name) - if filter_ext(file_name, [".ipynb"]) and PythonExporter and not ignore_notebooks: - logging.error("Magic command without % might be failed") raise exc # Clean up imports diff --git a/tests/_data_notebook/magic_commands.ipynb b/tests/_data_notebook/magic_commands.ipynb new file mode 100644 index 0000000..23dc2d2 --- /dev/null +++ b/tests/_data_notebook/magic_commands.ipynb @@ -0,0 +1,65 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Magic test" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "%automagic true" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "ls -la\n", + "logstate" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "ls -la" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "%automagic false" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "ls -la" + ] + } + ], + "metadata": { + "language_info": { + "name": "python" + }, + "orig_nbformat": 4 + }, + "nbformat": 4, + "nbformat_minor": 2 +}