Skip to content

Commit be5b8bc

Browse files
committed
Init english docs
1 parent 5827391 commit be5b8bc

18 files changed

+1739
-5
lines changed

pyarmor/docs/Makefile

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# Minimal makefile for Sphinx documentation
2+
#
3+
4+
# You can set these variables from the command line, and also
5+
# from the environment for the first two.
6+
SPHINXOPTS ?=
7+
SPHINXBUILD ?= sphinx-build
8+
SOURCEDIR = .
9+
BUILDDIR = _build
10+
11+
# Put it first so that "make" without argument is like "make help".
12+
help:
13+
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
14+
15+
.PHONY: help Makefile
16+
17+
# Catch-all target: route all unknown targets to Sphinx using the new
18+
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
19+
%: Makefile
20+
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)

pyarmor/docs/conf.py

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
# Configuration file for the Sphinx documentation builder.
2+
#
3+
# This file only contains a selection of the most common options. For a full
4+
# list see the documentation:
5+
# https://www.sphinx-doc.org/en/master/usage/configuration.html
6+
7+
# -- Path setup --------------------------------------------------------------
8+
9+
# If extensions (or modules to document with autodoc) are in another directory,
10+
# add these directories to sys.path here. If the directory is relative to the
11+
# documentation root, use os.path.abspath to make it absolute, like shown here.
12+
#
13+
# import os
14+
# import sys
15+
# sys.path.insert(0, os.path.abspath('.'))
16+
17+
18+
# -- Project information -----------------------------------------------------
19+
20+
project = 'Pyarmor'
21+
copyright = '2025, Dashingsoft Corp.'
22+
author = 'Jondy Zhao'
23+
24+
# The full version, including alpha/beta/rc tags
25+
release = '9.1.0'
26+
27+
28+
# -- General configuration ---------------------------------------------------
29+
30+
# Add any Sphinx extension module names here, as strings. They can be
31+
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
32+
# ones.
33+
extensions = [
34+
'sphinx.ext.napoleon',
35+
'sphinx.ext.graphviz',
36+
'linuxdoc.rstFlatTable',
37+
]
38+
39+
# Add any paths that contain templates here, relative to this directory.
40+
templates_path = ['_templates']
41+
42+
# The language for content autogenerated by Sphinx. Refer to documentation
43+
# for a list of supported languages.
44+
#
45+
# This is also used if you do content translation via gettext catalogs.
46+
# Usually you set "language" from the command line for these cases.
47+
language = 'en_US'
48+
49+
# List of patterns, relative to source directory, that match files and
50+
# directories to ignore when looking for source files.
51+
# This pattern also affects html_static_path and html_extra_path.
52+
exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store']
53+
54+
55+
# -- Options for HTML output -------------------------------------------------
56+
57+
# The theme to use for HTML and HTML Help pages. See the documentation for
58+
# a list of builtin themes.
59+
#
60+
# html_theme = 'nature'
61+
html_theme = 'sphinx_rtd_theme'
62+
63+
# Add any paths that contain custom static files (such as style sheets) here,
64+
# relative to this directory. They are copied after the builtin static files,
65+
# so a file named "default.css" will overwrite the builtin "default.css".
66+
html_static_path = ['_static']
67+
68+
# The output format for Graphviz when building HTML files. This must
69+
# be either 'png' or 'svg'; the default is 'png'. If 'svg' is used, in
70+
# order to make the URL links work properly, an appropriate target
71+
# attribute must be set, such as "_top" and "_blank".
72+
graphviz_output_format = 'svg'
File renamed without changes.

pyarmor/docs/index.rst

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
.. Pyarmor documentation master file, created by
2+
sphinx-quickstart on Thu Dec 5 18:30:56 2024.
3+
You can adapt this file completely to your liking, but it should at least
4+
contain the root `toctree` directive.
5+
6+
Pyarmor |version| Documentation
7+
===============================
8+
9+
.. toctree::
10+
:maxdepth: 2
11+
:caption: Content
12+
13+
user/features
14+
user/concepts
15+
user/tutorials
16+
user/man
17+
user/configuration
18+
user/examples
19+
20+
Indices and tables
21+
==================
22+
23+
* :ref:`genindex`
24+
* :ref:`modindex`
25+
* :ref:`search`

pyarmor/docs/proposals.rst

Lines changed: 203 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,203 @@
1+
===========
2+
Proposals
3+
===========
4+
5+
.. contents:: Contents
6+
:depth: 2
7+
:local:
8+
:backlinks: top
9+
10+
.. highlight:: console
11+
12+
Features
13+
========
14+
15+
.. _feature-1:
16+
17+
1. 能够生成多种加密脚本,根据需要应用于不同的场景
18+
19+
加密后的脚本还是正常的 Python 脚本,可以被 Python 解释器正常解释执行
20+
21+
- 有的加密脚本,使用多种不可逆的加密模式,适用于算法保护
22+
- 有的加密脚本,加密后性能和原来的脚本基本相当,适用于 Web 服务
23+
- 有的加密脚本,可以继续使用其他工具,例如 Nuitka 等进行进一步的保护
24+
25+
.. _feature-2:
26+
27+
2. 多种不可逆的加密模式
28+
29+
转换部分 Python 语句块为 C 代码,生成不可逆的加密代码
30+
31+
重命名模块内部的函数,类,方法,属性,参数,变量等的名称
32+
33+
.. _feature-3:
34+
35+
3. 设置加密脚本有效期
36+
37+
.. _feature-4:
38+
39+
4. 绑定加密脚本到固定设备
40+
41+
.. _feature-5:
42+
43+
5. 保护字符串常量
44+
45+
.. _feature-6:
46+
47+
6. 自我保护功能
48+
49+
发现加密脚本被替换会退出执行
50+
51+
发现脚本中加密函数被替换会退出执行
52+
53+
Concepts
54+
========
55+
56+
加密脚本
57+
--------
58+
59+
Pyarmor 能够生成 5 种不同类型的加密脚本
60+
61+
- std: 标准型
62+
- ecc: 嵌入型
63+
- vmc: 虚拟嵌入型
64+
- mini: 迷你型
65+
- rft: 重构型
66+
67+
下表列出每一种模式的主要特点和用途(设计目的)
68+
69+
.. flat-table:: 表-1. 加密脚本类型表
70+
:widths: 10 10 10 10 60
71+
:header-rows: 1
72+
:stub-columns: 1
73+
74+
* - 加密类型
75+
- 安全性 [#]_
76+
- 运行速度 [#]_
77+
- 扩展模块 [#]_
78+
- 备注
79+
* - 标准型
80+
- 正常
81+
- 正常
82+
- 需要
83+
- 能够设置加密脚本有效期和绑定加密脚本到固定设备,其他加密脚本类型都不具备此特性,适用于大多数的情况
84+
* - 嵌入型
85+
- 最高
86+
- 正常
87+
- 需要
88+
- 通过转换 Python 语句块为 C 代码,实现更高程度的不可逆加密,同时能对字符串常量的进行很好保护,适用对算法类型的应用加密。性能和安全性均高,但是需要额外的 C 编译器,加密过程比较复杂
89+
* - 虚拟嵌入型
90+
- 较高
91+
- 较慢
92+
- 需要
93+
- 是虚拟型加密的简化,转换部分 Python 语句块成为虚拟机器代码,而不是真正的 C 代码,这样就不需要 C 编译器,简化了加密配置
94+
* - 迷你型
95+
- 较低
96+
- 很高
97+
- 需要
98+
- 不可逆程度较低,但是执行速度较高,适用于 Web 服务等类型
99+
* - 重构型
100+
- 最低
101+
- 最高
102+
- 不需要
103+
- 和普通 Python 脚本完全一样,主要是对 Python 语句进行了重构,所以不需要额外的扩展模块,适用范围更广,包括用于 WASM,也可以继续使用任意工具,例如 Nuitka,Cython 等进一步处理
104+
105+
.. rubric:: Notes
106+
107+
.. [#] 安全性主要是指加密脚本的不可逆程度
108+
.. [#] 运行速度是指加密脚本的运行速度和没有加密之前的脚本运行速度的比较
109+
.. [#] 运行加密脚本是否需要额外的扩展模块,除了重构型脚本之外,其他类型的都需要
110+
111+
112+
下表从另外一个维度比较了各种加密脚本的特点
113+
114+
.. flat-table:: 表-2. 不同加密脚本的比较表
115+
:widths: 40 12 12 12 12 12
116+
:header-rows: 1
117+
:stub-columns: 1
118+
119+
* - Feature
120+
- 标准型
121+
- 嵌入型 [#pro]_
122+
- 虚拟嵌入型 [#pro]_
123+
- 迷你型
124+
- 重构型
125+
* - 是否需要额外的扩展模块
126+
- :cspan:`3` Y
127+
- N
128+
* - 是否能够重命名模块中类/函数/方法/属性等名称 [#pro]_
129+
- :cspan:`4` Y
130+
* - 是否能够转换 Python 语句为 C 代码
131+
- N
132+
- Y [#pro]_
133+
- Y [#pro]_ [#vmc]_
134+
- :cspan:`1` N
135+
* - 设置脚本有效期/绑定到固定设备/设置约束模式/自我保护功能
136+
- Y
137+
- :cspan:`3` N
138+
* - 脚本的不可逆程度 [#pro]_
139+
- ✫✫✫
140+
- ✫✫✫✫✫
141+
- ✫✫✫✫
142+
- ✫✫
143+
- ✫
144+
* - 加密后运行的速度
145+
- ✫✫✫
146+
- ✫✫
147+
- ✫
148+
- ✫✫✫✫
149+
- ✫✫✫✫✫
150+
* - Python 解释器的支持
151+
- :cspan:`3` 支持 CPython,或者提供 CPython API 的解释器
152+
- 任意的 Python 脚本解释器,包括 IPython, WASM 等
153+
154+
.. rubric:: Notes
155+
156+
.. [#pro] 这些功能需要能够解锁不可逆加密模式的许可证
157+
.. [#vmc] 不是真正的转换成为 C 代码,而是虚拟指令
158+
159+
.. seealso:: Pyarmor 的许可证类型
160+
161+
选项
162+
----
163+
164+
- 是否重构脚本,适用于所有加密脚本类型
165+
166+
重构的子选项
167+
168+
- builtin 是否重名
169+
- argument 参数重命名模式
170+
171+
- 重构规则表
172+
173+
仅用于处理无法自动重构的代码
174+
175+
- 是否混淆字符串
176+
177+
- 是否保护加密模块
178+
179+
如果该加密模式被替换,那么抛出保护异常
180+
181+
- 是否保护加密函数
182+
183+
如果在调用之前发现加密函数被替换,那么抛出保护异常
184+
185+
工程
186+
----
187+
188+
工程是用来组织需要加密的脚本和如何加密脚本的选项集合
189+
190+
许可证
191+
------
192+
193+
Pyarmor 提供 5 种不同的许可证模块
194+
195+
- Trial: 不能加密大脚本
196+
- Basic: 解锁对大脚本的加密功能
197+
- Pro: 除了解锁基础版功能外,还解锁不可逆的加密模式,包括 RFT, BCC, ECC, VMC 等
198+
- Group: 除了解锁专家版功能外,还支持在离线设备对脚本进行加密,其他类型的许可证都需要在线验证许可证
199+
- CI: 支持在 CI/CD 管线中使用专家版的功能
200+
201+
.. note::
202+
203+
试用版和基础版不支持生成嵌入型,虚拟嵌入型和重构型脚本,但是可以生成标准型,迷你型脚本,不过这些脚本都没有进行重构
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
===========
2+
Platforms
3+
===========
4+
5+
支持的 Python 版本,操作系统,CPU 架构
6+
7+
支持的 Python 解释器,CPython, IPython, WASM 等等

pyarmor/docs/reference/ranges.rst

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
========
2+
Ranges
3+
========
4+
5+
支持的有效值的范围
6+
7+
譬如
8+
9+
VMC 模式中 for 语句最大的嵌套层数目前支持的是 8 层
10+
VMC 模式中最大的变量数目是 2 的 32 次幂

0 commit comments

Comments
 (0)