-
Notifications
You must be signed in to change notification settings - Fork 80
Description
Describe the bug
The pre-commit hook for ty is running checks on all files in the repo, using the entrypoint uvx ty check ..
At this stage, since ty finds errors in other files, committed any file is blocked, even if the files to commit have no errors.
What I did
echo "# Copyright 2025 - Pruna AI GmbH. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
if __name__ == "__main__":
exit(0)
" > test.py
git add test.py
git commit -m "test"
Expected behavior
ty pre-commit pass when committing a file {filename} if running ty check {filename} beforehand passes.
Screenshots
Removing possibly-unbound-import = "ignore" from pyproject.toml makes the checks pass on test.py but the pre-commit hook still fails
Removing the pass_filenames field in the .pre-commit.yaml and changing the entry to uvx ty check makes the commit pass.
.pre-commit.yaml:L46
- repo: local
hooks:
- id: ty
name: type checking using ty
entry: uvx ty check
language: system
types: [python]
files: \.py$
Environment
- pruna version (commit hash): ad6878e
- python version: 3.11.12
- Operating System: MacOS 15.7.3
Additional context
I am not sure this categorizes as a bug because it is not something related to pruna itself, but it seemed the most fitting category among the available ones