Skip to content

Latest commit

 

History

1 Commit

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 

Repository files navigation

fast_py

English Version

快速运行当前目录下的 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.py
  • data_processor.py
  • test_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]"

# 运行测试
pytest

许可证

MIT License

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages