搜索
首页后端开发Python教程用于快速启动 Polylith 的 Cookiecutter

Cookiecutter for fast starting with polylith

向您展示一个 Python cookiecutter,用于在 Python 中快速启动 Polylith。如果您不知道什么是 Polylith,请阅读文档,对于不耐烦的读者:

Polylith 是一种软件架构,旨在构建简单、可维护、可测试和可扩展的后端系统。它通过在系统规模上应用功能思维来实现这一点,将代码视为可以组合成功能的构建块。

python-polylith 是允许我们在 Python 中实现此功能的工具。

我不会详细介绍这种方法的优点。在本文中,我向您介绍诗歌-poly-cc,这是一个非常有主见的 cookiecutter,用于使用 python-polylith 启动项目。

您可以首先安装 cookiecutter 并使用以下命令生成项目:

cookiecutter https://github.com/ybenitezf/poetry-poly-cc.git

回答问题,你就很好了。你最终应该得到类似的结果:

.
├── LICENSE
├── README.md
├── bases
├── build-packages.sh
├── components
├── development
│   └── __init__.py
├── poetry.toml
├── projects
├── pyproject.toml
├── update-locks.sh
└── workspace.toml

第一步包含在 README.md 中:

  • 安装诗歌:https://python-poetry.org/docs/#installation
  • 添加polylith工具:https://davidvujic.github.io/python-polylith-docs/installation/

奔跑

git init
poetry install
# install pre-commit hook
poetry run pre-commit install
# install pre-commit dependencies
poetry run pre-commit run -a

包含什么

  1. Poetry 配置为在项目文件夹中创建 virtualenv(请参阅诗歌.toml)
  2. pytest 作为测试依赖项添加,还包括 pytest 的一些好东西:pytest-mock、pytest-cov 和 pytest-asyncio
  3. 预提交和 ruff 作为开发依赖项。
  4. mypy 用于静态类型检查,与预提交集成
  5. 支持脚本 build-packages.sh 和 update-locks.sh
  6. 推荐的 vscode 扩展

以上是用于快速启动 Polylith 的 Cookiecutter的详细内容。更多信息请关注PHP中文网其他相关文章!

声明
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn
Python:编译器还是解释器?Python:编译器还是解释器?May 13, 2025 am 12:10 AM

Python是解释型语言,但也包含编译过程。1)Python代码先编译成字节码。2)字节码由Python虚拟机解释执行。3)这种混合机制使Python既灵活又高效,但执行速度不如完全编译型语言。

python用于循环与循环时:何时使用哪个?python用于循环与循环时:何时使用哪个?May 13, 2025 am 12:07 AM

useeAforloopWheniteratingOveraseQuenceOrforAspecificnumberoftimes; useAwhiLeLoopWhenconTinuingUntilAcIntiment.ForloopSareIdeAlforkNownsences,而WhileLeleLeleLeleLoopSituationSituationSituationsItuationSuationSituationswithUndEtermentersitations。

Python循环:最常见的错误Python循环:最常见的错误May 13, 2025 am 12:07 AM

pythonloopscanleadtoerrorslikeinfiniteloops,modifyingListsDuringteritation,逐个偏置,零indexingissues,andnestedloopineflinefficiencies

对于循环和python中的循环时:每个循环的优点是什么?对于循环和python中的循环时:每个循环的优点是什么?May 13, 2025 am 12:01 AM

forloopsareadvantageousforknowniterations and sequests,供应模拟性和可读性;而LileLoopSareIdealFordyNamicConcitionSandunknowniterations,提供ControloperRoverTermination.1)forloopsareperfectForeTectForeTerToratingOrtratingRiteratingOrtratingRitterlistlistslists,callings conspass,calplace,cal,ofstrings ofstrings,orstrings,orstrings,orstrings ofcces

Python:深入研究汇编和解释Python:深入研究汇编和解释May 12, 2025 am 12:14 AM

pythonisehybridmodelofcompilationand interpretation:1)thepythoninterspretercompilesourcececodeintoplatform- interpententbybytecode.2)thepytythonvirtualmachine(pvm)thenexecuteCutestestestesteSteSteSteSteSteSthisByTecode,BelancingEaseofuseWithPerformance。

Python是一种解释或编译语言,为什么重要?Python是一种解释或编译语言,为什么重要?May 12, 2025 am 12:09 AM

pythonisbothinterpretedAndCompiled.1)它的compiledTobyTecodeForportabilityAcrosplatforms.2)bytecodeisthenInterpreted,允许fordingfordforderynamictynamictymictymictymictyandrapiddefupment,尽管Ititmaybeslowerthananeflowerthanancompiledcompiledlanguages。

对于python中的循环时循环与循环:解释了关键差异对于python中的循环时循环与循环:解释了关键差异May 12, 2025 am 12:08 AM

在您的知识之际,而foroopsareideal insinAdvance中,而WhileLoopSareBetterForsituations则youneedtoloopuntilaconditionismet

循环时:实用指南循环时:实用指南May 12, 2025 am 12:07 AM

ForboopSareSusedwhenthentheneMberofiterationsiskNownInAdvance,而WhileLoopSareSareDestrationsDepportonAcondition.1)ForloopSareIdealForiteratingOverSequencesLikelistSorarrays.2)whileLeleLooleSuitableApeableableableableableableforscenarioscenarioswhereTheLeTheLeTheLeTeLoopContinusunuesuntilaspecificiccificcificCondond

See all articles

热AI工具

Undresser.AI Undress

Undresser.AI Undress

人工智能驱动的应用程序,用于创建逼真的裸体照片

AI Clothes Remover

AI Clothes Remover

用于从照片中去除衣服的在线人工智能工具。

Undress AI Tool

Undress AI Tool

免费脱衣服图片

Clothoff.io

Clothoff.io

AI脱衣机

Video Face Swap

Video Face Swap

使用我们完全免费的人工智能换脸工具轻松在任何视频中换脸!

热门文章

热工具

EditPlus 中文破解版

EditPlus 中文破解版

体积小,语法高亮,不支持代码提示功能

PhpStorm Mac 版本

PhpStorm Mac 版本

最新(2018.2.1 )专业的PHP集成开发工具

SublimeText3 Linux新版

SublimeText3 Linux新版

SublimeText3 Linux最新版

WebStorm Mac版

WebStorm Mac版

好用的JavaScript开发工具

ZendStudio 13.5.1 Mac

ZendStudio 13.5.1 Mac

功能强大的PHP集成开发环境