File size: 485 Bytes
ca1810e
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# This file removes Python bytecode caches within the repository.
# Author: Cheng Yin
# Date: 2025-09
# Copyright (c) Cheng Yin. All rights reserved.
# See LICENSE file in the project root for license information.

import os
import shutil

root_dir = "./"

for dirpath, dirnames, filenames in os.walk(root_dir):
    if "__pycache__" in dirnames:
        pycache_dir = os.path.join(dirpath, "__pycache__")

        shutil.rmtree(pycache_dir)

        print(f"Removed: {pycache_dir}")