Skip to content

pre-commit autoupdate (Windows), reports: .pre-commit-hooks.yaml is not a file #2865

@adehad

Description

@adehad

search you tried in the issue tracker

is:issue "not a file"

describe your issue

Summary

The last version I used successfully was 2.17.0 and pre-commit 3.2.2, installed using Python 3.11.3

Additional debugging tried

I tried manually specifying the pre-commit-config.yaml file, but I realise now that the error is related to the pre-commit-hooks.yaml file. As this works outside of the tox env I suspect it is a bug.

I have the following tox file:

[tox]
minversion = 4.4.4
# We rely on the build agent configuration for setting the right Py version
envlist =
    py
skip_missing_interpreters = True
skipdist = True

[testenv]
usedevelop = True
extras =
    test
commands=
    git clean -xdf src tests
    pytest {posargs}
setenv =
    # Has problems with spaces in the path in Windows when using: {toxinidir}/constraints.txt
    PIP_CONSTRAINT=constraints.txt
    PIP_LOG={envdir}/pip.log
    PIP_DISABLE_PIP_VERSION_CHECK=1
passenv =
    PIP_*
    TWINE_*
allowlist_externals =
    git

[testenv:deps]
description = Update dependency lock files
deps =
    pip-tools >= 6.4.0
    pre-commit >= 2.13.0
commands =
    # pip-compile --upgrade -o constraints.txt pyproject.toml --extra docs --extra test --extra exe --strip-extras
    {envpython} -m pre_commit autoupdate --config="{toxinidir}{/}.pre-commit-config.yaml"

and this is the full output.
(For completeness I should mentioned that MY_PROJECT is actually a longer path)

> tox run -e deps                                                                                                                                                                                 
ROOT: provision> D:\dev\MY_PROJECT\.tox\.tox\Scripts\python.exe -m tox run -e deps
.pkg: _optional_hooks D:\dev\MY_PROJECT> python D:\dev\MY_PROJECT\.tox\.tox\Lib\site-packages\pyproject_api\_backend.py True hatchling.build
.pkg: get_requires_for_build_editable D:\dev\MY_PROJECT> python D:\dev\MY_PROJECT\.tox\.tox\Lib\site-packages\pyproject_api\_backend.py True hatchling.build
.pkg: build_editable D:\dev\MY_PROJECT> python D:\dev\MY_PROJECT\.tox\.tox\Lib\site-packages\pyproject_api\_backend.py True hatchling.build
deps: install_package D:\dev\MY_PROJECT> python -I -m pip install --force-reinstall --no-deps D:\dev\MY_PROJECT\.tox\.tmp\package\8\MY_PROJECT-1.0.1.dev49+ge471ddf.d20230502-py3-none-any.whl
deps: commands[0] D:\dev\MY_PROJECT> .tox\deps\Scripts\python.exe -m pre_commit autoupdate --config=D:\dev\MY_PROJECT\.pre-commit-config.yaml
[https://github.com/psf/black] 
=====> C:\Users\ADEHA~1\AppData\Local\Temp\tmp55jx9hj6\.pre-commit-hooks.yaml is not a file
[https://github.com/pre-commit/pre-commit-hooks] 
=====> C:\Users\ADEHA~1\AppData\Local\Temp\tmpkqy_t829\.pre-commit-hooks.yaml is not a file
[https://github.com/codespell-project/codespell.git] 
=====> C:\Users\ADEHA~1\AppData\Local\Temp\tmprw3q8l3b\.pre-commit-hooks.yaml is not a file
[https://github.com/charliermarsh/ruff-pre-commit] 
=====> C:\Users\ADEHA~1\AppData\Local\Temp\tmp27qxr3kd\.pre-commit-hooks.yaml is not a file
[https://github.com/adrienverge/yamllint.git] 
=====> C:\Users\ADEHA~1\AppData\Local\Temp\tmpssemasfd\.pre-commit-hooks.yaml is not a file
[https://github.com/pre-commit/mirrors-mypy.git] 
=====> C:\Users\ADEHA~1\AppData\Local\Temp\tmpasg5xk_r\.pre-commit-hooks.yaml is not a file
[https://github.com/asottile/pyupgrade] 
=====> C:\Users\ADEHA~1\AppData\Local\Temp\tmpo5pgj08h\.pre-commit-hooks.yaml is not a file
deps: exit 1 (26.53 seconds) D:\dev\MY_PROJECT> .tox\deps\Scripts\python.exe -m pre_commit autoupdate --config=D:\dev\MY_PROJECT\.pre-commit-config.yaml pid=40900

pre-commit --version

3.3.0

.pre-commit-config.yaml

---
repos:
  - repo: https://github.com/psf/black
    rev: 23.3.0
    hooks:
      - id: black
        language_version: python3
  - repo: https://github.com/pre-commit/pre-commit-hooks
    rev: v4.4.0
    hooks:
      - id: end-of-file-fixer
      - id: trailing-whitespace
      - id: mixed-line-ending
      - id: check-byte-order-marker
      - id: check-executables-have-shebangs
      - id: check-merge-conflict
      - id: check-symlinks
      - id: check-vcs-permalinks
      - id: debug-statements
      - id: check-yaml
        files: .*\.(yaml|yml)$
  - repo: https://github.com/codespell-project/codespell
    rev: v2.2.4
    hooks:
      - id: codespell
        name: codespell
        description: Checks for common misspellings in text files.
        entry: codespell
        language: python
        types: [text]
        args: []
        require_serial: false
        additional_dependencies: []
  - repo: https://github.com/charliermarsh/ruff-pre-commit
    rev: 'v0.0.264'
    hooks:
      - id: ruff
        args: [--fix]
  - repo: https://github.com/adrienverge/yamllint
    rev: v1.31.0
    hooks:
      - id: yamllint
        files: \.(yaml|yml)$
  - repo: https://github.com/pre-commit/mirrors-mypy
    rev: v1.2.0
    hooks:
      - id: mypy
        additional_dependencies:
          - .[docs,test]
  - repo: https://github.com/asottile/pyupgrade
    rev: v3.3.2
    hooks:
      - id: pyupgrade
        args: [--py38-plus]

~/.cache/pre-commit/pre-commit.log (if present)

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions