klen / pylama

Code audit tool for python.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

pre-commit - pyproject config - missing additional_dependencies for toml and types-toml ?

ychab opened this issue · comments

Hi,

First of all, thanks for this project I used since so many years ago!

I'm new to pre-commit hooks so I'm not sure but it take me a while to found out how to use this pre-commit hooks!
For instance, I discover that in the virtualenv created by pre-commit, pylama try to import config_toml.py but would failed because toml and types-toml python packages are missing from that virtualenv...

Probably there is still something wrong with dependencies?
Or at least, I miss some docs / examples on how to use it ?

Anyway, here is my temporary work-around:

repos:
  - repo: https://github.com/klen/pylama
    rev: 8.4.1
    hooks:
    - id: pylama
      args: [ "<MY_PATH>" ]
      additional_dependencies:
        - toml
        - types-toml

By specifiying additional_dependencies, the hook is now reading my pyproject.toml config as expected without any fails.

And BTW like the doc say, don't forgot to install pylama with :

pip install pylama[toml] or poetry add -D pylama[toml]

Thanks for feedbacks!

I think you are configuring the hook as intended:

additional_dependencies

(optional) a list of dependencies that will be installed in the environment where this hook gets run. One useful application is to install plugins for hooks such as eslint.

However you shouldn't need to specify types-toml.

Hi @real-yfprojects

Thanks, you are right! No need to declare 'types-toml' in addition. Just testing with a fresh env without it and it works like a charm!

I think we could close this issue ;-)