Skip to content

Commit

Permalink
Merge pull request #105 from HowieHz/dev
Browse files Browse the repository at this point in the history
1.7.0
  • Loading branch information
HowieHz authored Jul 1, 2022
2 parents 994dc97 + fe58f2f commit 6947087
Show file tree
Hide file tree
Showing 124 changed files with 1,557 additions and 1,104 deletions.
9 changes: 3 additions & 6 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,18 @@ __pycache__/
.vscode/
.cspell/
Output/
Setting/
PythonJava混合编程支持/
可选文件/
必须文件/
Settings/
点我启动.exe
NoWinRun.exe
Log/
out/
report/
*.ps1
*.bat
*.py[cod]
*$py.class
*.fbp
.history/
packing_must/
packing_extra/


# C extensions
Expand Down
7 changes: 7 additions & 0 deletions .idea/hpyculator.iml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

30 changes: 6 additions & 24 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@
hpyculator(下文简称hpyc),是我怀揣着 “一个一个添加算法太累了,要是能像加载Minecraft的mod一样加载算法就好了” 这样的想法

[各类数组程序V1.2](https://www.bilibili.com/video/BV18p4y1h7bQ)的基础上开发而来

欢迎提pr和issue

>本项目基于python3.10构建
Expand All @@ -26,29 +24,13 @@ hpyculator(下文简称hpyc),是我怀揣着 “一个一个添加算法

2.写了一个小工具,这时候只需要添加一个包含一些数据的字典和一个函数,就可以把它变成一个hpyculator插件来使用

## 快速开始

### 用户

1.从github的[releases](https://github.com/HowieHz/hpyculator/releases)下载最新版本

2.解压,双击目录下的__main__.exe

3.去[插件市场](https://github.com/HowieHz/hpyculatorPluginCatalogue)下点插件就能愉快的使用了

(程序内置插件,可直接使用)

### 开发者(开发插件)

从github的releases下载最新版本

然后到[插件开发](https://hpyculator.readthedocs.io/zh_CN/latest/plugin_dev/index.html)页面查看详情

### 开发者(程序)
## 开始

从github项目src文件夹获取源码
- **用户手册**: [UserManual](docs/UserManual.md)
- 开发文档: [开发插件](https://hpyculator.readthedocs.io/zh_CN/latest/quick_start.html#id3)[参与到此项目](https://hpyculator.readthedocs.io/zh_CN/latest/quick_start.html#id9)
- 更新日志: [release](https://github.com/HowieHz/hpyculator/releases)[changelog](https://hpyculator.readthedocs.io/zh_CN/latest/changelog.html)

前往 [文档](https://hpyculator.readthedocs.io/zh_CN/latest/quick_start.html#id9) 查看简单部署流程
[//]: # (- 开发计划: [milestones](https://github.com/HowieHz/hpyculator/milestones))

## 插件

Expand All @@ -64,7 +46,7 @@ hpyculator(下文简称hpyc),是我怀揣着 “一个一个添加算法

## 其他

欢迎提issue和pr
遇到问题或者有对项目发展的建议欢迎提issue

## 鸣谢

Expand Down
2 changes: 1 addition & 1 deletion docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

## 装依赖

毋庸置疑python3是必须的
毋庸置疑python3.10是必须的

确保你cmd的工作目录为docs

Expand Down
21 changes: 16 additions & 5 deletions docs/source/changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,26 @@
Fixed - 解决的问题
Others - 性能优化和安全性增强等改进

v1.6.4(草稿)
v1.7.1

计划
创建cli应用程序hpyc_cli
完成hpyc_core模块的test

v1.7.0

Added
打表模式,每次输出后添加一个","
common_factor_hz,pluperfect_digital_invariant_hz插件
分离核心为hpyc_core
分离基于pyside6的ui为hpyc_pyside_ui
完成文档关于API的说明
hpyc_pyside_ui新增打表模式,每次输出后添加一个","
新增common_factor_hz,pluperfect_digital_invariant_hz插件
Changed
内置文档对于打表模式做出了解释
文档更新,对于元数据进行了更详细的说明
多处文档更新
插件更新
Removed
移除了output_without_line_break
移除了hpyc.RETURN_ITERABLE_OUTPUT_IN_ONE_LINE
Others
代码性能优化(尽可能多的使用元组)
结构优化,并补充注释,类型表示
Expand Down
2 changes: 1 addition & 1 deletion docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
author = "HowieHz"

# The full version, including alpha/beta/rc tags
release = "v1.6.1"
release = "v1.7.0"

# -- General configuration ---------------------------------------------------

Expand Down
47 changes: 47 additions & 0 deletions docs/source/core_api/core_instance.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
创建核心实例
=============================================
首先确保你安装了 ``hpyc_core`` 模块

.. code-block:: bash
pip install hpyc_core
接下来创建核心实例

.. code-block:: python
from hpyc_core import Core
instance_core = Core(output_dir_path: Optional[str] = None, # 输出目录
settings_dir_path: Optional[str] = None, # 设置文件所在目录
plugins_dir_path: Optional[str] = None, # 插件存放目录
settings_file_name: str = "hpyculator_setting", # 设置文件名
settings_file_format: str = "json",) # 设置文件格式
.. list-table:: 选取顺序: 输入 > 设置文件 > 默认值!
:widths: 20 20 45 20
:header-rows: 1

* - 参数
- 设置文件中对应键
- 默认值
- 数据要求
* - output_dir_path
- "output_dir_path"
- str(os.path.join(os.getcwd(), "Output"))
- 字符串类型
* - settings_dir_path
- 无
- str(os.path.join(os.getcwd(), "Settings"))
- 字符串类型
* - plugins_dir_path
- "plugins_dir_path"
- str(os.path.join(os.getcwd(), "Plugin"))
- 字符串类型
* - settings_file_name
- 无
- "hpyculator_setting"
- 字符串类型
* - settings_file_format
- 无
- "json"
- "json" | "yaml" | "toml"
30 changes: 30 additions & 0 deletions docs/source/core_api/data_structure.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
数据结构
==================
可通过 ``from hpyc_core.data_structure import 结构名`` 来获取对应结构


MetadataDict
---------------
插件元数据规定

通过 ``getPluginMetadata`` 获取到的数据类型

.. code-block:: python
class MetadataDict(TypedDict, total=False):
"""插件元数据数据类型"""
input_mode: int
id: str
option: str
version: str
tag: list | str
save_name: str
quantifier: str
output_start: str
output_name: str
author: str | list
help: str
output_end: str
return_mode: int
fullwidth_symbol: int
69 changes: 69 additions & 0 deletions docs/source/core_api/event.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
事件
=============================================
以下均为 ``hpyc_core.Core`` 的方法

eventStartCalculate
-----------------------
开始计算 (启动计算线程)

.. code-block:: python
eventStartCalculate(self, plugin_id: str, input_data: Any, mode="Return") -> None:
参数说明
- plugin_id: 插件id, 类型 ``str``
- input_data: 未处理的原始输入数据, 类型 ``typing.Any``
- mode: 计算模式, 类型 ``str``

可能引发的异常
- ValueError: 当输入了不存在的mode

mode参数别名
- 运算结果仅返回到消息队列
"ReturnAfterComputing",
"ComputingAndReturn",
"RAC",
"Return",
"ReturnAfterCalculating",

- 运算结果仅保存到文件中
"SaveAfterComputing",
"ComputingAndSave",
"SAC",
"Save",
"SaveAfterCalculating",

- 运算结果从缓冲区中返回到消息队列
"ReturnAfterComputingFromBuffer",
"ComputingAndReturnFromBuffer",
"RACFB",
"ReturnFromBuffer",
"ReturnAfterCalculatingFromBuffer",

- 运算结果从缓冲区中返回到消息队列,但是有返回上限
"ReturnAfterComputingFromLimitedBuffer",
"ComputingAndReturnFromLimitedBuffer",
"RACFLB",
"ReturnFromLimitedBuffer",
"ReturnAfterCalculatingFromLimitedBuffer",

eventReloadPlugins
-----------------------
重新加载插件

.. code-block:: python
def eventReloadPlugins(self) -> None:
eventExit
-----------------------
退出流程,进行一些收尾工作防止进程残留

默认使用atexit模块注册到退出事件

所以一般来说不需要手动触发

.. code-block:: python
def eventExit() -> None:
86 changes: 86 additions & 0 deletions docs/source/core_api/get.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
获取
=============================================
以下均为 ``hpyc_core.Core`` 的方法

getMessageQueue
-----------------------
获取消息输出队列

.. code-block:: python
def getMessageQueue() -> Queue:
getSettingsFileInstance
-----------------------
获取设置文件实例

.. code-block:: python
def getSettingsFileInstance() -> SettingsFileObject:
getPluginsDirPath
-----------------------
获取插件存放路径

.. code-block:: python
def getMessageQueue() -> str:
getOutputDirPath
-----------------------
获取输出路径

.. code-block:: python
def getOutputDirPath(self) -> str:
getSettingsDirPath
-----------------------
获取设置文件存放路径

.. code-block:: python
def getSettingsDirPath(self) -> str:
getPluginsTagOption
-----------------------
获取所有插件的tag,tag对应插件选项名

(((plugin1_tag1, plugin1_tag2, ...), plugin1_option), ((plugin2_tag1,), plugin2_option)), ...)

.. code-block:: python
def getPluginsTagOption() -> tuple[tuple[tuple[str, ...], str], ...]:
getPluginsOptionToId
-----------------------
获取插件选项名和id的映射表

.. code-block:: python
def getPluginsOptionToId() -> dict[str, str]:
getPluginIdFromOption
-----------------------
通过选项名获得对应插件ID

.. code-block:: python
getPluginIdFromOption(option: str) -> str:
getPluginInstance
-----------------------
获取对应插件实例

.. code-block:: python
def getPluginInstance(plugin_id: str) -> ModuleType:
getPluginMetadata
-----------------------
拖过插件ID获取对应插件元数据

.. code-block:: python
def getPluginMetadata(plugin_id: str) -> MetadataDict:
Loading

0 comments on commit 6947087

Please sign in to comment.