Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 2e4695e

Browse files
Merge pull request #73 from Alinvor/kernel
[DONE]合并分支
2 parents 708d686 + 15e9a12 commit 2e4695e

File tree

7 files changed

+187
-20
lines changed

7 files changed

+187
-20
lines changed

‎.rmcache.ps1‎

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,17 @@
44
# 1. https://docs.microsoft.com/zh-cn/powershell/scripting/samples/working-with-files-and-folders?view=powershell-7.1
55
# 2. https://docs.microsoft.com/zh-cn/powershell/scripting/samples/working-with-registry-keys?view=powershell-7.1
66
#
7-
# the delete files
7+
## THE DELETE FILES
88
Get-ChildItem -Path . -include *.pyc -Recurse | Remove-Item
9-
# the delete directory
10-
Get-ChildItem-Path .-include __pycache__ -Recurse |Remove-Item
9+
## THE DELETE DIRECTORY
10+
# ./build/*
1111
Remove-Item -Path .\build\* -Recurse
12+
# ./src/com.dvsnier.*.egg-info
13+
Remove-Item -Path .\src\com.dvsnier.*.egg-info -Recurse
14+
# Get-ChildItem -Path .\src\com.dvsnier.*.egg-info -Recurse
15+
# ./dist/*
16+
Remove-Item -Path .\dist\* -Recurse
17+
# ./out/log/*
1218
Remove-Item -Path .\out\log\* -Recurse
19+
# __pycache__
20+
Get-ChildItem -Path . -include __pycache__ -Recurse | Remove-Item

‎README.md‎

