{"id":34100446,"url":"https://github.com/alinvor/python-demo","last_synced_at":"2026-03-12T00:34:22.541Z","repository":{"id":43891950,"uuid":"224807399","full_name":"Alinvor/Python-DeMo","owner":"Alinvor","description":"Python DeMo","archived":false,"fork":false,"pushed_at":"2022-02-15T07:44:48.000Z","size":1878,"stargazers_count":1,"open_issues_count":5,"forks_count":0,"subscribers_count":2,"default_branch":"deploy","last_synced_at":"2025-09-30T09:16:00.599Z","etag":null,"topics":["python-demo"],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Alinvor.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-11-29T08:12:00.000Z","updated_at":"2021-07-08T06:14:39.000Z","dependencies_parsed_at":"2022-09-16T04:11:36.904Z","dependency_job_id":null,"html_url":"https://github.com/Alinvor/Python-DeMo","commit_stats":null,"previous_names":[],"tags_count":18,"template":false,"template_full_name":null,"purl":"pkg:github/Alinvor/Python-DeMo","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Alinvor%2FPython-DeMo","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Alinvor%2FPython-DeMo/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Alinvor%2FPython-DeMo/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Alinvor%2FPython-DeMo/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Alinvor","download_url":"https://codeload.github.com/Alinvor/Python-DeMo/tar.gz/refs/heads/deploy","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Alinvor%2FPython-DeMo/sbom","scorecard":{"id":11875,"data":{"date":"2025-08-11","repo":{"name":"github.com/Alinvor/Python-DeMo","commit":"e7b5e56eac86c03460f83a3a682cc9ad351f74fc"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3.5,"checks":[{"name":"Dangerous-Workflow","score":-1,"reason":"no workflows found","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Code-Review","score":0,"reason":"Found 0/7 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Pinned-Dependencies","score":-1,"reason":"no dependencies found","details":null,"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE.txt:0","Info: FSF or OSI recognized license: MIT License: LICENSE.txt:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}},{"name":"Branch-Protection","score":-1,"reason":"internal error: error during branchesHandler.setup: internal error: githubv4.Query: Resource not accessible by integration","details":null,"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 30 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}}]},"last_synced_at":"2025-08-14T14:47:36.365Z","repository_id":43891950,"created_at":"2025-08-14T14:47:36.368Z","updated_at":"2025-08-14T14:47:36.368Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":27732068,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-12-14T02:00:11.348Z","response_time":56,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["python-demo"],"created_at":"2025-12-14T17:00:11.221Z","updated_at":"2025-12-14T17:00:12.597Z","avatar_url":"https://github.com/Alinvor.png","language":"Python","readme":"# Python-DeMo\n\n![Python Logo](https://www.python.org/static/community_logos/python-logo.png \"Python DeMo\")\n\n- [一. 构建`venv`环境](#一-构建venv环境)\n  - [1.1 venv2](#11-venv2)\n    - [1.1.1 venv2 for mac](#111-venv2-for-mac)\n      - [1.1.1.1 venv2 16.7.5](#1111-venv2-1675)\n      - [1.1.1.2 venv2 20.4.6](#1112-venv2-2046)\n    - [1.1.2 venv2 for windows](#112-venv2-for-windows)\n  - [1.2 venv3](#12-venv3)\n    - [1.2.1 venv3 for mac](#121-venv3-for-mac)\n      - [1.2.1.1 venv3 16.7.5](#1211-venv3-1675)\n      - [1.2.1.2 venv3 20.4.6](#1212-venv3-2046)\n    - [1.2.2 venv3 for windows](#122-venv3-for-windows)\n- [二. 多模块配置](#二-多模块配置)\n- [三. venvX activate and deactivate](#三-venvx-activate-and-deactivate)\n  - [3.1 venvX activate](#31-venvx-activate)\n    - [3.1.1 activate for mac](#311-activate-for-mac)\n    - [3.1.2 activate for windows](#312-activate-for-windows)\n- [四. 脚本](#四-脚本)\n  - [4.1 python version](#41-python-version)\n  - [4.2 pip setuptools wheel version](#42-pip-setuptools-wheel-version)\n    - [4.2.1 pip freeze list](#421-pip-freeze-list)\n    - [4.2.2 pip cache](#422-pip-cache)\n    - [4.2.3 setuptools](#423-setuptools)\n      - [4.2.3.1 setup.cfg](#4231-setupcfg)\n      - [4.2.3.2 setup.py](#4232-setuppy)\n  - [4.3 virtualenv version](#43-virtualenv-version)\n  - [4.4 tox tox-travis version](#44-tox-tox-travis-version)\n  - [4.5 twine version](#45-twine-version)\n- [五. 构建与分发](#五-构建与分发)\n  - [5.1 安装](#51-安装)\n  - [5.2 配置](#52-配置)\n    - [5.2.1 pyproject.toml](#521-pyprojecttoml)\n    - [5.2.2 MANIFEST.in](#522-manifestin)\n    - [5.2.3 tox.ini](#523-toxini)\n    - [5.2.4 setup.cfg](#524-setupcfg)\n    - [5.2.5 setup.py](#525-setuppy)\n    - [5.2.6 README.md](#526-readmemd)\n  - [5.3 构建](#53-构建)\n    - [5.3.1 tox 脚本测试](#531-tox-脚本测试)\n    - [5.3.2 build](#532-build)\n  - [5.3 发布](#53-发布)\n    - [5.3.1 注册账号](#531-注册账号)\n    - [5.3.2 检查软件包](#532-检查软件包)\n    - [5.3.3 上传软件包](#533-上传软件包)\n- [六. WiKi](#六-wiki)\n  - [6.1 规约与守则](#61-规约与守则)\n  - [6.2 文档与源码](#62-文档与源码)\n  - [6.3 配置与模板](#63-配置与模板)\n  - [6.4 调试与构建](#64-调试与构建)\n  - [6.5 日志与清理](#65-日志与清理)\n- [七. 参考](#七-参考)\n\n## 一. 构建`venv`环境\n\n首先检查是否安装如下软件包:\n\n```bash\n# python2\npython2 -m pip --version\npython2 -m setuptools --version\npython2 -m wheel --version\npython2 -m virtualenv --version\n\n\n# python3\npython3 -m pip --version\npython3 -m setuptools --version\npython3 -m wheel --version\npython3 -m virtualenv --version\n```\n\n如果没有，请安装如下软件包:\n\n```bash\n# python2\npython2 -m pip install setuptools wheel virtualenv\n或\npython2 -m pip install virtualenv\n\n# python3\npython3 -m pip install setuptools wheel virtualenv\n或\npython3 -m pip install virtualenv\n```\n\n### 1.1 venv2\n\n#### 1.1.1 venv2 for mac\n\n##### 1.1.1.1 venv2 16.7.5\n\n```bash\npython2 -m virtualenv -p /usr/local/bin/python2 --no-site-packages venv2\n```\n\n##### 1.1.1.2 venv2 20.4.6\n\n```bash\npython2 -m virtualenv -p /usr/local/bin/python2 venv2\n```\n\n#### 1.1.2 venv2 for windows\n\n```bash\npython2 -m virtualenv -p C:\\Python\\Python27\\python2.exe venv2\n\n或\n\npython2 -m virtualenv -p C:\\Python\\Python27\\python2.exe venv2 \u003e venv2.log\n```\n\n### 1.2 venv3\n\n#### 1.2.1 venv3 for mac\n\n##### 1.2.1.1 venv3 16.7.5\n\n```bash\npython3 -m virtualenv -p /usr/local/bin/python3 --no-site-packages venv\n```\n\n##### 1.2.1.2 venv3 20.4.6\n\n```bash\npython3 -m virtualenv -p /usr/local/bin/python3 venv\n```\n\n#### 1.2.2 venv3 for windows\n\n```bash\npython3 -m virtualenv -p C:\\Python\\Python38\\python3.exe venv\n\n或\n\npython3 -m virtualenv -p C:\\Python\\Python38\\python3.exe venv \u003e venv.log\n```\n\n## 二. 多模块配置\n\n具体步骤:\n\n1. 在`venv2`和`venv` 下新建一个`python.pth`文件，具体目录为`venv2/lib/python2.x/site-packages/python.pth`和`venv/lib/python3.x/site-packages/python.pth`;\n2. 在上述`python.pth`文件中写入多模块的`绝对路径`(自己设备上实际目录);\n\n```python\n# venv2 环境\n# /Users/.../Python-DeMo/venv2/lib/python2.x/site-packages/python.pth\n#\n# venv 环境\n# /Users/.../Python-DeMo/venv/lib/python3.x/site-packages/python.pth\n\n/Users/.../Python-DeMo/src\n/Users/.../Python-DeMo/test\n/Users/.../Python-DeMo/mock\n/Users/.../Python-DeMo/case\n```\n\n## 三. venvX activate and deactivate\n\n### 3.1 venvX activate\n\n#### 3.1.1 activate for mac\n\n在控制台中输入如下命令，使得Mac 环境下的 `virtualenv` 生效:\n\n```bash\n# python2\nsource ./venv2/bin/activate\n\n\n# python3\nsource ./venv/bin/activate\n```\n\n#### 3.1.2 activate for windows\n\n在控制台中输入如下命令，使得Windows 环境下的 `virtualenv` 生效:\n\n```bash\n# python2\n./venv2/Scripts/activate\n\n\n# python3\n./venv/Scripts/activate\n```\n\n## 四. 脚本\n\n### 4.1 python version\n\n```bash\n# python\npython2 --version\npython3 --version\n# python help\npython2 --help \u003e ./Temp/help/python2_help.txt\npython3 --help \u003e ./Temp/help/python3_help.txt\n```\n\n### 4.2 pip setuptools wheel version\n\n```bash\n# pip\npython2 -m pip --version\npython3 -m pip --version\n\n# pip setuptools wheel help\npython2 -m pip --help \u003e ./Temp/help/python2_pip_help.txt\npython3 -m pip --help \u003e ./Temp/help/python3_pip_help.txt\n## python2 -m setuptools --help \u003e ./Temp/help/python2_setuptools_help.txt\n## python3 -m setuptools --help \u003e ./Temp/help/python3_setuptools_help.txt\npython2 -m setup.py --help-commands \u003e ./Temp/help/python2_setuptools_help.txt\npython3 -m setup.py --help-commands \u003e ./Temp/help/python3_setuptools_help.txt\npython2 -m wheel --help \u003e ./Temp/help/python2_wheel_help.txt\npython3 -m wheel --help \u003e ./Temp/help/python3_wheel_help.txt\n```\n\n#### 4.2.1 pip freeze list\n\n```bash\n# pip freeze\npython2 -m pip freeze \u003e ./Temp/python2_pip_freeze.txt\npython3 -m pip freeze \u003e ./Temp/python3_pip_freeze.txt\npython2 -m pip list \u003e ./Temp/python2_pip_list.txt\npython3 -m pip list \u003e ./Temp/python3_pip_list.txt\n```\n\n#### 4.2.2 pip cache\n\n```bash\n# pip cache list\npython2 -m pip cache list \u003e ./out/dist/python2_pip2_cache_list.txt\npython3 -m pip cache list \u003e ./out/dist/python3_pip3_cache_list.txt\n# pip no cache install\npython2 -m pip --no-cache-dir install com.dvsnier.*\npython3 -m pip --no-cache-dir install com.dvsnier.*\n# pip remove cache package with whl\npython2 -m pip cache remove com.dvsnier.*\npython3 -m pip cache remove com.dvsnier.*\n```\n\n#### 4.2.3 setuptools\n\n##### 4.2.3.1 setup.cfg\n\n```bash\n# python2 build\npython2 -m pip install build\npython2 -m pip install --upgrade build\npython2 -m build\npython2 -m build \u003e ./out/dist/build.txt\n\n# python3 build\npython3 -m pip install build\npython3 -m pip install --upgrade build\npython3 -m build\npython3 -m build \u003e ./out/dist/build.txt\n```\n\n##### 4.2.3.2 setup.py\n\n```bash\n# setup sdist\npython2 setup.py sdist \u003e ./out/dist/setup2_sdist.txt\npython3 setup.py sdist \u003e ./out/dist/setup3_sdist.txt\n\npython2 setup.py bdist_wheel --universal\npython3 setup.py bdist_wheel --universal\n\npython2 setup.py bdist_wheel\npython3 setup.py bdist_wheel\n```\n\n### 4.3 virtualenv version\n\n```bash\n# virtualenv\npython2 -m virtualenv --version\npython3 -m virtualenv --version\n# virtualenv help\npython2 -m virtualenv --help \u003e ./Temp/help/python2_virtualenv_help.txt\npython3 -m virtualenv --help \u003e ./Temp/help/python3_virtualenv_help.txt\n```\n\n### 4.4 tox tox-travis version\n\n```bash\n# tox\npython2 -m tox --version\n# python2 -m tox-travis --version\npython3 -m tox --version\n# python3 -m tox-travis --version\n# tox tox-travis help\npython2 -m tox --help \u003e ./Temp/help/python2_tox_help.txt\n# python2 -m tox-travis --help \u003e ./Temp/help/python2_tox_travis_help.txt\npython3 -m tox --help \u003e ./Temp/help/python3_tox_help.txt\n# python3 -m tox-travis --help \u003e ./Temp/help/python3_tox_travis_help.txt\n```\n\n如若快捷生成脚本,参考如下命令:\n\n```bash\ntox-quickstart\n```\n\n默认运行命令，如下:\n\n```bash\ntox\n\n# the recommend\ntox --result-json ./Temp/tox/python2_tox_result.json\ntox --result-json ./Temp/tox/python3_tox_result.json\n```\n\n### 4.5 twine version\n\n```bash\n# twine\npython2 -m twine --version\npython3 -m twine --version\n# twine help\npython2 -m twine --help \u003e ./Temp/help/python2_twine_help.txt\npython3 -m twine --help \u003e ./Temp/help/python3_twine_help.txt\n\n# check python check and upload dist format\ntwine check dist/*\ntwine upload dist/*\n```\n\n## 五. 构建与分发\n\nPython 软件包开发工程结构，如下所示:\n\n```Django\n# soft package tree\n\n--- project root\n    |\n    | --- .tox\n    | --- .vscode\n    | --- build\n    | --- dist\n    | --- doc\n        --- ...\n            --- README.md\n    | --- out\n    | --- src\n        --- com\n            --- dvsnier\n                --- ...\n    | --- Temp\n    | --- template\n    | --- tests\n        --- com\n            --- dvsnier\n                --- ...\n    | --- venv\n    | --- venv2\n    | --- .editorconfig\n    | --- .env\n    | --- .gitignore\n    | --- .rmcache.bash\n    | --- .rmcache.ps1\n    | --- LICENSE.txt\n    | --- MANIFEST.in\n    | --- pyproject.toml\n    | --- README.md\n    | --- requirements.txt\n    | --- setup.cfg\n    | --- tox.ini\n```\n\n### 5.1 安装\n\n首先检查是否安装如下依赖:\n\n1. build\n2. discover\n3. flake8 (可选)\n4. pip\n5. setuptools\n6. tox\n7. toml (可选)\n8. tox-travis (可选)\n9. twine\n10. unittest2\n11. virtualenv\n12. wheel\n\n\n如若没有，请使用`pip` 命令安装如下软件包:\n\n```bash\n# python2 pip version\npython2 -m pip --version\n\npython2 -m pip install build\npython2 -m pip install discover\npython2 -m pip install flake8\npython2 -m pip install pip\npython2 -m pip install setuptools\npython2 -m pip install tox\npython2 -m pip install toml\npython2 -m pip install tox-travis\npython2 -m pip install twine\npython2 -m pip install unittest2\npython2 -m pip install virtualenv\npython2 -m pip install wheel\n\n# python3 pip version\npython3 -m pip --version\n\npython3 -m pip install build\npython3 -m pip install discover\npython3 -m pip install flake8\npython3 -m pip install pip\npython3 -m pip install setuptools\npython3 -m pip install tox\npython3 -m pip install toml\npython3 -m pip install tox-travis\npython3 -m pip install twine\npython3 -m pip install unittest2\npython3 -m pip install virtualenv\npython3 -m pip install wheel\n```\n\n其实一般安装有 `pip` 软件包的，一般都会有`setuptools` 和`wheel` 软件包附带安装;\n\n### 5.2 配置\n\n#### 5.2.1 pyproject.toml\n\n首先配置 `pyproject.toml` ，模板固定, 一般不需大范围改动;\n\n```bash\n[build-system]\n# https://setuptools.readthedocs.io/en/latest/build_meta.html\n# These are the assumed default build requirements from pip:\n# https://pip.pypa.io/en/stable/cli/pip/#pep-517-and-518-support\n#\n# As of version 10.0, pip supports projects declaring dependencies that are\n# required at install time using a pyproject.toml file, in the form described\n# in PEP 518. When building a project, pip will install the required\n# dependencies locally, and make them available to the build process.\n# Furthermore, from version 19.0 onwards, pip supports projects specifying the\n# build backend they use in pyproject.toml, in the form described in PEP 517.\n#\nrequires = [\n    \"setuptools\u003e=40.8.0\",\n    \"wheel\"\n]\nbuild-backend = \"setuptools.build_meta\"\n```\n\n#### 5.2.2 MANIFEST.in\n\n然后配置 `MANIFEST.in` 软件包应当包含哪些信息,哪些排除配置信息, 如下所示:\n\n```bash\n# https://packaging.python.org/guides/using-manifest-in/\n\ninclude pyproject.toml\n\n# Include the README\ninclude *.md\n\n# Include the license file\ninclude LICENSE.txt\n\n# # Include the requirements file\ninclude requirements.txt\n```\n\n同上，模板一般都是固定结构，无需太范围改动;\n\n#### 5.2.3 tox.ini\n\n再然后配置 `tox` 脚本自动化测试, 指定Python 虚拟环境版本, 配置信息如下:\n\n```bash\n# tox (https://tox.readthedocs.io/) is a tool for running tests\n# in multiple virtualenvs. This configuration file will run the\n# test suite on all supported python versions. To use it, \"pip install tox\"\n# and then run \"tox\" from this directory.\n# For information see https://tox.readthedocs.io/en/latest/examples.html\n\n[tox]\nenvlist = py27, py38\n\nminversion = 3.23.1\n\n# Activate isolated build environment. tox will use a virtual environment\n# to build a source distribution from the source tree. For build tools and\n# arguments use the pyproject.toml file as specified in PEP-517 and PEP-518.\nisolated_build = true\n\n# install testing framework\n# ... or install anything else you might need here\n[testenv]\npassenv =\n    PYTHONPATH\nplatform = linux: linux\n           macos: darwin\n           windows: win32\n; alwayscopy = True\nallowlist_externals =\n    /bin/bash\n; changedir =\n;     tests\n#\n# https://tox.readthedocs.io/en/latest/config.html#conf-deps\n# https://tox.readthedocs.io/en/latest/example/basic.html#a-simple-tox-ini-default-environments\n#\ndeps =\n    -rrequirements.txt\n    unittest2\n    flake8\n    virtualenv\n    setuptools\n    wheel\n    discover\n    tox\n    toml\n    tox-travis\n    build\n    twine\ncommands =\n    ; windows: python --version\n    ; macos,linux: python --version\n    discover -s ./tests -t .\n    ; unit2 discover []\n    ; python -m unittest discover\n```\n\n#### 5.2.4 setup.cfg\n\n最后配置 `setup.cfg` 构建脚本, 指定软件包所要构建的软件细节部分, 举例配置信息如下:\n\n```bash\n[metadata]\n# 1. https://setuptools.readthedocs.io/en/latest/\n# 2. https://setuptools.readthedocs.io/en/latest/userguide/declarative_config.html\n# 3. https://setuptools.readthedocs.io/en/latest/references/keywords.html\nname = com.dvsnier.xxx\nversion = 0.0.1.dev1\nauthor = dvsnier\nauthor_email = dovsnier@qq.com\ndescription = this is dvsnier xxx.\nlong_description = file: ./doc/description/xxx/README.md\nlong_description_content_type = text/markdown\nkeywords = xxx, development\nurl = https://github.com/Alinvor/Python-DeMo\nproject_urls =\n    Documentation = https://packaging.python.org/tutorials/distributing-packages/\n    Funding = https://donate.pypi.org\n    Wiki = https://github.com/Alinvor/Python-DeMo/wiki\n    Bug_Tracker = https://github.com/Alinvor/Python-DeMo/issues\n    Source = https://github.com/Alinvor/Python-DeM\nplatforms = any\n# classifiers\n# Development Status :: 3 - Alpha\n# Development Status :: 4 - Beta\n# Development Status :: 5 - Production/Stable\nclassifiers =\n    Development Status :: 3 - Alpha\n    Topic :: Software Development :: Libraries\n    License :: OSI Approved :: MIT License\n    Programming Language :: Python :: 2.7\n    Programming Language :: Python :: 3.8\n    Programming Language :: Python :: 3.9\n\npython_requires =\n    \u003e=2.7\n    \u003c4\n\n# This includes the license file(s) in the wheel.\n# https://wheel.readthedocs.io/en/stable/user_guide.html#including-license-files-in-the-generated-wheel-file\n# https://choosealicense.com/\nlicense = MIT License\nlicense_files =\n    LICENSE.txt\n\n[options]\npackage_dir =\n    = src\n\npackages = find:\n\n[options.packages.find]\nwhere = src\n#\n# https://packaging.python.org/guides/distributing-packages-using-setuptools/#wheels\n#\n[bdist_wheel]\nuniversal = 1\n```\n\n\u003e 软件包`名称`和软件包`版本`信息, 一定要明确具体发布规则;\n\n实际项目中, 可依据如上配置信息稍加修改和增添;\n\n#### 5.2.5 setup.py\n\n最后配置 `setup.py` 构建脚本, 指定软件包所要构建的软件细节部分, 举例配置信息如下:\n\n```bash\n# -*- coding:utf-8 -*-\n\"\"\"A setuptools based setup module.\n\nSee:\nhttps://packaging.python.org/guides/distributing-packages-using-setuptools/\nhttps://github.com/Alinvor/Python-DeMo\n\"\"\"\n\n# Always prefer setuptools over distutils\n# from setuptools import setup, find_packages, find_namespace_packages\nfrom setuptools import setup, find_packages\nimport os\nimport sys\n\n\ndef read_text(file_name):\n    ''' the read describe readme files content. '''\n    content = ''\n    with open(file_name, 'r') as file:\n        lines = file.readlines()\n        for line in lines:\n            if sys.version_info.major \u003e 2:\n                content += str(line)\n            else:\n                content += str(line).encode('utf-8')\n    # print(content)\n    return content\n\n\nproject = os.getenv('BASE_PROJECT_PREFIX')\nif project is None:\n    raise KeyError('the please configure BASE_PROJECT_PREFIX environment variable, otherwise it cannot run')\nprint(project)\nPROJECT_DIRECTORY = 'xxx'  # project directory\nPROJECT_README_FILE = 'README.md'  # project readme file\nREADME_ROOT_DIRECTORY = os.path.join(project, 'doc/description')\nREADME_PROJECT_DIRECTORY = os.path.join(README_ROOT_DIRECTORY, PROJECT_DIRECTORY)\nPROJECT_DESCRIPTION = os.path.join(README_PROJECT_DIRECTORY, PROJECT_README_FILE)\n#\n# Arguments marked as \"Required\" below must be included for upload to PyPI.\n# Fields marked as \"Optional\" may be commented out.\n#\n# |  序列  |                 字段                  |   数据类型   |  选项  |  描述                 | 备注 |\n# | :---: | :-----------------------------------: | :---------: | :---: | -------------------- | ---- |\n# |   1   |             DVSNIER_NAME              |   string    |   Y   | 包名称                |      |\n# |   2   |            DVSNIER_VERSION            |   string    |   Y   | 包版本                |      |\n# |   3   |          DVSNIER_DESCRIPTOIN          |   string    |       | 包简单描述             |      |\n# |   4   |       DVSNIER_LONG_DESCRIPTOIN        |    file     |       | 较长文档描述           |      |\n# |   5   | DVSNIER_LONG_DESCRIPTION_CONTENT_TYPE |   string    |       | 长文本类型描述          |      |\n# |   6   |              DVSNIER_URL              |    http     |       | 项目主页               |      |\n# |   7   |            DVSNIER_AUTHOR             |   string    |       | 项目作者               |      |\n# |   8   |         DVSNIER_AUTHOR_EMAIL          |    email    |       | 项目作者邮箱           |      |\n# |   9   |         DVSNIER_LICENSE               |    许可证    |       | 许可证                |      |\n# |  10   |          DVSNIER_CLASSIFIERS          | classifiers |       | 项目分类器             |      |\n# |  11   |           DVSNIER_KEYWORDS            |  keywords   |       | 项目关键字             |      |\n# |  12   |          DVSNIER_PACKAGE_DIR          |   string    |       | 包目录                |      |\n# |  13   |          DVSNIER_PY_MODULES           |   string    |   Y   | 模块名称               |      |\n# |  14   |           DVSNIER_PACKAGES            |   string    |   Y   | 包名称                 |      |\n# |  15   |        DVSNIER_PYTHON_REQUIRES        |   string    |   Y   | 版本匹配分类器描述符     |      |\n# |  16   |       DVSNIER_INSTALL_REQUIRES        |    list     |       | 依赖库                 |      |\n# |  17   |        DVSNIER_EXTRAS_REQUIRE         |    dict     |       | 附加/扩展依赖           |      |\n# |  18   |         DVSNIER_PACKAGE_DATA          |    dict     |       | 包数据文件              |      |\n# |  19   |          DVSNIER_DATA_FILES           |    list     |       | 包外数据文件            |      |\n# |  20   |         DVSNIER_ENTRY_POINTS          |    dict     |       | 入口点                 |      |\n# |  21   |         DVSNIER_PROJECT_URLS          |    dict     |       | 项目 URL               |      |\n# |  22   |                                       |             |       |                       |      |\nDVSNIER_NAME = 'com.dvsnier.xxx'  # Required\nDVSNIER_VERSION = '0.0.1.dev0'  # Required\nDVSNIER_DESCRIPTOIN = 'this is dvsnier xxx.'  # Optional\n# Get the long description from the README file\nDVSNIER_LONG_DESCRIPTOIN = read_text(str(PROJECT_DESCRIPTION))  # Optional\nDVSNIER_LONG_DESCRIPTION_CONTENT_TYPE = 'text/markdown'  # Optional\nDVSNIER_URL = 'https://github.com/Alinvor/Python-DeMo'  # Optional\nDVSNIER_AUTHOR = 'dvsnier'  # Optional\nDVSNIER_AUTHOR_EMAIL = 'dovsnier@qq.com'  # Optional\nDVSNIER_LICENSE = 'MIT'  # Optional\nDVSNIER_CLASSIFIERS = [  # Optional\n    # How mature is this project? Common values are\n    #   3 - Alpha\n    #   4 - Beta\n    #   5 - Production/Stable\n    'Development Status :: 3 - Alpha',\n\n    # Indicate who your project is intended for\n    # 'Intended Audience :: Developers',\n    # 'Topic :: Software Development :: Build Tools',\n    'Topic :: Software Development :: Libraries',\n\n    # Pick your license as you wish\n    'License :: OSI Approved :: MIT License',\n\n    # Specify the Python versions you support here. In particular, ensure\n    # that you indicate you support Python 3. These classifiers are *not*\n    # checked by 'pip install'. See instead 'python_requires' below.\n    'Programming Language :: Python :: 2.7',\n    'Programming Language :: Python :: 3.8',\n    'Programming Language :: Python :: 3.9',\n    # 'Programming Language :: Python :: 3 :: Only',\n    # 'Operating System :: OS Independent'\n]\nDVSNIER_KEYWORDS = 'xxx, development'  # Optional\nDVSNIER_PACKAGE_DIR = {'': 'src'}  # Optional\n# DVSNIER_PY_MODULES = [\"xxx\"]  # Required\n# DVSNIER_PACKAGES = find_packages(include=['xxx', 'xxx.*'])  # Required\nDVSNIER_PACKAGES = find_packages(where='src')  # Required\n# DVSNIER_NAMESPACE_PACKAGES = find_namespace_packages(include=['com.*'])  # Required\n# DVSNIER_PYTHON_REQUIRES = '\u003e=2.7, !=3.0.*, !=3.1.*, !=3.2.*'\nDVSNIER_PYTHON_REQUIRES = '\u003e=2.7, \u003c4'\nDVSNIER_INSTALL_REQUIRES = [  # Optional\n\n]\nDVSNIER_EXTRAS_REQUIRE = {  # Optional\n    'dev': ['check-manifest'],\n    'test': ['coverage']\n}\nDVSNIER_PACKAGE_DATA = {  # Optional\n    # 'sample': ['package_data.dat'],\n}\nDVSNIER_DATA_FILES = [  # Optional\n    # ('my_data', ['data/data_file'])\n]\nDVSNIER_ENTRY_POINTS = {  # Optional\n    # 'console_scripts': [\n    #     'dvs-dir=dvs:main',\n    # ],\n}\nDVSNIER_PROJECT_URLS = {  # Optional\n    'Bug_Tracker': 'https://github.com/Alinvor/Python-DeMo/issues',\n    'Documentation': 'https://packaging.python.org/tutorials/distributing-packages/',\n    'Funding': 'https://donate.pypi.org',\n    'Wiki': 'https://github.com/Alinvor/Python-DeMo/wiki',\n    'Source': 'https://github.com/Alinvor/Python-DeMo'\n}\n\nsetup(\n    # This is the name of your project. The first time you publish this\n    # package, this name will be registered for you. It will determine how\n    # users can install this project, e.g.:\n    #\n    # $ pip install com.dvsnier.xxx\n    #\n    # And where it will live on PyPI: https://pypi.org/project/com.dvsnier.xxx/\n    #\n    # There are some restrictions on what makes a valid project name\n    # specification here:\n    # https://packaging.python.org/specifications/core-metadata/#name\n    name=DVSNIER_NAME,  # Required\n\n    # Versions should comply with PEP 440:\n    # https://www.python.org/dev/peps/pep-0440/\n    # https://semver.org/lang/zh-CN/\n    #\n    # 1.2.0.dev1   Development release\n    # 1.2.0a1      Alpha Release\n    # 1.2.0b1      Beta Release\n    # 1.2.0rc1     Release Candidate\n    # 1.2.0        Final Release\n    # 1.2.0.post1  Post Release\n    # 15.10        Date based release\n    # 23           Serial release\n    #\n    # For a discussion on single-sourcing the version across setup.py and the\n    # project code, see\n    # https://packaging.python.org/en/latest/single_source_version.html\n    version=DVSNIER_VERSION,  # Required\n\n    # This is a one-line description or tagline of what your project does. This\n    # corresponds to the \"Summary\" metadata field:\n    # https://packaging.python.org/specifications/core-metadata/#summary\n    description=DVSNIER_DESCRIPTOIN,  # Optional\n\n    # This is an optional longer description of your project that represents\n    # the body of text which users will see when they visit PyPI.\n    #\n    # Often, this is the same as your README, so you can just read it in from\n    # that file directly (as we have already done above)\n    #\n    # This field corresponds to the \"Description\" metadata field:\n    # https://packaging.python.org/specifications/core-metadata/#description-optional\n    long_description=DVSNIER_LONG_DESCRIPTOIN,  # Optional\n\n    # Denotes that our long_description is in Markdown; valid values are\n    # text/plain, text/x-rst, and text/markdown\n    #\n    # Optional if long_description is written in reStructuredText (rst) but\n    # required for plain-text or Markdown; if unspecified, \"applications should\n    # attempt to render [the long_description] as text/x-rst; charset=UTF-8 and\n    # fall back to text/plain if it is not valid rst\" (see link below)\n    #\n    # This field corresponds to the \"Description-Content-Type\" metadata field:\n    # https://packaging.python.org/specifications/core-metadata/#description-content-type-optional\n    long_description_content_type=DVSNIER_LONG_DESCRIPTION_CONTENT_TYPE,  # Optional (see note above)\n\n    # This should be a valid link to your project's main homepage.\n    #\n    # This field corresponds to the \"Home-Page\" metadata field:\n    # https://packaging.python.org/specifications/core-metadata/#home-page-optional\n    url=DVSNIER_URL,  # Optional\n\n    # This should be your name or the name of the organization which owns the project.\n    author=DVSNIER_AUTHOR,  # Optional\n\n    # This should be a valid email address corresponding to the author listed above.\n    author_email=DVSNIER_AUTHOR_EMAIL,  # Optional\n\n    # The license argument doesn’t have to indicate the license under which your package is being released,\n    # although you may optionally do so if you want. If you’re using a standard, well-known license, then\n    # your main indication can and should be via the classifiers argument. Classifiers exist for all major\n    #  open-source licenses.\n    license=DVSNIER_LICENSE,  # Optional\n\n    # Classifiers help users find your project by categorizing it.\n    #\n    # For a list of valid classifiers, see https://pypi.org/classifiers/\n    classifiers=DVSNIER_CLASSIFIERS,  # Optional\n\n    # This field adds keywords for your project which will appear on the\n    # project page. What does your project relate to?\n    #\n    # Note that this is a list of additional keywords, separated\n    # by commas, to be used to assist searching for the distribution in a\n    # larger catalog.\n    keywords=DVSNIER_KEYWORDS,  # Optional\n\n    # When your source code is in a subdirectory under the project root, e.g.\n    # `src/`, it is necessary to specify the `package_dir` argument.\n    package_dir=DVSNIER_PACKAGE_DIR,  # Optional\n\n    # You can just specify package directories manually here if your project is\n    # simple. Or you can use find_packages().\n    #\n    # Alternatively, if you just want to distribute a single Python file, use\n    # the `py_modules` argument instead as follows, which will expect a file\n    # called `my_module.py` to exist:\n    #\n    #   py_modules=[\"my_module\"],\n    #\n    packages=DVSNIER_PACKAGES,  # Required\n\n    #\n    # Only for Python 3.x and above\n    #\n    # namespace_packages=DVSNIER_NAMESPACE_PACKAGES, # Optional\n\n    # If your project contains any single-file Python modules that aren’t part of\n    # a package, set py_modules to a list of the names of the modules (minus the .py\n    # extension) in order to make setuptools aware of them.\n    # py_modules=DVSNIER_PY_MODULES,  # Required\n\n    # Specify which Python versions you support. In contrast to the\n    # 'Programming Language' classifiers above, 'pip install' will check this\n    # and refuse to install the project if the version does not match. See\n    # https://packaging.python.org/guides/distributing-packages-using-setuptools/#python-requires\n    python_requires=DVSNIER_PYTHON_REQUIRES,\n\n    # This field lists other packages that your project depends on to run.\n    # Any package you put here will be installed by pip when your project is\n    # installed, so they must be valid existing projects.\n    #\n    # For an analysis of \"install_requires\" vs pip's requirements files see:\n    # https://packaging.python.org/en/latest/requirements.html\n    # https://packaging.python.org/discussions/install-requires-vs-requirements/\n    install_requires=DVSNIER_INSTALL_REQUIRES,  # Optional\n\n    # List additional groups of dependencies here (e.g. development\n    # dependencies). Users will be able to install these using the \"extras\"\n    # syntax, for example:\n    #\n    #   $ pip install sampleproject[dev]\n    #\n    # Similar to `install_requires` above, these must be valid existing projects.\n    extras_require=DVSNIER_EXTRAS_REQUIRE,  # Optional\n\n    # If there are data files included in your packages that need to be\n    # installed, specify them here.\n    # https://setuptools.readthedocs.io/en/latest/userguide/datafiles.html\n    package_data=DVSNIER_PACKAGE_DATA,  # Optional\n\n    # Although 'package_data' is the preferred approach, in some case you may\n    # need to place data files outside of your packages. See:\n    # http://docs.python.org/distutils/setupscript.html#installing-additional-files\n    # http://docs.python.org/3/distutils/setupscript.html#installing-additional-files\n    #\n    # In this case, 'data_file' will be installed into '\u003csys.prefix\u003e/my_data'\n    data_files=DVSNIER_DATA_FILES,  # Optional\n\n    # To provide executable scripts, use entry points in preference to the\n    # \"scripts\" keyword. Entry points provide cross-platform support and allow\n    # `pip` to create the appropriate form of executable for the target\n    # platform.\n    #\n    # For example, the following would provide a command called `dvsnier` which\n    # executes the function `main` from this package when invoked:\n    entry_points=DVSNIER_ENTRY_POINTS,  # Optional\n\n    #\n    # 1. https://www.python.org/dev/peps/pep-0328/\n    # 2. https://setuptools.readthedocs.io/en/latest/userguide/package_discovery.html\n    # 3. https://packaging.python.org/guides/packaging-namespace-packages/\n    # 4. https://github.com/pypa/sample-namespace-packages/tree/master/pkgutil\n    #\n    zip_safe=False,\n\n    # List additional URLs that are relevant to your project as a dict.\n    #\n    # This field corresponds to the \"Project-URL\" metadata fields:\n    # https://packaging.python.org/specifications/core-metadata/#project-url-multiple-use\n    #\n    # Examples listed include a pattern for specifying where the package tracks\n    # issues, where the source is hosted, where to say thanks to the package\n    # maintainers, and where to support the project financially. The key is\n    # what's used to render the link text on PyPI.\n    project_urls=DVSNIER_PROJECT_URLS,  # Optional\n)\n```\n\n\u003e 软件包`名称`和软件包`版本`信息, 一定要明确具体发布规则;\n\n实际项目中, 可依据如上配置信息稍加修改和增添;\n\n#### 5.2.6 README.md\n\n更新`README.md` 版本和摘要信息;\n\n### 5.3 构建\n\n#### 5.3.1 tox 脚本测试\n\n首次运行`tox` 命令，可使用`tox-quickstart` 命令, 依据简短提示信息进行配置:\n\n```bash\ntox-quickstart\n```\n\n后续运行`tox` 命令，可执行自动化脚本测试:\n\n```bash\ntox\n\ntox --verbose\ntox --verbose --parallel all\ntox --verbose --parallel auto\ntox --verbose --parallel 4  // 4 cpu core\ntox --verbose --parallel 8  // 8 cpu core\n\npython2 -m tox --result-json ./Temp/help/python2_tox_result_json.txt\npython3 -m tox --result-json ./Temp/help/python3_tox_result_json.txt\n\n```\n\n#### 5.3.2 build\n\n可使用如下命令, 进行`xxx.tar.gz` 源码包和`xxx.whl` 二进制包构建, 命令如下:\n\n```bash\n# python build tar.gz and whl\npython2 -m build\n\n# python build tar.gz\npython2 -m build --sdist\n# python build whl\npython2 -m build --wheel\n\n\n# python build tar.gz and whl\npython3 -m build\n\n# python build tar.gz\npython3 -m build --sdist\n# python build whl\npython3 -m build --wheel\n```\n\n### 5.3 发布\n\n#### 5.3.1 注册账号\n\n1. 账户注册地址: https://pypi.org/account/register/\n2. 创建一个[PyPI API令牌](https://pypi.org/help/#apitoken), 以便能够安全地上传您的项目;\n3. 为了避免每次上载时都必须复制和粘贴令牌，可以创建一个`$HOME/.pypirc` 文件, 参考如下:\n\n```bash\n[pypi]\nusername = __token__\npassword = \u003cthe token value, including the `pypi-` prefix\u003e\n```\n\n#### 5.3.2 检查软件包\n\n检查软件包, 命令:\n\n```bash\ntwine check dist/*\n```\n\n#### 5.3.3 上传软件包\n\n上传软件包, 命令:\n\n```bash\ntwine upload dist/*\n```\n\n## 六. WiKi\n\n### 6.1 规约与守则\n\n1. [【Contract: 规约守则】](./doc/project_help/the_global_rules.md)\n\n### 6.2 文档与源码\n\n1. [【Document: Python 环境查看函数】](./doc/README.md)\n2. [【Source: Recommended Source Websites】](./doc/SOURCE.md)\n\n### 6.3 配置与模板\n\n1. [【Config: The `LICENSE` File】](./LICENSE.txt)\n2. [【Config: The `MANIFEST` File】](./MANIFEST.in)\n3. [【Config: The `pyproject` File】](./pyproject.toml)\n4. [【Config: The `requirements` File】](./requirements.txt)\n5. [【Config: The `setup` File】](./setup.cfg)\n6. [【Config: The `tox` File】](./tox.ini)\n7. [【Template: The `__init__` File】](./template/__init__.py)\n8. [【Template: The `__init__with_pkgutil` File】](./template/__init__with_pkgutil.py)\n9. [【Template: The `template` File】](./template/template.py)\n10. [【Template: The `template_class` File】](./template/template_class.py)\n11. [【Template: The `test_template` File】](./template/test_template.py)\n\n### 6.4 调试与构建\n\n1. [【Debug: Bash_or_Ps1】](./Temp/bash/bash_or_ps1.md)\n2. [【Debug: Python Command】](./Temp/bash/python_command.md)\n3. [【Debug: Environment Variable Information(The Necessities)】](./Temp/debug/env/interpreterInfo.py)\n4. [【Debug: Environment Variable Information(An Generals)】](./Temp/debug/env/interpreterInfo.py)\n5. [【Build: The `Requirements` Text】](./Temp/archives/material/requirements.txt)\n6. [【Build: The `Setup` Script】](./Temp/archives/material/setup.py)\n\n### 6.5 日志与清理\n\n1. [【Clean: darwin】](./.rmcache.bash)\n2. [【Clean: win】](./.rmcache.ps1)\n\n## 七. 参考\n\n1. https://packaging.python.org/tutorials/packaging-projects/\n2. https://packaging.python.org/guides/distributing-packages-using-setuptools/\n3. https://pypi.org/pypi?%3Aaction=list_classifiers\n4. https://docs.python.org/2/distutils/setupscript.html#additional-meta-data\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falinvor%2Fpython-demo","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Falinvor%2Fpython-demo","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falinvor%2Fpython-demo/lists"}