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

Proposed inclusion of Poetry pre-commit hooks #74

Open
proudfeet opened this issue Sep 7, 2023 · 0 comments
Open

Proposed inclusion of Poetry pre-commit hooks #74

proudfeet opened this issue Sep 7, 2023 · 0 comments

Comments

@proudfeet
Copy link

Description of the proposal

Combining poetry and pre-commit can be very powerful. Currently both are being used somewhat in isolation from each other.

There are a collection of poetry specific pre-commit hooks that can be used to ensure poetry configuration is correct before a commit.

Details

More information on the poetry hooks can be found here.

I would suggest using:

  1. poetry-check - checks the config is valid
  2. poetry-lock - runs poetry lock ahead of a commit to ensure the lock file is up to date*

*You may only want to use the poetry-lock command on merge checks as I would have thought it would be quite rare the requirements will change. This might be easier to implement as a check on git-push to the develop branch.

Example

It would look something like the following:

repos:
-   repo: https://github.com/python-poetry/poetry
    rev: '1.6.1'
    hooks:
    -   id: poetry-check
    -   id: poetry-lock
    
    ...

Impact

There will be a slight time increase due to any additions but it should be pretty negligible compared to say mypy which is painfully slow at times.

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

1 participant