From 8e5a64d303f00a9d2a6277d6faa671106765ee4b Mon Sep 17 00:00:00 2001 From: Tony Tung Date: Fri, 31 May 2019 01:37:04 -0700 Subject: [PATCH] Fix how we structure the run notebook rules. With this change, one can just run `make notebooks/py/smFISH.py` or `make smFISH.py`. For the examples in `docs/source/_static/data_processing_examples/`, we can also directly invoke them, i.e., `make 3d_smFISH.py`. Also, we run all notebooks with ipython instead of python now. --- .travis.yml | 24 +++++++++---------- .../data_processing_examples/subdir.mk | 8 +++---- notebooks/subdir.mk | 14 +++++++---- 3 files changed, 26 insertions(+), 20 deletions(-) diff --git a/.travis.yml b/.travis.yml index c3ffe38a7..634f5962a 100644 --- a/.travis.yml +++ b/.travis.yml @@ -29,40 +29,40 @@ jobs: script: make docker - name: smFISH Notebook if: type = push and branch =~ /^(master|merge)/ - script: travis_wait make install-dev run__notebooks/py/smFISH.py + script: travis_wait make install-dev notebooks/py/smFISH.py - name: MERFISH Notebook if: type = push and branch =~ /^(master|merge)/ - script: travis_wait make install-dev run__notebooks/py/MERFISH.py + script: travis_wait make install-dev notebooks/py/MERFISH.py - name: osmFISH Notebook if: type = push and branch =~ /^(master|merge)/ - script: make install-dev run__notebooks/py/osmFISH.py + script: make install-dev notebooks/py/osmFISH.py - name: DARTFISH Notebook if: type = push and branch =~ /^(master|merge)/ - script: make install-dev run__notebooks/py/DARTFISH.py + script: make install-dev notebooks/py/DARTFISH.py - name: Simulation Notebook if: type = push and branch =~ /^(master|merge)/ - script: make install-dev run__notebooks/py/Starfish_simulation.py + script: make install-dev notebooks/py/Starfish_simulation.py - name: ISS Notebook if: type = push and branch =~ /^(master|merge)/ - script: make install-dev run__notebooks/py/ISS.py + script: make install-dev notebooks/py/ISS.py - name: BaristaSeq Notebook if: type = push and branch =~ /^(master|merge)/ - script: make install-dev run__notebooks/py/BaristaSeq.py + script: make install-dev notebooks/py/BaristaSeq.py - name: SeqFISH Notebook if: type = push and branch =~ /^(master|merge)/ - script: make install-dev run__notebooks/py/SeqFISH.py + script: make install-dev notebooks/py/SeqFISH.py # - name: STARmap Notebook # if: type = push and branch =~ /^(master|merge)/ -# script: make install-dev run__notebooks/py/STARmap.py +# script: make install-dev notebooks/py/STARmap.py - name: 3D smFISH data processing example if: type = push and branch =~ /^(master|merge)/ - script: make install-dev run__3d_smFISH.py + script: make install-dev 3d_smFISH.py - name: iss_cli.sh data processing example if: type = push and branch =~ /^(master|merge)/ - script: make install-dev run__iss_cli.sh + script: make install-dev iss_cli.sh - name: iss_pipeline.py data processing example if: type = push and branch =~ /^(master|merge)/ - script: make TESTING=1 install-dev run__iss_pipeline.py + script: make TESTING=1 install-dev iss_pipeline.py - name: Released Notebooks if: type = cron and branch =~ /^(master|merge)/ script: make check-notebooks install-released-notebooks-support run-notebooks diff --git a/docs/source/_static/data_processing_examples/subdir.mk b/docs/source/_static/data_processing_examples/subdir.mk index 68e8e7eb9..0f16ffb4c 100644 --- a/docs/source/_static/data_processing_examples/subdir.mk +++ b/docs/source/_static/data_processing_examples/subdir.mk @@ -1,15 +1,15 @@ path := docs/source/_static/data_processing_examples py_files := $(wildcard $(path)/*.py) sh_files := $(wildcard $(path)/*.sh) -py_run_targets := $(patsubst $(path)/%,run__%,$(py_files)) -sh_run_targets := $(patsubst $(path)/%,run__%,$(sh_files)) +py_run_targets := $(patsubst $(path)/%,%,$(py_files)) +sh_run_targets := $(patsubst $(path)/%,%,$(sh_files)) PYTHON := ipython run-examples: $(py_run_targets) $(sh_run_targets) -$(py_run_targets): run__% : +$(py_run_targets): % : [ -e $(path)/$*.skip ] || $(PYTHON) $(path)/$* -$(sh_run_targets): run__% : +$(sh_run_targets): % : [ -e $(path)/$*.skip ] || $(SHELL) $(path)/$* diff --git a/notebooks/subdir.mk b/notebooks/subdir.mk index fdf642cbc..872055bdc 100644 --- a/notebooks/subdir.mk +++ b/notebooks/subdir.mk @@ -1,11 +1,12 @@ -py_files := $(wildcard notebooks/py/*.py) +pypath := notebooks/py +py_files := $(wildcard $(pypath)/*.py) ipynb_files := $(wildcard notebooks/*.ipynb) -py_run_targets := $(addprefix run__, $(py_files)) +py_run_targets := $(patsubst $(pypath)/%,%,$(py_files)) py_check_targets := $(addprefix check__, $(py_files)) ipynb_validate_targets := $(addprefix validate__, $(ipynb_files)) ipynb_regenerate_targets := $(addprefix regenerate__notebooks/, $(addsuffix .ipynb, $(notdir $(basename $(py_files))))) py_regenerate_targets := $(addprefix regenerate__notebooks/py/, $(addsuffix .py, $(notdir $(basename $(ipynb_files))))) -PYTHON := python +PYTHON := ipython fast: $(ipynb_validate_targets) run-notebooks: $(py_run_targets) @@ -14,7 +15,10 @@ validate-notebooks: $(ipynb_validate_targets) regenerate-ipynb: $(ipynb_regenerate_targets) regenerate-py: $(py_regenerate_targets) -$(py_run_targets): run__%.py : +$(py_run_targets): %.py : + [ -e $*.py.skip ] || $(PYTHON) $(pypath)/$*.py + +$(py_files): %.py : [ -e $*.py.skip ] || $(PYTHON) $*.py $(py_check_targets): check__%.py : @@ -30,3 +34,5 @@ $(ipynb_regenerate_targets): regenerate__notebooks/%.ipynb : notebooks/py/%.py $(py_regenerate_targets): regenerate__notebooks/py/%.py : notebooks/%.ipynb nbencdec encode notebooks/$*.ipynb notebooks/py/$*.py + +.PHONY : $(py_files)