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

deterministic ordering of notebook creation #133

Closed
clarkevans opened this issue Dec 28, 2023 · 3 comments
Closed

deterministic ordering of notebook creation #133

clarkevans opened this issue Dec 28, 2023 · 3 comments

Comments

@clarkevans
Copy link

For those of us who have one notebook that must run before others, it would be great if the notebooks were generated in the order as specified by "[frontmatter] order=n", as a fallback, use of alphabetic sort would also be helpful.

@fonsp
Copy link
Member

fonsp commented Jan 18, 2024

Hey Clark! Right now they run in reverse alphabetical order, in the order listed in the index, e.g. https://mit-c25-fall22.netlify.app/ . I like the suggestion to use the order frontmatter!

(It's reversed because in one case I needed week9 to be online quicker than week1 🙈)

@clarkevans
Copy link
Author

@fonsp looks like this is configurable externally...

function notebook_order(path)
    fm = PlutoSliderServer.Pluto.frontmatter(joinpath(source_dir[], path))
    order_s = get(fm, "order", nothing)
    order = typemax(Int)
    if order_s isa String
        order = something(tryparse(Int, order_s), order)
    end
    order
end

const notebook_paths =
    [path
     for (order, path) in sort([(notebook_order(path), path)
                                for path in PlutoSliderServer.find_notebook_files_recursive(source_dir[])])]

export_directory(
    source_dir[],
    notebook_paths = notebook_paths,
    Export_ignore_cache = ignore_cache[] ? ["*"] : String[],
    Export_output_dir = output_dir[],
    Export_cache_dir = cache_dir[],
    Export_create_pluto_featured_index = true,
    Export_offer_binder = false)

@clarkevans
Copy link
Author

So, let me close this ticket.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants