Skip to content

Commit e68c3a7

Browse files
committed
docs(tools): add pyenv/*
1 parent a84102d commit e68c3a7

File tree

12 files changed

+1004
-1315
lines changed

12 files changed

+1004
-1315
lines changed

.github/workflows/deploy-docs.yml

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ name: Deploy Docs
33
on:
44
push:
55
branches:
6-
# make sure this is the branch you are using
76
- main
87

98
jobs:
@@ -14,8 +13,6 @@ jobs:
1413
uses: actions/checkout@v4
1514
with:
1615
fetch-depth: 0
17-
# if your docs needs submodules, uncomment the following line
18-
# submodules: true
1916

2017
- name: Install pnpm
2118
uses: pnpm/action-setup@v2
@@ -24,7 +21,7 @@ jobs:
2421
run_install: true
2522

2623
- name: Setup Node.js
27-
uses: actions/setup-node@v3
24+
uses: actions/setup-node@v4
2825
with:
2926
node-version: 20
3027
cache: pnpm
@@ -39,6 +36,5 @@ jobs:
3936
- name: Deploy Docs
4037
uses: JamesIves/github-pages-deploy-action@v4
4138
with:
42-
# This is the branch where the docs are deployed to
4339
branch: gh-pages
4440
folder: docs/.vuepress/dist

.markdownlint.yaml

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,8 @@
11
default: true
22

3-
# unordered-list-indent (default: 2)
4-
MD007:
5-
indent: 4
6-
73
# line-length (default: 80)
84
MD013: false
95

10-
# single-title (allow title in frontmatter)
11-
MD025:
12-
front_matter_title: ''
13-
146
# no-inline-html (allow only AutoCatalog)
157
MD033:
168
allowed_elements:

Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Builder
2-
FROM node:20.7.0-bookworm as builder
2+
FROM node:20.9.0-bookworm as builder
33

44
WORKDIR /app
55

@@ -16,7 +16,7 @@ RUN npm -v \
1616
&& pnpm build
1717

1818
# Nginx Server
19-
FROM nginx:1.25.2-alpine3.18-slim
19+
FROM nginx:1.25.3-alpine3.18-slim
2020

2121
WORKDIR /usr/share/nginx/html/vuepress-python-notes/
2222

docs/.vuepress/config.ts

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import { copyCodePlugin } from 'vuepress-plugin-copy-code2'
66
import { searchProPlugin } from 'vuepress-plugin-search-pro'
77
import { autoCatalogPlugin } from 'vuepress-plugin-auto-catalog'
88
import { shikiPlugin } from '@vuepress/plugin-shiki'
9+
import { slug as slugify } from 'github-slugger'
910

1011
const __dirname = getDirname(import.meta.url)
1112
const isProd = process.env.NODE_ENV === 'production'
@@ -29,7 +30,11 @@ export default defineUserConfig({
2930
importCode: {
3031
handleImportPath: str => str
3132
.replace(/^\//, ROOT_PATH.replace(/(?:|\\|\/)$/, '/'))
32-
.replace(/^@/, CURRENT_PATH),
33+
.replace(/^@\//, CURRENT_PATH.replace(/(?:|\\|\/)$/, '/')),
34+
},
35+
anchor: {
36+
level: [1, 2, 3, 4, 5, 6],
37+
slugify,
3338
},
3439
},
3540
theme: defaultTheme({
@@ -72,8 +77,8 @@ export default defineUserConfig({
7277
codetabs: true,
7378
include: {
7479
resolvePath: (file) => {
75-
if (file.startsWith('@'))
76-
return file.replace('@', CURRENT_PATH)
80+
if (file.startsWith('@/'))
81+
return file.replace(/^@\//, CURRENT_PATH)
7782
if (file.startsWith('/'))
7883
return file.replace(/^\//, ROOT_PATH.replace(/(?:|\\|\/)$/, '/'))
7984
return file

docs/.vuepress/styles/index.scss

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -11,17 +11,6 @@
1111
}
1212
}
1313

14-
h1,
15-
h2,
16-
h3,
17-
h4,
18-
h5,
19-
h6 {
20-
margin-top: 1.5rem;
21-
margin-bottom: 0.5rem;
22-
padding-top: 0;
23-
}
24-
2514
// optimize: code
2615
code {
2716
padding: 0.25rem 0.15rem;
@@ -58,5 +47,16 @@
5847
}
5948
}
6049

50+
// fix: copy katex code when selected
51+
.katex {
52+
* {
53+
user-select: none;
54+
}
55+
56+
annotation {
57+
user-select: all;
58+
}
59+
}
60+
6161
@import 'print.scss';
6262
@import 'private.scss';

docs/pypi-package/nuitka/index.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Nuitka 教程
2+
3+
<AutoCatalog />

docs/quicknote/cython-build-image.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,9 @@ EXPOSE 8081
2525
CMD [ "python", "server.py" ]
2626
```
2727

28-
每次我们都从项目中复制源代码,然后安装依赖。对于微服务来说,直接使用源代码发布到生产环境不安全,容易在部署中泄漏重要信息。
28+
每次我们都从项目中复制源代码,然后安装依赖。对于任何应用,直接使用源代码发布到生产环境不安全,容易在部署中泄漏重要信息。
2929

30-
而且原始的 Python 代码执行比较低效,需要从头开始解释执行,在第一次启动时需要编译为字节码,如果我们使用字节码发布同样不安全(字节码可以轻易逆向为源代码)。
30+
而且原始的 Python 代码执行比较低效,需要从头开始解释执行。Python 会在第一次执行项目时,将包内的代码编译为字节码(`.pyc` 文件),这样可以提高 Python 运行的效率。同样我们也可以直接发布字节码文件,但是我们使用字节码发布同样不安全(字节码可以轻易逆向为源代码)。
3131

3232
下面我们将介绍 Cython,它可以帮助我们解决这些问题。
3333

@@ -210,7 +210,7 @@ pip-delete-this-directory.txt
210210

211211
我们在构建网络服务时常常使用一些元编程技巧,这常常需要借助运行时反射来实现。如 SpringBoot 中的 `@ComponentScan` 能够自动扫描并加载所有的 `@Component` 注解的类,然后将它们注册到 IoC 容器中。
212212

213-
通常静态构建后会损失一些元信息,如果有特定模块这些元信息则会导致一些问题
213+
通常静态构建后会损失一些元信息,如果有特定模块或库依赖这些元信息运行则会导致一些问题
214214

215215
在 Python 中,我们常常使用自定义装饰器来完成相应的功能。例如,在 [Sanic](https://sanic.dev/) 中我们可以使用 [自动路由发现](https://sanic.dev/en/guide/how-to/autodiscovery.html) 来自动注册路由,从而无需编写引入代码。
216216

docs/quicknote/temp.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,22 @@
1515
- [ ] Celery:Python 异步任务调度
1616
- [ ] Rocketry:Python 下的轻量调度框架
1717

18+
## Python 环境管理
19+
20+
- [x] `pipx`:管理全局命令行工具
21+
- [ ] `pipenv`:虚拟环境
22+
- [ ] `conda`:Anaconda 工具
23+
- [ ] `virtualenv`:虚拟环境工具包
24+
- [ ] `virtualenvwrapper`
25+
- [ ] `pew`
26+
- [ ] `tox`
27+
- [ ] `nox`
28+
29+
## Cython
30+
31+
- [ ] <https://www.zhihu.com/column/c_1284193666899787776>
32+
- [ ] <https://www.zhihu.com/column/c_1277937360727257088>
33+
1834
## OpenCV 增加图像对比度
1935

2036
当使用Python和OpenCV增加图像的对比度时,可以使用`cv2.convertScaleAbs()`函数。该函数可以根据给定的对比度参数对图像进行线性变换。下面是一个详细的代码示例:

docs/tools/pyenv/index.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Python 环境管理工具
2+
3+
<AutoCatalog />

docs/tools/pyenv/pipx/index.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# pipx
2+
3+
<AutoCatalog />

0 commit comments

Comments
 (0)