GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - eastyou/classpick: 课堂随机点名与分组:一轮不重复、可排除请假同学,本地零依赖

BranchesTags
Open more actions menu

Latest commit

 

History

1 Commit
1 Commit

Folders and files

NameName
Last commit message
Last commit date
.github/workflows
.github/workflows
 
 
classpick
classpick
 
 
examples
examples
 
 
tests
tests
 
 
.gitignore
.gitignore
 
 
LICENSE
LICENSE
 
 
README.md
README.md
 
 
pyproject.toml
pyproject.toml
 
 

Repository files navigation

classpick

CI License: MIT Python

给老师用的课堂随机点名与分组工具。读一份名单,随机点人、随机分组,支持请假排除和「一轮内不重复」。零依赖,数据只在本机,不需要联网。

课堂提问最怕总是点到那几个人。classpick 用真正的随机抽样,并且可以记住这一轮点过谁:所有人被点到一遍之前,不会重复。

特性

  • 公平随机:每次从名单里随机抽取,可一次点多人
  • 一轮不重复:用状态文件记录已点名单,点完一轮自动开启新一轮
  • 排除请假:临时请假几位同学,不影响其他人被点到
  • 随机分组:按人数尽量平均地分成 N 组,适合小组讨论
  • 结果可复现:指定随机种子,方便演示或复盘
  • 本地运行:不联网、不上传名单;39 个单元测试覆盖解析、抽取、状态与命令行

安装

pip install "git+https://github.com/eastyou/classpick.git"

或者不安装,直接运行:

git clone https://github.com/eastyou/classpick.git
cd classpick
python3 -m classpick --help

快速开始

准备 名单.txt,每行一个名字:

张伟
王芳
李娜

随机点名

$ classpick pick -i 名单.txt
本次点到:王芳

一次点 3 人:

$ classpick pick -i 名单.txt -n 3
本次点到:张伟、李娜、刘洋

一轮内不重复

加上 --state 就会记住已经点过谁:

$ classpick pick -i 名单.txt --state .classpick.json
本次点到:李娜
$ classpick pick -i 名单.txt --state .classpick.json
本次点到:张伟

所有人都点过一遍后,会提示「上一轮已点完,已开启新一轮」。想提前清空记录:

classpick reset --state .classpick.json

排除请假同学

$ classpick pick -i 名单.txt -n 2 --absent 张伟,李娜
本次点到:王芳、刘洋

随机分组

$ classpick group -i 名单.txt -g 3
第 1 组(4 人):张伟、刘洋、赵敏、孙悦
第 2 组(4 人):王芳、陈静、周杰、郑爽
第 3 组(4 人):李娜、杨帆、吴桐、冯磊

参数

classpick pick

参数 说明 默认值
-i, --students 名单文件(txt 或 CSV) 必填
-n, --count 一次点几人 1
--absent 请假同学,逗号分隔 无
--state 不重复模式的状态文件 关闭
--seed 随机种子 随机
--json JSON 输出 关闭

classpick group

参数 说明
-i, --students 名单文件
-g, --groups 分成几组
--absent 请假同学,逗号分隔
--seed 随机种子
--json JSON 输出

classpick reset

参数 说明
--state 要清空的状态文件

退出码

退出码 含义
0 成功
2 名单、参数或状态文件有误

名单格式

  • txt:每行一个姓名,空行和 # 开头的行会忽略
  • CSV:需要表头包含 姓名(或 name),例如从 Excel「另存为 CSV UTF-8」

名单里有重复姓名时会报错,避免同一个人被算两次。

常见问题

会被学生说「抽签不透明」吗? 算法使用 Python 标准库的随机抽样,指定 --seed 后结果可以复现,老师可以当场演示。

换电脑后不重复记录还在吗? 状态文件默认放在当前目录,复制 .classpick.json 即可带走。删除它等同于重新开始。

能点老师吗? 把老师名字写进名单就可以。

名单会上传吗? 不会,程序没有任何联网代码。

开发与测试

python3 -m unittest discover -s tests -v

CI 覆盖 Python 3.9 ~ 3.13 与 Linux/macOS/Windows。

License

MIT © 2026 eastyou

About

课堂随机点名与分组:一轮不重复、可排除请假同学,本地零依赖

Topics

clieducationpythonteachingvisualization

Resources

Readme
MIT license
Activity

Stars

0 stars

Watchers

0 watching

Forks

0 forks
Report repository

Releases

Packages

Contributors

Languages

You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.