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

Document examples of use with GNU make #67

Open
jayqi opened this issue Jan 11, 2021 · 2 comments
Open

Document examples of use with GNU make #67

jayqi opened this issue Jan 11, 2021 · 2 comments
Labels
documentation Improvements or additions to documentation good first issue Good for newcomers

Comments

@jayqi
Copy link
Member

jayqi commented Jan 11, 2021

From @cccntu, originally mentioned here

I also tried the export command, but found they always exports every files. Maybe we can check the modified time and only export the necessary files? (like in Make) So user can add this command in Makefile without generating all the files each time. And add a flag to force regenerating everything.

@jayqi
Copy link
Member Author

jayqi commented Jan 11, 2021

@cccntu One thing to note that might be helpful (though it doesn't address the feature request itself): if the path you specify is to one notebook file (instead of a directory), it will only export that notebook. So in cases where you know a priori which notebook you want to export, this can save you some unneeded computation.

EDIT: Although now that I think about this, potentially you can just use make directly, with recipes that use the export command that points to a single file. Let us know if this works!

@cccntu
Copy link

cccntu commented Jan 12, 2021

@jayqi Thanks for the suggestion, I did not know about that.

I was gonna say it would be too much work to add every file to Makefile, then I remembered that you can use wildcard in Makefile.
Though it took me some time to figure it out, I got it working! Here are the lines I added in my Makefile.

nb:$(patsubst notebooks/%.ipynb, notebooks/script/%.py, $(wildcard notebooks/*.ipynb))
notebooks/script/%.py : notebooks/%.ipynb
        nbautoexport export $?

run make nb

@jayqi jayqi changed the title Have export command check modified times to determine if exporting is necessary Document examples of use with GNU make Jan 24, 2021
@jayqi jayqi added documentation Improvements or additions to documentation good first issue Good for newcomers and removed enhancement New feature or request labels Mar 25, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

2 participants