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

Update the timestamp of the py file only if it is older than that of the nb file #1227

Merged
merged 1 commit into from
May 5, 2024

Conversation

mwouts
Copy link
Owner

@mwouts mwouts commented Apr 27, 2024

Closes #1215

Copy link

github-actions bot commented Apr 27, 2024

Thank you for making this pull request.

Did you know? You can try it on Binder: Binder:lab or Binder:notebook.

Also, the version of Jupytext developed in this PR can be installed with pip:

HATCH_BUILD_HOOKS_ENABLE=true pip install git+https://github.com/mwouts/jupytext.git@skip_update_timestamp

(this requires nodejs, see more at Developing Jupytext)

Copy link

codecov bot commented Apr 27, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 97.76%. Comparing base (7963f5f) to head (bd50cbe).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1227      +/-   ##
==========================================
+ Coverage   97.73%   97.76%   +0.02%     
==========================================
  Files          29       29              
  Lines        4464     4468       +4     
==========================================
+ Hits         4363     4368       +5     
+ Misses        101      100       -1     
Flag Coverage Δ
external 75.14% <71.42%> (-0.03%) ⬇️
functional 88.52% <100.00%> (+0.01%) ⬆️
integration 77.28% <85.71%> (-0.01%) ⬇️
unit 66.56% <85.71%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

if it is older than that of the nb file
@mwouts mwouts added this to the 1.16.2 milestone May 5, 2024
@mwouts mwouts merged commit 9bc2675 into main May 5, 2024
32 checks passed
@mwouts mwouts deleted the skip_update_timestamp branch May 5, 2024 22:31
@max-accenta
Copy link

Hi @mwouts, sorry to bother you but after the recent change, this feature only works with the --sync command.

If I run jupytext --sync notebook.py I get:

[jupytext] Reading notebook.py in format py
[jupytext] Loading notebook.ipynb
[jupytext] Updating notebook.ipynb
[jupytext] Unchanged notebook.py

however with jupytext --to ipynb notebook.py --output notebook.ipynb I get:

[jupytext] Reading notebook.py in format py
[jupytext] Writing notebook.ipynb (destination file replaced [use --update to preserve cell outputs and ids])
[jupytext] Updating the timestamp of notebook.py

and the python file's timestamp is updated.

Is there a reason we can't get the same behavior for --to as for --sync ? Thanks

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

Successfully merging this pull request may close these issues.

--sync: avoid updating timestamp of *.py if nothing changes
2 participants