百科.dev
全部条目在线工具AI 编程趋势榜开源项目技术资讯提交条目
登录
< 返回工具列表
C

code

> 编程语言
开源

《Python架构书》的示例应用代码

2.7K stars0 点赞0 次浏览
访问官网GitHub

工具介绍

《Python架构书》的示例应用代码

《Python》架构模式一书的示例应用代码

章节

每个章节都有其对应的分支,该分支包含该章节的所有提交, 因此它对应的是该章节_结束_时的状态。 如果你想跟着某一章一起编码, 你需要检出前一章的分支。

https://github.com/cosmicpython/code/branches/all

练习

练习的分支遵循 {章节名}_exercise 的命名约定, 例如 https://github.com/cosmicpython/code/tree/chapter_04_service_layer_exercise

环境要求

  • 带有 Docker-compose 的 Docker
  • 对于第1章和第2章,以及可选地对于其余章节:一个本地的 python3.8 虚拟环境

构建容器

(仅从第3章起需要)

bash
make build
make up
# or
make all # builds, brings containers up, runs tests

创建本地虚拟环境(可选)

bash
python3.8 -m venv .venv && source .venv/bin/activate # or however you like to create virtualenvs

# for chapter 1
pip install pytest 

# for chapter 2
pip install pytest sqlalchemy

# for chapter 4+5
pip install -r requirements.txt

# for chapter 6+
pip install -r requirements.txt
pip install -e src/

运行测试

bash
make test
# or, to run individual test types
make unit-tests
make integration-tests
make e2e-tests
# or, if you have a local virtualenv
make up
pytest tests/unit
pytest tests/integration
pytest tests/e2e

Makefile

makefile 中还有更多有用的命令,不妨查看并尝试一下。

Issues· 0 开放

查看全部 Issues在 GitHub 打开

暂无开放 Issues,或尚未同步最近议题。

> 标签

Python

暂无评论,来聊聊你的看法吧

> 工具信息

发布日期2026年8月1日
最后更新2026年9月17日
分类编程语言
定价开源

> 相关工具

T
TypeScript
JavaScript 的超集,为前端与全栈提供静态类型
P
Python
通用编程语言,广泛用于 Web、数据与 AI
G
Go
Google 推出的简洁高效系统语言