Skip to content
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

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

Closed
ychab opened this issue Oct 5, 2022 · 2 comments

Comments

@ychab
Copy link

ychab commented Oct 5, 2022

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!

@real-yfprojects
Copy link

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.

@ychab
Copy link
Author

ychab commented Nov 17, 2022

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 ;-)

@ychab ychab closed this as completed Nov 17, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants