acquire-project / acquire-docs

https://acquire-project.github.io/acquire-docs/
0 stars 3 forks source link

Add jupytext #68

Closed melissawm closed 10 months ago

melissawm commented 11 months ago

Also sets up initial sync configuration between markdown and python files; adds download button to all tutorials; adds pre-commit hook to set up automatic check of sync'd md/py files.

I am happy to undo some of the whitespace changes if this is too much, but since jupytext can be very picky around new lines, I had to change some manually and figured having a check for this might help too, so a few extra files were touched.

Happy to take other approaches if preferred. Thanks!

melissawm commented 11 months ago

Button looks like this (with the primary blue highlight on hover):

Screenshot 2023-12-13 at 10 20 13 PM Screenshot 2023-12-13 at 10 21 01 PM
dgmccart commented 11 months ago

I can't comment on the technical implementation, but the design and syncing look great to me! I am wondering how this will impact my content creation flow. Will I simply need to include the following as the header to my markdown files (assuming the .py file generation is automatic) or are there more steps, like converting the file locally and uploading both a .md and .py file, that I'll need to do?

---
jupyter:
  jupytext:
    cell_metadata_filter: -all
    formats: md,py
    main_language: python
    text_representation:
      extension: .md
      format_name: markdown
      format_version: '1.3'
      jupytext_version: 1.16.0
---
melissawm commented 11 months ago

Yes, there are steps. Let me write a guide and you can try it out and see if the instructions are enough.

melissawm commented 11 months ago

yeah - this is the metadata that keeps things in sync, unfortunately. So the other approach would be to not keep things in sync this way, but just re-run the converter on push, instead of on commit. That would mean this logic would move from the pre-commit hook to CI. I can do it as a proof of concept and we can go with the option that looks less intrusive. Wdyt?

aliddell commented 11 months ago

yeah - this is the metadata that keeps things in sync, unfortunately. So the other approach would be to not keep things in sync this way, but just re-run the converter on push, instead of on commit. That would mean this logic would move from the pre-commit hook to CI. I can do it as a proof of concept and we can go with the option that looks less intrusive. Wdyt?

Sure, by all means.

melissawm commented 11 months ago

Alright - here's the second option. It's a lot cleaner so I assume this is what we'll do. I've kept both commits for comparison here so ideally we can drop one of them before merging.

[UPDATE Jan 10] If you want to see the results I've tested on my fork here: https://github.com/melissawm/acquire-docs/actions/runs/7481269513/job/20362517329#step:5:1

And the rendered website: https://melissawm.github.io/acquire-docs/tutorials/trigger/#acquire-data

melissawm commented 10 months ago

Ok folks, this is updated and should be good to go - pending on the design of course! If you prefer different buttons or colors let me know. Cheers!

aliddell commented 10 months ago

SHIP IT