Giter Site home page Giter Site logo

Comments (10)

arokem avatar arokem commented on September 13, 2024 1

Yes. I think that would be an improvement. I just found myself a few days ago trying to start one of these again and being confused about what I am supposed to do (e.g., which files are optional and which ones are required).

from jupyter-book.

choldgraf avatar choldgraf commented on September 13, 2024 1

see #89

from jupyter-book.

choldgraf avatar choldgraf commented on September 13, 2024 1

@gnestor well I think we are one step ahead of you :-) there's a PR that implements a jupyter-book CLI here: #89 would love to hear what you think about it!

from jupyter-book.

choldgraf avatar choldgraf commented on September 13, 2024 1

this is now done with the CLI!

from jupyter-book.

choldgraf avatar choldgraf commented on September 13, 2024

cc @yuvipanda who I think has a good eye for user-interface design! do you have any thoughts on the above?

from jupyter-book.

choldgraf avatar choldgraf commented on September 13, 2024

hmmm, I'm a bit worried that cookiecutter won't work here, this is primarily because cookiecutter uses liquid templates, which also use the {{ convention used throughout this site. This means that we'd have to wrap all of our {{ in raw tags, or double-escape them ({{ {{ site.xxx }} }}), see cookiecutter/cookiecutter#9

That seems like enough addition of complexity that cookiecutter isn't quite worth it. Moreover it seems that patches to cookiecutter will take a looong time to get merged, as the author(s) don't seem super invested in it in terms of time. :-/

Another option

Keep the book in a template-like form but a bit more light-weight than what cookiecutter uses. Split out the jupyter-book repo into two folders:

  • book_template/ would have a template book repository very similar to what is here now.
  • cli/ would have a little python package that controls jupyter-book.

You'd create a new jupyter book using a pattern like:

jupyter-book create
  --name mybook  # The name of the book to be created (also the output folder)
  [--version v0.1]  # Specifies a version of jupyter-book
  [--config myconfig.yaml]  # Pre-fill these configuration options
  [--content path/to/content/folder]  # Folder w/ Jupyter Notebooks + markdown files
  [--toc path/to/toc.yml]  # With URLs relative to the content folder
  [--css path/to/custom.css]  # Custom CSS rules to add to the site
  [--js path/to/script.js]  # Custom JS scripts to add to the site

In this case, we'd use ruamel to let the user give their own YAML configuration. This would simply update the fields that are in _config.yaml in the book_template/ folder. In this way there wouldn't be any live user-input, it'd only be a question of updating whatever fields are there.

from jupyter-book.

yuvipanda avatar yuvipanda commented on September 13, 2024

@choldgraf said this to me in person yesterday and I like it!

from jupyter-book.

arokem avatar arokem commented on September 13, 2024

from jupyter-book.

choldgraf avatar choldgraf commented on September 13, 2024

cool, will prototype something soon!

from jupyter-book.

gnestor avatar gnestor commented on September 13, 2024

Sorry for the delay! I was reading and thinking that this sounds like it would need its own CLI. AFAIK cookiecutters don't allow for arbitrary scripts to be run in response to inputs, so copying files from a contents folder into the project can't be accomplished by cookiecutters alone. You can get creative and inject paths into a python or bash script in the template and run that script as apart of setup.py or something. I'm glad that you arrived at a similar conclusion for completely different reasons! 👍

from jupyter-book.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.