Lines changed: 47 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,13 @@
4545
- [5.3.1 注册账号](#531-注册账号)
4646
- [5.3.2 检查软件包](#532-检查软件包)
4747
- [5.3.3 上传软件包](#533-上传软件包)
48-
- [六. 参考](#六-参考)
48+
- [六. WiKi](#六-wiki)
49+
- [6.1 规约与守则](#61-规约与守则)
50+
- [6.2 文档与源码](#62-文档与源码)
51+
- [6.3 配置与模板](#63-配置与模板)
52+
- [6.4 调试与构建](#64-调试与构建)
53+
- [6.5 日志与清理](#65-日志与清理)
54+
- [七. 参考](#七-参考)
4955

5056
## 一. 构建`venv`环境
5157

@@ -948,7 +954,46 @@ twine check dist/*
948954
twine upload dist/*
949955
```
950956
951-
## 六. 参考
957+
## 六. WiKi
958+
959+
### 6.1 规约与守则
960+
961+
1. [【Contract: 规约守则】](./doc/project_help/the_global_rules.md)
962+
963+
### 6.2 文档与源码
964+
965+
1. [【Document: Python 环境查看函数】](./doc/README.md)
966+
2. [【Source: Recommended Source Websites】](./doc/SOURCE.md)
967+
968+
### 6.3 配置与模板
969+
970+
1. [【Config: The `LICENSE` File】](./LICENSE.txt)
971+
2. [【Config: The `MANIFEST` File】](./MANIFEST.in)
972+
3. [【Config: The `pyproject` File】](./pyproject.toml)
973+
4. [【Config: The `requirements` File】](./requirements.txt)
974+
5. [【Config: The `setup` File】](./setup.cfg)
975+
6. [【Config: The `tox` File】](./tox.ini)
976+
7. [【Template: The `__init__` File】](./template/__init__.py)
977+
8. [【Template: The `__init__with_pkgutil` File】](./template/__init__with_pkgutil.py)
978+
9. [【Template: The `template` File】](./template/template.py)
979+
10. [【Template: The `template_class` File】](./template/template_class.py)
980+
11. [【Template: The `test_template` File】](./template/test_template.py)
981+
982+
### 6.4 调试与构建
983+
984+
1. [【Debug: Bash_or_Ps1】](./Temp/bash/bash_or_ps1.md)
985+
2. [【Debug: Python Command】](./Temp/bash/python_command.md)
986+
3. [【Debug: Environment Variable Information(The Necessities)】](./Temp/debug/env/interpreterInfo.py)
987+
4. [【Debug: Environment Variable Information(An Generals)】](./Temp/debug/env/interpreterInfo.py)
988+
5. [【Build: The `Requirements` Text】](./Temp/archives/material/requirements.txt)
989+
6. [【Build: The `Setup` Script】](./Temp/archives/material/setup.py)
990+
991+
### 6.5 日志与清理
992+
993+
1. [【Clean: darwin】](./.rmcache.bash)
994+
2. [【Clean: win】](./.rmcache.ps1)
995+
996+
## 七. 参考
952997
953998
1. https://packaging.python.org/tutorials/packaging-projects/
954999
2. https://packaging.python.org/guides/distributing-packages-using-setuptools/

‎Temp/bash/python_command.md‎

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@
33
- [一. pip](#一-pip)
44
- [1.1. pip --editable](#11-pip---editable)
55
- [1.2. pip list or freeze](#12-pip-list-or-freeze)
6+
- [1.3. pip install](#13-pip-install)
7+
- [1.3.1. pip install -r requirements.txt](#131-pip-install--r-requirementstxt)
8+
- [1.3.2. pip install xxx](#132-pip-install-xxx)
69
- [二. flake8](#二-flake8)
710

811
## 一. pip
@@ -29,6 +32,27 @@ pip2 freeze > ./Temp/txt/2021_pip2_freeze.txt
2932
pip3 freeze > ./Temp/txt/2021_pip3_freeze.txt
3033
```
3134

35+
### 1.3. pip install
36+
37+
#### 1.3.1. pip install -r requirements.txt
38+
39+
```bash
40+
# the base component requirements
41+
pip2 install -r ./requirements.txt
42+
pip3 install -r ./requirements.txt
43+
44+
# the base chain component requirements
45+
pip2 install -r ./Temp/archives/material/requirements.txt
46+
pip3 install -r ./Temp/archives/material/requirements.txt
47+
```
48+
49+
#### 1.3.2. pip install xxx
50+
51+
```bash
52+
pip2 install xxx
53+
pip3 install xxx
54+
```
55+
3256
## 二. flake8
3357

3458
```bash

‎doc/SOURCE.md‎

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# 阅读
2+
3+
尝试去一些网站读源码:
4+
5+
- https://github.com/
6+
- https://launchpad.net/
7+
- https://koders.com/
8+
- https://bitbucket.org/
9+
- https://www.python.org/dev/peps/
10+
- https://pypi.org/
11+
- https://docs.python.org/zh-cn/2.7/index.html
12+
- https://docs.python.org/zh-cn/3.8/
13+
- https://stackoverflow.com/
14+
- https://github.com/Alinvor/Python-DeMo
15+
- https://gitee.com/dovsnier/Python-Test
16+
- https://blog.csdn.net/dovsnier/category_9322292.html?spm=1001.2014.3001.5482
17+
- https://blog.csdn.net/dovsnier/category_3041641.html?spm=1001.2014.3001.5482

‎doc/project_help/the_global_rules.md‎

Lines changed: 88 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,11 @@
22

33
- [一. 说明](#一-说明)
44
- [二. 源码](#二-源码)
5-
- [三. 测试](#三-测试)
5+
- [三. 调试](#三-调试)
6+
- [3.1. System 环境变量](#31-system-环境变量)
7+
- [3.2. VSCode PYTHONPATH](#32-vscode-pythonpath)
8+
- [3.3. inline import](#33-inline-import)
9+
- [四. 测试](#四-测试)
610

711
## 一. 说明
812

@@ -13,6 +17,88 @@
1317
1. 统一采用`com.dvsnier` 命名空间;
1418
2. 包结构,统一定义: `com.dvsnier.xxx`, 且`xxx` 包名称一定要和目录层次一一对应, 可以避免潜在无关紧要问题;
1519

16-
## 三. 测试
20+
## 三. 调试
21+
22+
### 3.1. System 环境变量
23+
24+
目前我们规定如下可选全局变量:
25+
26+
- `PYTHONPATH`: 【可选项】, Python 环境变量;
27+
- `BASE_PROJECT_PREFIX`: 【必选项】, 当前工作区目录前缀;
28+
29+
> 1. `工作区`: 当前程序被系统`调用并执行`的区间点;
30+
> 2. `运行区`: 当前程序被系统`执行`的区间点;
31+
>
32+
> > - `工作目录`: 当前进程的`静态执行` 符号载体;
33+
> > - `运行目录`: 当前进程的`动态执行` 驻留载体;
34+
35+
```bash
36+
# darwin Python
37+
# export PYTHONPATH=.
38+
export BASE_PROJECT_PREFIX="/Users/.../Python-DeMo"
39+
40+
# win Python
41+
# PYTHONPATH=.
42+
BASE_PROJECT_PREFIX="D:\\...\\Python-DeMo"
43+
```
44+
45+
### 3.2. VSCode PYTHONPATH
46+
47+
VSCode 环境变量指定的默认配置选项为:
48+
49+
```json
50+
{
51+
"python.envFile": "${workspaceFolder}/.env"
52+
}
53+
```
54+
55+
**注意**:
56+
57+
1.`${workspaceFolder}/.env` 文件中所指定 `PYTHONPATH` 请使用`绝对路径`, 因为使用相对路径目前的版本不受支持;
58+
2. 目前无需在 VSCode 中使用`.` 操作符指定当前目录, 从而被重复加入到VSCode `PYTHONPATH` 中, VSCode 默认具有当前功能(隐含默认将当前执行目录加入`PYTHONPATH` 环境变量);
59+
3. 加载环境变量顺序需要注意, VSCode 默认加载位置为: `["VSCode DEFAULT RULES(stdlib)", "VSCode DEFAULT INLINE RULUES WITH PYTHON PATH . AND SRC", "VSCode PYTHONPATH WITH ENV", "SYSTEM DEFAULT PYTHON PATH LIST", "virtual environment list"]`
60+
4. `.` 操作符在VSCode `PYTHONPATH` 中单独使用是起作用的, 联合使用不起作用, 是 VSCode 的一个 Bug, 同时不支持 `${workspaceFolder}` 变量替换;
61+
62+
具体 `PYTHONPATH` 添加规则如下:
63+
64+
```bash
65+
"VSCode STD LIBRARY""VSCode DEFAULT RULES(stdlib)"
66+
↓ ↓
67+
"VSCode CURRENT RULES""VSCode DEFAULT INLINE RULES WITH PYTHON PATH . AND SRC"
68+
↓ ↓
69+
"VSCode ENV""VSCode PYTHONPATH WITH ENV"
70+
↓ ↓
71+
"SYSTEM""SYSTEM DEFAULT PYTHON PATH LIST"
72+
↓ ↓
73+
"VIRTUAL ENVIRONMENT""virtual environment list"
74+
```
75+
76+
举例如下:
77+
78+
```bash
79+
# darwin
80+
PYTHONPATH=/Users/.../Python-DeMo:/Users/.../Python-DeMo/tests:${PYTHONPATH}
81+
82+
# win32
83+
PYTHONPATH=D:\\WorkSpace\\...\\Python-DeMo;D:\\WorkSpace\\...\\Python-DeMo\\tests;%PYTHONPATH%
84+
```
85+
86+
### 3.3. inline import
87+
88+
**内联导入**:
89+
90+
在 VSCode 中, 如果需要在 `tests` 写测试用例, 调用 `src` 中代码, 由于 Python 或 VSCode 机制的原因, 实际上不指明 `PYTHONPATH` 的情况下, 是无法进行调用的; 因此我们采用如下方式:
91+
92+
1. `PYTHONPATH` 指定绝对路径方式【不推荐】;
93+
2.`src` 调试安装到当前虚拟环境下(需要 `setup.py` 文件参与)**【推荐】**;
94+
95+
举例如下:
96+
97+
```bash
98+
pip2 install -e .
99+
pip3 install -e .
100+
```
101+
102+
## 四. 测试
17103

18104
1. 统一采用和源码空间统一的目录结构和命名空间形式;

‎doc/source.md‎

Lines changed: 0 additions & 10 deletions
This file was deleted.

‎setup.cfg‎

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,3 @@
77
#
88
[bdist_wheel]
99
universal = 1
10-
11-
[flake8]
12-
max-line-length = 120

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /