potiuk commented on code in PR #34247:
URL: https://github.com/apache/airflow/pull/34247#discussion_r1387337241


##########
.pre-commit-config.yaml:
##########
@@ -1030,3 +1030,12 @@ repos:
         files: 
^airflow/migrations/versions/.*\.py$|^docs/apache-airflow/migrations-ref\.rst$
         additional_dependencies: ['rich>=12.4.4']
         ## ONLY ADD PRE-COMMITS HERE THAT REQUIRE CI IMAGE
+      - id: bandit

Review Comment:
   No - you need to use `additional_dependencies` . The way how regular 
`pre-commits` work is that pre-commit knows the language `python` and knows how 
to create an environment for it automatically. This is what 
`additional_dependencies` is for. In case of `python` precommit, this is really 
a specification of virtualenv it should create (so you need to add bandid as 
requirement THERE not in `airfllow` dependencies.
   
   It understands other languages - for example for `node` you can specify 
`npm` dependencies in `additional_dependencies` field.
   
   Pre-commit is actually even smart enough to re-use virtualenvs it creates 
between different checks if they have the same requirements or even between 
different projects that use pre-commit - because the venvs for pre-commit are 
created in ~/.cache/pre-commit/ in your home directory.
   
   You can see exactly what happens when you remove `~/.cache/pre-commit` 
folder. The first thing pre-commit will do it will find all the distinct 
`venvs` and `node env` and other language envs and will create all of them. It 
will take few minutes but you will see what's happening and you will understand 
what's going on.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@airflow.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to