Skip to content

poetry-check hook does not trigger for the poetry.lock changes #9503

@Enkidu-Aururu

Description

@Enkidu-Aururu

Description

Imagine a commit where you change only poetry.lock file and have no change in project.toml file.

I understand this usually does not happen since the .lock file is not updated manually and any change in .toml file will fail existing poetry-check hook.

But such commit did happen through some complicated merge conflict resolution in our code.
I am sorry that I cannot think of simple reproducible scenario.

But anyway, once such commit occurs, the present poetry-check hook is skipped, because it triggers only for changes in .toml file.

https://github.com/python-poetry/poetry/blob/main/.pre-commit-hooks.yaml#L7

In other words, at the moment this command
pre-commit run poetry-check --files poetry.lock
will be always skipped.

After the fix (see workaround), the pre-commit call should pass/fail depending on the circumstances.

Workarounds

Use hook configuration files: ^(.*/)?(poetry\.lock|pyproject\.toml)$

Poetry Installation Method

system package manager (eg: dnf, apt etc.)

Operating System

Ubuntu 22

Poetry Version

1.8.3

Poetry Configuration

cache-dir = "/home/[redacted]/.cache/pypoetry"
experimental.system-git-client = false
installer.max-workers = null
installer.modern-installation = true
installer.no-binary = "[pymssql]"
installer.parallel = true
keyring.enabled = true
repositories.google.url = "[redacted]"
solver.lazy-wheel = true
virtualenvs.create = false
virtualenvs.in-project = true
virtualenvs.options.always-copy = false
virtualenvs.options.no-pip = false
virtualenvs.options.no-setuptools = false
virtualenvs.options.system-site-packages = false
virtualenvs.path = "{cache-dir}/virtualenvs"  # /home/[redacted]/.cache/pypoetry/virtualenvs
virtualenvs.prefer-active-python = true
virtualenvs.prompt = "{project_name}-py{python_version}"
warnings.export = true

Python Sysconfig

No response

Example pyproject.toml

No response

Poetry Runtime Logs

no poetry log

Metadata

Metadata

Assignees

No one assigned

    Labels

    kind/bugSomething isn't working as expectedstatus/triageThis issue needs to be triaged

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions