-
Notifications
You must be signed in to change notification settings - Fork 129
Create .pre-commit-hooks.yaml #64
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
Conversation
Add a pre-commit hook to generate a graph of dependencies, see https://pre-commit.com/#new-hooks
|
The CI errors seem unrelated to my commit, except for the coverage decrease, of which YAML files should be ignored, it seems weird to me that YAML files are taken into account when calculating the project coverage. |
|
Hi Ewen, and thank you for your interest in pydeps. Could you say a few word about the motivation for this PR (what this PR accomplishes)? |
|
This PR allows to use the executable ( |
|
@ewen-lbh is this so other projects can use it, or for pydeps itself? |
|
@thebjorn it's for other projects to use |
|
So it seems like I forgot to make the file declare an array instead of a hook object directly, can @thebjorn do it directly, do I add commits to this branch or do I open a new PR? Sorry, I should've tested this beforehand with a dummy repo |
|
@ewen-lbh Let me know what the correct contents of the file should be and I'll change it. |
|
@thebjorn just putting all the keys into an array should work, sth. like: - id: ...
name: ...
entry: ...But I'll test it on a dummy fork tomorrow just to be sure and not make a mistake twice 😅 |
|
That change makes the hook valid, but it still doesn't work automatically (since pydeps takes the name of the directory to run against as an argument). Probably just me not knowing how to use pre-commit though. |
|
I've added a output: It's getting late, I'll have to pick this up tomorrow... |
|
@thebjorn Users can define arguments to pass to in ./.pre-commit-config.yaml: repos:
- repo: https://github.com/thebjorn/pydeps
rev: (set the version tag "vVERSION" here)
hooks:
- id: pydeps
args: [args, to, pass, to, pydeps]A way to detect the package name from setup.{py,cfg} or pyproject.toml would be a nice little QoL change but it's not the end of the world to have users of the pre-commit hook need to specify the module name, and I'm sure plenty of other hooks require some sort of configuration via arguments. That said, I'm still pretty new to pre-commit.com |
|
The problem is that pre-commit passes the filenames that have changed, which is unexpected. From the example above, I checked in the |
|
Yes, the spirit of pre-commit hooks seems to be that each hook is applicable to individual files (so that checks can also be skipped when the commit does not change files that are affected by a hook). Overall I feel like things like Seems like this kind of programs are outside of pre-commit.com's vision, at least it seems so. But still, having an always-up-to-date dependency graph is nice Maybe a different CLI (something like pydeps-hook) altogether would be more appropriate, as the current solutions you proposed all seem pretty hacky to me... I may develop that CLI :) Or another idea, building upon your (1): But this seems a bit complex to implement at first glance |
|
Work has intruded on my free time, so I'm putting this on the back burner for now. Keep me updated if you develop pydeps-hook :-) |
Add a pre-commit hook to generate a graph of dependencies, see https://pre-commit.com/#new-hooks