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 timestamp of destination files not source files #784

Closed
DancingQuanta opened this issue May 13, 2021 · 3 comments · Fixed by #790
Closed

update timestamp of destination files not source files #784

DancingQuanta opened this issue May 13, 2021 · 3 comments · Fixed by #790
Milestone

Comments

@DancingQuanta
Copy link

I have faced a similar situation as the #767 where I use make to automate shell commands. My workflow consists of

markdown [jupytext]-> notebook [jupyter convert]-> output

I do want to keep both markdown and notebook paired.
The current Jupytext modifies the input markdown file's timestamp which keep make seeing it as newer than notebook output files.

I wonder if it is possible to set the timestamp of the notebook output files is set to equal that of the input files? Could this be an option?

@mwouts
Copy link
Owner

mwouts commented May 17, 2021

Hi @DancingQuanta , well this sounds like a great idea!

I don't think I would risk doing that by default, but maybe indeed we could have an option to set the timestamp of the output file equal to that of the input. What name would you choose for that option? Something like --use-source-timestamp?

@DancingQuanta
Copy link
Author

I understood that you have developed this library so far with the timestamps being synchronized to the destination files and changing this behaviour is a disruptive change and is that why I suggested an option.

We could use --use-source-timestamp argument as you suggested as I do not have any other ideas.

I think the next step would be to introduce this feature through a PR to test because I wanted to be sure that this new timestamp setting behaviour will resolve my Makefile issue. I will study the code and I think I have to target the pairing code and add a test to the test suite.

@mwouts
Copy link
Owner

mwouts commented May 19, 2021

I think the next step would be to introduce this feature through a PR to test because I wanted to be sure that this new timestamp setting behaviour will resolve my Makefile issue. I will study the code and I think I have to target the pairing code and add a test to the test suite.

Yes, that would be great! I would say that you will have to modify lazy_write at jupytext/cli.py:719. And for the tests maybe you can take some inspiration in tests.test_cli.test_jupytext_to_ipynb_does_not_update_timestamp_if_output_not_in_pair.

However if you are not in a hurry I could also prepare the PR - the next release should be a matter of a few weeks.

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 a pull request may close this issue.

2 participants