question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Add a .pre-commit-hooks.yaml to enable hooks to refer to this repo

See original GitHub issue

The current documentation suggests to use repo: local to use jupytext as a pre-commit hook with pre-commit. However, this requires the user to have jupytext installed in the environment they are working in when committing.

To avoid version conflicts etc, pre-commit usually creates a virtualenv per repo and runs the hooks from there. To do this, relies on hook providers to have a .pre-commit-hooks.yaml file. Adding this here would allow users to use repo: https://github.com/mwouts/jupytext to make a dedicated jupytext environment within pre-commit, instead of relying on users to have it installed in their current env. As an added bonus, jupytext could provide a “menu” of common hooks, if desired (e.g. “always convert .ipynb to .py”, “always unstage .ipynb”, etc). These are configurable, but not required.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:1
  • Comments:18 (18 by maintainers)

github_iconTop GitHub Comments

1reaction
JohnPatoncommented, Jan 6, 2021

I am against the githook actually modifing the git index on its own

I essentially agree. The reason for it in this case is that pre-commit doesn’t consider changes to files if they aren’t in the index, so in the PR we only put them there if they are new, and then fail the hook to alert the user.

I guess an alternative would just be to fail if the outputs aren’t tracked with some kind of warning telling the user what’s up?

0reactions
mwoutscommented, Jan 21, 2021

What a great work done at #698! I’ll close this issue now, do some more testing/doc updates at #722, and soon we’ll be ready for a release…

Read more comments on GitHub >

github_iconTop Results From Across the Web

pre-commit
Add a file called .pre-commit-config.yaml to the root of your project. The pre-commit config file describes what repositories and hooks are installed.
Read more >
Getting Started with Python Pre-commit Hooks
This article is focused on pre-commit hooks. ... All we need to do is create and format a .pre-commit-config.yaml file within our project....
Read more >
How to use git pre-commit hooks, the hard way and the easy ...
Pre -commit scripts from these remote repositories can be written in any language. All of their requirements are specified in their repository.
Read more >
How To Create pre-commit Hooks For Git - onCrash = 'reboot();'
Enable pre -commit in test repository. Create a file .pre-commit-config.yaml in the root of the repository. Copy
Read more >
Get Started with Git Hooks - Medium
1. Navigate to the hooks directory $ cd /my-git-repo/. · 2. Install your hook. To enable the hook scripts, simply remove the ....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found