Skip to main content

Rustlings-style C exercises CLI for OpenCamp C 2026 Summer

Project description

Clings — C 语言练习系统 CLI

PyPI Python Downloads License

C 语言版 Rustlings:通过修复编译错误、补全代码来学习 C 语言。 配套 OpenCamp C 2026 Summer 课程 Unit 0–4,共 121 道练习

分支说明

分支 用途
cli (本分支,默认) CLI 工具源码 + 练习数据,CI 自动发布 pip 包
main 练习仓库 (学生 clone 用,已废弃,改用 clings init)

快速开始

# 1. 安装 uv (推荐)
curl -LsSf https://astral.sh/uv/install.sh | sh

# 2. 初始化练习 + 开始做题 (一行搞定,无需安装 clings)
uvx clings init unit0
uvx clings

其他安装方式

# pipx (隔离安装到独立环境)
pipx install clings

# pip + 虚拟环境
python3 -m venv .venv && source .venv/bin/activate
pip install clings

注意: Ubuntu 23.04+ / Python 3.11+ 禁止直接 pip install 到系统环境(PEP 668)。 请使用上述 uvx / pipx / venv 方式,避免 --break-system-packages

命令参考

clings                        # 直接进入 watch 模式 (默认)
clings init [unit0|...|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                 # 检查环境
clings -v                     # 显示版本号

开发

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 分支自动触发:

  1. Install & Test: pip install → clings init all → check unit1 --solutions
  2. Build & Publish: python -m build → twine upload 到 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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

clings-4.3.2.tar.gz (277.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

clings-4.3.2-py3-none-any.whl (538.5 kB view details)

Uploaded Python 3

File details

Details for the file clings-4.3.2.tar.gz.

File metadata

  • Download URL: clings-4.3.2.tar.gz
  • Upload date:
  • Size: 277.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for clings-4.3.2.tar.gz
Algorithm Hash digest
SHA256 f9689c7fbfb00ff0846cc93641c8337d9ab620482fbe0c4497c48fc4297eacd1
MD5 43a69829da652feddd6310d7ec7e3296
BLAKE2b-256 84a30af0d6107bc9544f6e9d063fb660090c1c4c3d75e182e12bc710c510f1cf

See more details on using hashes here.

File details

Details for the file clings-4.3.2-py3-none-any.whl.

File metadata

  • Download URL: clings-4.3.2-py3-none-any.whl
  • Upload date:
  • Size: 538.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for clings-4.3.2-py3-none-any.whl
Algorithm Hash digest
SHA256 14a0ca9e6e0fd0e8aec5bb37b59b5c5986173eb348ff3c1bd9620a9372c5494f
MD5 c50f897f9b421046444bffa3a39cbef0
BLAKE2b-256 b2a0771934982093a6a0d884e2fc5de4e96213c6d1152a97f30be28458dae1a7

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page