开发环境

开发编辑器/IDE vim vscode goland pycharm CI/CD gitlab CI/CD github actions teamcity 部署选择 docker supervisor pm2 systemd 网络工具 wireshark socat tcpdump Go Golang 开发环境准备和工具选择 参考Alikhll/golang-developer-roadmap。 更多关于golang的分享,参考Awesome-go 包管理 加速/私有模块 组件 CLI工具开发 cobra Config viper Web Gin🍺 Echo🍺 Beego go-swagger Iris ORM Gorm🍺 Xorm DB PG🍺 Redis🍺 MongoDB Log Zap🍺 Logrus Websocket gorilla/websocket Task schedule Gron test testify convey, bdd python lint black isort darker

July 13, 2023 · 1 min · Peter

Pyenv

加速 从其他镜像站下载源码到 $PYENV_ROOT/.pyenv/cache 目录,然后执行安装 export v=3.11.3 curl -L https://npm.taobao.org/mirrors/python/$v/Python-$v.tar.xz -o ~/.pyenv/cache/Python-$v.tar.xz pyenv install $v pyenv-update 是一个pyenv的插件,用于更新插件和可安装版本列表 $ git clone https://github.com/pyenv/pyenv-update.git $(pyenv root)/plugins/pyenv-update $ pyenv update

May 17, 2023 · 1 min · Peter

Compile

compile # python -m compileall [*.py ...] python -m compileall . decompile python3.7 or newer decompyle3 pip install decompyle3 decompyle3 XX.pyc > xx.py before python3.7 pip install uncompyle6 uncompyle6 *compiled-python-file-pyc-or-pyo*

October 14, 2022 · 1 min · Peter

Fastapi

middleware or dependency 官方说明 场景: 项目使用了sqlite+sqlalchemy,暂时不支持async方式访问,但是fastapi的middleware的 __call__ 方法必须是async,如果在middleware中去做用户会话管理等和db相关的io操作可能导致整个应用阻塞。 解决: 使用def的dependency组合完成相关操作 官方对于两个组件的对比说明: middleware 代码多一些,更复杂一些 必须是async方法 任何需要IO代码的添加都可能导致整个应用速度变慢或者阻塞 每个请求都会执行相关代码,如果是db的话,即使路由函数不需要也会创建

July 27, 2022 · 1 min · Peter

Playwright

image docker pull mcr.microsoft.com/playwright/python:v1.20.0-focal 本地环境 pip install playwright -i https://pypi.tuna.tsinghua.edu.cn/simple playwright install

March 24, 2022 · 1 min · Peter