Rustlings-style C exercises CLI for OpenCamp C 2026 Summer
Project description
Clings — C 语言练习系统 CLI
C 语言版 Rustlings:通过修复编译错误、补全代码来学习 C 语言。 配套 OpenCamp C 2026 Summer 课程 Unit 1–4,共 121 道练习。
分支说明
| 分支 | 用途 |
|---|---|
| cli (本分支, 默认) | CLI 工具源码 + 练习数据,CI 自动发布 pip 包 |
| main | 练习仓库 (学生 clone 用,已废弃,改用 clings init) |
快速开始
# 1. 安装
pip install clings --index-url https://pypi.cnb.cool/q.qq/opencamp-c-2026-summer/clings-cli/-/packages/simple
# 2. 初始化练习 (在任意空目录)
mkdir my-c-exercises && cd my-c-exercises
clings init unit1 # 释放 Unit 1 (24课49题)
# 3. 开始做题!
clings # 进入交互式 watch 模式
命令参考
clings # 直接进入 watch 模式 (默认)
clings init [unit1|...|all] # 初始化练习 (从包内释放到当前目录)
clings watch [selector] # 交互式 watch (保存即验证)
clings run [exercise] # 运行练习 (省略=下一道, 'random'=随机)
clings hint [exercise] # 查看提示 (省略=下一道)
clings list [selector] # 列出练习 + ✔/• 进度状态
clings check [selector] # 批量验证
clings reset <exercise> # 重置练习文件
clings reset progress # 清除全部进度
clings doctor # 检查环境
开发
git clone https://cnb.cool/q.qq/opencamp-c-2026-summer/clings.git
cd clings/ # 默认在 cli 分支
pip install -e .
clings check unit1 --solutions # 验证 49/49
CI/CD
push 到 cli 分支自动触发:
- Install & Test: pip install → clings init all → check unit1 --solutions
- Build & Publish: python -m build → twine upload 到 CNB PyPI 制品库
架构
clings/ (cli 分支)
├── clings.py # CLI 核心 (单文件, 零依赖, Python 3.11+)
├── pyproject.toml # pip 打包 (exercises/ 嵌入 wheel)
├── clings.toml # units 配置
├── .cnb.yml # CI: cli 分支 push → test → publish
├── Dockerfile.ci # Ubuntu 24.04 CI 环境
├── exercises/ # 121 道练习 (嵌入 pip 包, clings init 释放)
│ ├── 01_simplest_c_program/
│ │ ├── exercises.toml # 练习元数据 + 测试用例
│ │ ├── *.c # 学生源码模板
│ │ └── README.md # 课程参考
│ └── ...
├── solutions/ # Unit 1 参考答案 (CI 测试用, 不打包)
└── tools/ # 维护脚本
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
clings-3.1.0.tar.gz
(222.9 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
clings-3.1.0-py3-none-any.whl
(407.1 kB
view details)
File details
Details for the file clings-3.1.0.tar.gz.
File metadata
- Download URL: clings-3.1.0.tar.gz
- Upload date:
- Size: 222.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b518cdcde5b8e664ee7c9663b0aea218b9b4cc0959dcd4d633550d2cd00d043b
|
|
| MD5 |
022b50b15765dc360b13517e87aa1103
|
|
| BLAKE2b-256 |
346a5ddc9489f2ef999b8ebc38241f95131a408acd3d198770f5c1ffd66c3098
|
File details
Details for the file clings-3.1.0-py3-none-any.whl.
File metadata
- Download URL: clings-3.1.0-py3-none-any.whl
- Upload date:
- Size: 407.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a895553381cf0228369d367fbd8173ca02bcdba0d6bc6780dd1db40deea9d858
|
|
| MD5 |
ad93c764e58733420283da8123e6782a
|
|
| BLAKE2b-256 |
a8e8b970a286c92c04ddbadb390de8b1bd5eeccbfa49c8d88473b2e71646a4d9
|