-
Notifications
You must be signed in to change notification settings - Fork 386
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
Add more tests on the pre-commit hook #722
Comments
@JohnPaton , I have a question for you... I was not sure to get the correct error message when an output is both tracked and modified. Is it correct that we should raise an alert also in that case? I am thinking of this: 5ef5f0c |
In that case pre-commit itself will give an appropriate error (something like |
Yes, that was what I though. I think still I prefer to add a more explicit error message, if you don't mind. Maybe when I'm done with the other items we can do a review and decide whether we should change the name of the Now let me give a quick update...
I think @JohnPaton you were right to focus on the Clearly the problem of the |
I think failing if the changes are inconsistent is a sane choice, this is also what git itself does of course so you can even borrow their How will this affect current users of |
Agreed! Good idea... by the way I was also planning to show (a fraction?) of the conflict itself because otherwise it might be hard to find out what is going on.
This will not affect the default |
Agreed! Shouldn't be a big deal to rename since that option is only used in the context of the hook right now anyway |
Hi @JohnPaton , @Skylion007 , a quick update: as discussed above we will now use the inclusion or not in the git index, rather than the timestamp to determine the source notebook when doing Now what remains is to cover a few more use cases (combine with black, combine with nbstripout, call |
Sounds good!
…On Mon, Jan 25, 2021 at 7:55 PM Marc Wouts ***@***.***> wrote:
Hi @JohnPaton <https://github.com/JohnPaton> , @Skylion007
<https://github.com/Skylion007> , a quick update: as discussed above we
will now use the inclusion or not in the git index, rather than the
timestamp to determine the source notebook when doing --sync
--pre-commit-mode. That seems to work well (much better than timestamps)!
Now what remains is to cover a few more use cases (combine with black,
combine with nbstripout, call --execute), and I guess we will have a safe
release and an interesting blog post!
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#722 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAPVMX74UOI2KYNETTPJMBTS3YHINANCNFSM4WMITTQQ>
.
|
Awesome! |
I had more fun with this tonight!
|
It's possible but discouraged, basically. Pre-commit themselves are very adamant that the framework should never touch the staging area.
I do agree! If the inputs and outputs are all the same, then the notebook hasn't changed imo |
Ok I see, thanks.
What do you think of skipping the execution if the inputs have not changed, and if the outputs are present on all code cells (and in the correct order)? This way, we don't need to execute twice before committing: 934a2f1 |
Sorry for radio silence here - my wife had a baby 😁 |
Congrats! |
Wow! Congrats John! Well as you see we finally were able to ship the pre-commit hook in Jupytext v1.10.0. I have made no announcement yet, in part because I wanted to finish the blog post, and also because I wanted to find the appropriate approach for the new cell ids in nbformat 5.1.1 (everything seems fine in the end if one does either I hope to come back to you both soon with more updates on the article, but that might take me a few more days/weeks... Slow progresses, but this is a very nice feature, it is worth documenting it well, isn't it? |
@JohnPaton and @Skylion007 have developed a pre-commit hook for this repo - that was an impressive work #698!
Here is a list of small improvements that we identified during the PR and that I'd like to include in the next release:
--to
test to match the example that is actually testedSystemExit
which does not contain a detailed error message)jupytext
CLI to avoid writing files that don't change (only update their timestamp). And make sure that this fixes the pre-commit hook when run on file types.py
+.ipynb
(or even tripled-paired notebooks)--sync --pipe black
mode.--sync
+nbstripout
mode.--sync --execute
mode..py
file in the--sync
modepre-commit run --all
(no need to add files to the git index in that context)The text was updated successfully, but these errors were encountered: