Skip to content

pre-commit and pylint installed as dev dependencies with poetry. Is this the right approach? #2120

@maephisto666

Description

@maephisto666

Hello,

I would like to know if what I'm doing is good enough or if there is a better approach.

This is my setup:

  • very simple python application
  • poetry to manage dependencies
  • pre-commit installed as a --dev dependency by poetry
  • pylint installed as a --dev dependency by poetry
  • everything is working as expected (i.e. when I commit, pre-commit runs pylint and pylint does not complain about missing imports, because it is correctly executed in the virtualenv set up by poetry)

These are my hooks

repos:
  - repo: https://github.com/ambv/black
    rev: 21.9b0
    hooks:
    - id: black
      language_version: python3.9
  - repo: local
    hooks:
      - id: pylint
        name: pylint
        entry: poetry run pylint
        language: system
        types: [python]

Is it a good approach to install pre-commit, pylint, etc. as dev dependencies? Or shall I install pre-commit globally (via brew for example)?
Is there a better way to make sure pylint (through pre-commit) is executed with the required dependencies for my application?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions