# my-z3 **Repository Path**: sn-yang/my-z3 ## Basic Information - **Project Name**: my-z3 - **Description**: Z3 学习 - **Primary Language**: Unknown - **License**: MIT - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2024-02-15 - **Last Updated**: 2024-06-13 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # 我的 z3 学习 ## 介绍 我的 z3 学习 ## 开发环境准备 ### 必装 - python 编辑器:vscode 或者 pycharm - vscode 插件 - Python (Microsoft) - autoDocstring - Python Docstring Generator - Python Indent - git 包含 git-bash - python 3.x ### 配置 python pip 国内源 [pip configuration file](%UserProfile%/pip/pip.ini) ```ini [global] index-url = http://mirrors.aliyun.com/pypi/simple/ [install] trusted-host=mirrors.aliyun.com ``` ### 代码仓库 #### 在 gitee 上配置 SSH Key [参照](git-readme.md#在-gitee-上-配置本地的-ssh) #### 获取仓库代码 ```sh git clone xxx ``` ### 安装组件 - 这是安装在 Python 目录里 - mypy: 支持强类型 - flake8, black, pylint, isort: 用于代码的规范检查和格式化 - poetry: 是一个 Python 虚拟环境和依赖管理的工具 ```sh python -m pip install --upgrade pip pip install poetry # poetry: 检测版本(直接运行) poetry --version # poetry: 检测版本(以 python 模块方式运行) python -m poetry --version ``` ### 安装项目依赖包 ```sh # 激活 python 虚拟环境 poetry shell # 安装项目的依赖包 poetry install ``` ### 运行 ### 单元测试 ```sh ./unittest.sh ``` 或者在 Testing 面板中运行 ## 开发规范 - 在 develop 分支下开发 - 使用 markdown 编辑文档 - 使用 git-bash - 使用 typed python - python formatter provider: yapf - python dos string format: google ### 代码提交流程 - 编辑文件。 - 将需要提交的文件加入到 stage 中。 - commit stage 中内容,并提供一个描述性的信息。 - `git push` - 如果 push 有问题,先 `git pull`,然后 `git push` ## Poetry 命令 ```sh # 初始化项目管理文件 pyproject.toml poetry init # 安装项目的依赖包 poetry install # 更新所有锁定版本的依赖包 poetry update # 更新指定依赖包 poetry update numpy # 增加依赖包 poetry add numpy # 增加依赖包(开发用) poetry add -D black # 卸载依赖包 poetry remove numpy # 查看可以更新的依赖 poetry show --outdated # 查看项目安装的依赖 poetry show # 树形结构查看项目安装的依赖 poetry show -t # 虚拟环境管理 创建虚拟环境 创建虚拟环境有2种方式: 方式1: 如果在配置文件中配置了virtualenvs.create=true,执行poetry install时会检查是否有虚拟环境,否则会自动创建。 方式2: 指定创建虚拟环境时使用的Python解释器版本 poetry env use python3.7 # 激活虚拟环境 poetry shell # 查看虚拟环境信息 poetry env info # 显示虚拟环境列表 poetry env list # 显示虚拟环境绝对路径 poetry env list --full-path # 删除虚拟环境 poetry env remove python3.7 # 查看python版本 poetry run python -V ``` ## 参照 - [Python 中文文档](https://docs.python.org/zh-cn/3.10/index.html) - [Python 基础教程](https://www.runoob.com/python/python-tutorial.html) - [Python 命名规范](https://namingconvention.org/python/) - [poetry](https://python-poetry.org/docs/cli/) ## pip 国内源 - http://mirrors.aliyun.com/pypi/simple/ 阿里云 - https://pypi.mirrors.ustc.edu.cn/simple/ 中国科技大学 - http://pypi.douban.com/simple/ 豆瓣 - https://pypi.tuna.tsinghua.edu.cn/simple/ 清华大学 - http://pypi.mirrors.ustc.edu.cn/simple/ 中国科学技术大学