BjornFJohansson / pydna

Clone with Python! Data structures for double stranded DNA & simulation of homologous recombination, Gibson assembly, cut & paste cloning.
Other
163 stars 42 forks source link

Notebooks in git #243

Closed manulera closed 1 week ago

manulera commented 1 month ago

Hello! ccing @BjornFJohansson @hiyama341 @JamesBagley as jupyter notebook lovers

@JeffXiePL is going to be working on some pydna documentation using notebooks and I wanted to bring up a couple of points.

Seeing jupyter diffs on github

Bringing your attention to this new feature to show better informative diffs for notebooks. See below how to activate it.

https://github.com/user-attachments/assets/f1654b45-bb1a-4010-961b-42bfb8234c50

Stripping metadata from jupyter notebooks

One of the things i HATE about jupyter notebooks is how they polute git diffs with irrelevant changes such as execution counts for the cells, metadata, etc.

I have tried a tool to strip that off in hooks, and I will make an issue in pydna to include that. You can see below the repo where I tried it, in case you want to use it for your own repositories.

https://github.com/manulera/testing-nbstripout

Any advice on further ways to make the notebooks better in git is appreciated.

manulera commented 4 weeks ago

I am adding some extra info here for @JeffXiePL, but it can be useful for future users:

# Add your changes
git add .
# commit a first time
commit -m 'commit message'
# The hook will fail here and will modify the files removing the metadata, to see the changes it makes,
# you can use git diff
git diff

# Add the changes the hook made
git add .

# Commit again, this time it should work
commit -m 'commit message'