快速运行当前目录下的 Python 文件,无需输入完整文件名。
- 列出当前目录下所有
.py文件 - 支持递归搜索子文件夹(指定深度)
- 通过数字选择要运行的文件
- 支持传递额外参数给 Python 脚本
- 简单的命令行界面
# 克隆仓库
git clone https://github.com/yourusername/fast_py.git
cd fast_py
# 安装
pip install -e .pip install .安装后,你可以在任何包含 Python 文件的目录中使用 fp 命令:
# 进入你的项目目录
cd /path/to/your/project
# 运行 fp
fp程序会显示当前目录下的所有 Python 文件:
📁 Python files:
1. main.py
2. test.py
3. utils.py
Select file number (or 'q' to quit):
输入数字选择文件,程序会自动执行 python <selected_file>。
使用数字参数指定搜索子文件夹的深度:
fp # 当前文件夹(默认)
fp 0 # 当前文件夹
fp 1 # 当前文件夹 + 一级子文件夹
fp 2 # 当前文件夹 + 两级子文件夹当深度 > 0 时,文件列表会显示相对路径:
📁 Python files:
1. main.py
2. scripts\helper.py
3. tests\test_main.py
Select file number (or 'q' to quit):
你也可以在深度参数后传递额外参数给 Python 脚本:
fp 0 arg1 arg2 # 当前文件夹,传递 arg1 arg2
fp 1 --verbose # 一级子文件夹,传递 --verbose假设当前目录有以下文件:
hello.pydata_processor.pytest_script.py
运行 fp:
📁 Python files in current directory:
1. data_processor.py
2. hello.py
3. test_script.py
Select file number (or 'q' to quit): 2
🚀 Running: python hello.py
Hello, World!
# 克隆项目
git clone https://github.com/yourusername/fast_py.git
cd fast_py
# 安装开发依赖
pip install -e ".[dev]"
# 运行测试
pytestMIT License