pre-commit-ci / issues

public issues for https://pre-commit.ci
17 stars 3 forks source link

Possible to add configuration option to update additional_dependencies in weekly autoupdates? #64

Closed matthewfeickert closed 3 years ago

matthewfeickert commented 3 years ago

Hi. One of the great things about pre-commit.ci is the weekly autoupdates each Monday (I really appreciate this part of the service!). However, as I have this setup across multiple projects I sometimes am a bit too quick on the accept and I forget to check if any of the other hooks in the .pre-commit-config.yaml file have an additional dependency that should also be updated.

Example:

The pyhf .pre-commit-config.yaml uses both pyupgrade (thanks for that as well Anthony) and nbQA with pyupgrade as an additional dependency of nbqa-pyupgrade. The versions of pyupgrade are currently out of sync there though.

$ tail -n 13 .pre-commit-config.yaml 
-   repo: https://github.com/asottile/pyupgrade
    rev: v2.14.0
    hooks:
    - id: pyupgrade
      args: ["--py37-plus"]

-   repo: https://github.com/nbQA-dev/nbQA
    rev: 0.8.0
    hooks:
    - id: nbqa-black
      additional_dependencies: [black==21.4b1]
    - id: nbqa-pyupgrade
      additional_dependencies: [pyupgrade==2.11.0]

It would be nice if possible to be able to configure pre-commit.ci to update pyupgrade for both the pyupgrade and nbqa-pyupgrade additional_dependencies so that for (as an example) pyupgrade v2.15.0 the diff would be

--- a/.pre-commit-config.yaml
+++ b/.pre-commit-config.yaml
@@ -39,7 +39,7 @@ repos:
     - id: flake8

 -   repo: https://github.com/asottile/pyupgrade
-    rev: v2.14.0
+    rev: v2.15.0
     hooks:
     - id: pyupgrade
       args: ["--py37-plus"]
@@ -50,4 +50,4 @@ repos:
     - id: nbqa-black
       additional_dependencies: [black==21.4b1]
     - id: nbqa-pyupgrade
-      additional_dependencies: [pyupgrade==2.11.0]
+      additional_dependencies: [pyupgrade==2.15.0]

At the time of writing this the configuration options for pre-commit.ci are:

so I don't think this is already possible, but I'd be very happy to learn that I'm also just missing something obvious. :)

asottile commented 3 years ago

it's not easy unfortunately -- here's the pre-commit issue: https://github.com/pre-commit/pre-commit/issues/1351#issuecomment-594111058

a (monumental) amount of work would need to be done to teach pre-commit about (1) every install flag (2) every language's packaging repository

matthewfeickert commented 3 years ago

Thanks very much for the quick response and info. :+1: That's super helpful unto itself.

asottile commented 3 years ago

if you're willing to work on a partial solution, assuming you can find a reasonable format for each of the currently supported languages it could be added upstream and then work here (and ignore flags, custom indices, not found packages, etc.)

matthewfeickert commented 3 years ago

if you're willing to work on a partial solution, assuming you can find a reasonable format for each of the currently supported languages it could be added upstream and then work here (and ignore flags, custom indices, not found packages, etc.)

While I appreciate the info and the directional guidance, I think from your description so far this isn't something I'm going to be able to contribute towards a solution in a helpful time frame to anyone. Though I have subscribed to the pre-commit Issue.

The

assuming you can find a reasonable format for each of the currently supported languages

is a good example of the difficulty of the problem as you lay it out in the pre-commit Issue as well — that's not easy even for someone with expertise. :grimacing:

asottile commented 3 years ago

yeah, like I think I could make it kinda work for python, but I'd have a hard time getting something working nicely for any and every other language