diff --git a/.gitignore b/.gitignore index 0bd7dd9df4747b57843832bc5e9a81187eac3e97..82c633d27c6d9c3b332b27e0e73a7eb05385934e 100644 --- a/.gitignore +++ b/.gitignore @@ -71,8 +71,6 @@ target/ # Jupyter Notebook .ipynb_checkpoints -# Jupyter Notebooks converted to python -notebooks/*.py # PyCharm .idea/ diff --git a/tests/simple_rail.py b/flatland/utils/simple_rail.py similarity index 100% rename from tests/simple_rail.py rename to flatland/utils/simple_rail.py diff --git a/requirements_dev.txt b/requirements_dev.txt index 25a1ff17cfa02a2e7c760ac912c828c376c3861f..957d78db7e89d2cb413ec91f55d8aaa83eb23a1e 100644 --- a/requirements_dev.txt +++ b/requirements_dev.txt @@ -17,3 +17,4 @@ importlib-metadata>=0.17 importlib-resources>=1.0.1 six>=1.12.0 attrs +ushlex diff --git a/setup.py b/setup.py index 0afa7bf1ba7ce9fbe170178caf808dd7ce267937..937d45e4a1552ca102046ea9ee6659c7bc0c84ec 100644 --- a/setup.py +++ b/setup.py @@ -28,6 +28,14 @@ def get_all_images_files(directory='./images/'): return ret +def get_all_notebook_files(directory='./notebooks/'): + ret = [] + for f in os.listdir(directory): + if os.path.isfile(os.path.join(directory, f)): + ret.append(directory + f) + return ret + + # Gather requirements from requirements_dev.txt install_reqs = [] requirements_path = 'requirements_dev.txt' @@ -63,7 +71,9 @@ setup( keywords='flatland', name='flatland-rl', packages=find_packages('.'), - data_files=[('svg', get_all_svg_files()), ('images', get_all_images_files())], + data_files=[('svg', get_all_svg_files()), + ('images', get_all_images_files()), + ('notebooks', get_all_notebook_files())], setup_requires=setup_requirements, test_suite='tests', tests_require=test_requirements, diff --git a/tests/__init__.py b/tests/__init__.py deleted file mode 100644 index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000 diff --git a/tests/test_flatland_envs_observations.py b/tests/test_flatland_envs_observations.py index d400dc226a71e1a9c185012fccae3c852bcd42aa..92ee4539f4e5def7de2041e7a69cccbcd7eaa59b 100644 --- a/tests/test_flatland_envs_observations.py +++ b/tests/test_flatland_envs_observations.py @@ -10,7 +10,7 @@ from flatland.envs.observations import GlobalObsForRailEnv, TreeObsForRailEnv from flatland.envs.predictions import ShortestPathPredictorForRailEnv from flatland.envs.rail_env import RailEnv, RailEnvActions from flatland.utils.rendertools import RenderTool -from tests.simple_rail import make_simple_rail +from flatland.utils.simple_rail import make_simple_rail """Tests for `flatland` package.""" diff --git a/tests/test_flatland_envs_predictions.py b/tests/test_flatland_envs_predictions.py index c90f91a041b16cee2dc55a58562d34a0b9100560..7eaa502de9095a3ec4da3c7a0f7ae5aff72a2534 100644 --- a/tests/test_flatland_envs_predictions.py +++ b/tests/test_flatland_envs_predictions.py @@ -10,7 +10,7 @@ from flatland.envs.observations import TreeObsForRailEnv from flatland.envs.predictions import DummyPredictorForRailEnv, ShortestPathPredictorForRailEnv from flatland.envs.rail_env import RailEnv from flatland.utils.rendertools import RenderTool -from tests.simple_rail import make_simple_rail +from flatland.utils.simple_rail import make_simple_rail """Test predictions for `flatland` package.""" diff --git a/tox.ini b/tox.ini index 193f052b072b812f5389355b6cde2ba576ada1fe..30062d24d19f658f78ad9e226a3ed65c8a52f8ae 100644 --- a/tox.ini +++ b/tox.ini @@ -154,9 +154,7 @@ commands = jupyter nbextension enable --py --sys-prefix widgetsnbextension jupyter nbextension install --py --sys-prefix jpy_canvas jupyter nbextension enable --py --sys-prefix jpy_canvas -; https://stackoverflow.com/questions/35545402/how-to-run-an-ipynb-jupyter-notebook-from-terminal/35545463 - sh -c 'ls {toxinidir}/notebooks/*.ipynb | xargs -n 1 jupyter nbconvert --to python' - sh -c 'ls {toxinidir}/notebooks/*.py | xargs -I{} -n 1 sh -c "echo -e \"\n====== Running {} ========\n\"; ipython {}"' + python notebooks/run_all_notebooks.py [testenv:start_jupyter] basepython = python