Thanks to visit codestin.com
Credit goes to github.com

Skip to content

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

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

Closed
adehad opened this issue May 2, 2023 · 6 comments · Fixed by #2866
Closed

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

adehad opened this issue May 2, 2023 · 6 comments · Fixed by #2866

Comments

@adehad
Copy link

adehad commented May 2, 2023

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

@whoDoneItAgain
Copy link

whoDoneItAgain commented May 2, 2023

I am getting the same error when running 'pre-commit autoupdate'. i am able to do 'pre-commit run ...' I worked around the issue by running the autoupdate from an admin command prompt or PS.

was working fine yesterday with 3.2.2 but not with 3.3.0 this morning.

windows 11 python 3.10.11

@whoDoneItAgain
Copy link

I am getting the same error when running 'pre-commit autoupdate'. i am able to do 'pre-commit run ...' I worked around the issue by running the autoupdate from an admin command prompt or PS.

was working fine yesterday with 3.2.2 but not with 3.3.0 this morning.

windows 11 python 3.10.11

Looks like I was mistaken on my workaround. It was pre-commit clean, followed by pre-commit run. elevated didn't matter.

@asottile
Copy link
Member

asottile commented May 2, 2023

if it works outside if tox then it's probably an issue with your tox configuration

perhaps try playing with passenv ?

@adehad
Copy link
Author

adehad commented May 2, 2023

Sorry, corrected my original post. That was a mistake from when I was first writing the issue.

(I thought it worked outside of tox, but that was because I hadn't updated my version outside of tox. I confirm it now doesn't work neither in tox, nor outside)

@asottile
Copy link
Member

asottile commented May 2, 2023

oddly enough I can sort of reproduce this -- but not with the test suite. it appears to be a bug in git for windows so I'm reporting a bug there -- https://marc.info/?l=git&m=168303544023036&w=2

for now I'll add a small workaround in the source and remove it in ~6 months or so after git releases a fix for their bug

jaypikay pushed a commit to jaypikay/doxy that referenced this issue May 4, 2023
This PR contains the following updates:

| Package | Type | Update | Change |
|---|---|---|---|
| [pre-commit](https://github.com/pre-commit/pre-commit) | dev-dependencies | minor | `3.2.2` -> `3.3.1` |

---

### Release Notes

<details>
<summary>pre-commit/pre-commit</summary>

### [`v3.3.1`](https://github.com/pre-commit/pre-commit/blob/HEAD/CHANGELOG.md#&#8203;331---2023-05-02)

[Compare Source](pre-commit/pre-commit@v3.3.0...v3.3.1)

\==================

##### Fixes

-   Work around `git` partial clone bug for `autoupdate` on windows.
    -   [#&#8203;2866](pre-commit/pre-commit#2866) PR by [@&#8203;asottile](https://github.com/asottile).
    -   [#&#8203;2865](pre-commit/pre-commit#2865) issue by [@&#8203;adehad](https://github.com/adehad).

### [`v3.3.0`](https://github.com/pre-commit/pre-commit/blob/HEAD/CHANGELOG.md#&#8203;330---2023-05-01)

[Compare Source](pre-commit/pre-commit@v3.2.2...v3.3.0)

\==================

##### Features

-   Upgrade ruby-build.
    -   [#&#8203;2846](pre-commit/pre-commit#2846) PR by [@&#8203;jalessio](https://github.com/jalessio).
-   Use blobless clone for faster autoupdate.
    -   [#&#8203;2859](pre-commit/pre-commit#2859) PR by [@&#8203;asottile](https://github.com/asottile).
-   Add `-j` / `--jobs` argument to `autoupdate` for parallel execution.
    -   [#&#8203;2863](pre-commit/pre-commit#2863) PR by [@&#8203;asottile](https://github.com/asottile).
    -   issue by [@&#8203;gaborbernat](https://github.com/gaborbernat).

</details>

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box

---

This PR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNS42MS4wIiwidXBkYXRlZEluVmVyIjoiMzUuNjEuMCJ9-->

Co-authored-by: Renovate Bot <[email protected]>
Co-authored-by: JayPiKay <[email protected]>
Reviewed-on: https://git.goatpr0n.de/public/doxy/pulls/8
Co-authored-by: renovate <[email protected]>
Co-committed-by: renovate <[email protected]>
@Syzygianinfern0

This comment was marked as off-topic.

@pre-commit pre-commit locked as off-topic and limited conversation to collaborators Jul 31, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Development

Successfully merging a pull request may close this issue.

4 participants