mirror of
https://github.com/apache/airflow.git
synced 2026-11-04 07:12:48 +00:00
* Stop parallel prek hooks racing on __pycache__ cleanup prek runs hooks in parallel and every breeze invocation removes all __pycache__ directories in the checkout on start-up. Any other hook process importing from the source tree (breeze itself, prek hook scripts, local mypy runs) can write a fresh .pyc between rmtree emptying a directory and removing it, which fails the breeze hook with "OSError: [Errno 39] Directory not empty" - a flaky Static checks failure in CI. Redirecting bytecode of every hook into a hidden, gitignored .build/ directory keeps the source tree free of new .pyc files while hooks run, and a new check keeps future hooks from reintroducing the race. The cleanup additionally tolerates ENOTEMPTY for writers prek does not control, such as an IDE. Generated-by: Claude Opus 5 * Set PYTHONPYCACHEPREFIX on the hooks added since the branch was cut Eight hooks that landed on main after this branch was created did not redirect their bytecode, so the new check-prek-hooks-pycache-prefix hook failed after the rebase. Generated-by: Claude Opus 5 * Update scripts/ci/prek/check_prek_hooks_pycache_prefix.py Co-authored-by: Wei Lee <hello@wei-lee.me> --------- Co-authored-by: Wei Lee <hello@wei-lee.me>
34 lines
1.2 KiB
YAML
34 lines
1.2 KiB
YAML
# Licensed to the Apache Software Foundation (ASF) under one
|
|
# or more contributor license agreements. See the NOTICE file
|
|
# distributed with this work for additional information
|
|
# regarding copyright ownership. The ASF licenses this file
|
|
# to you 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.
|
|
---
|
|
default_stages: [pre-commit, pre-push]
|
|
minimum_prek_version: '0.3.4'
|
|
default_language_version:
|
|
python: python3
|
|
repos:
|
|
- repo: local
|
|
hooks:
|
|
- id: mypy-scripts
|
|
name: Run mypy for scripts
|
|
env:
|
|
PYTHONPYCACHEPREFIX: .build/pycache
|
|
language: python
|
|
entry: ./ci/prek/run_mypy_full_dist_local_venv_or_breeze_in_ci.py scripts
|
|
pass_filenames: false
|
|
files: ^.*\.py$
|
|
require_serial: true
|