aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
-rw-r--r--README.rst70
-rw-r--r--docs/source/conf.py2
-rw-r--r--examples/BRP/src/character.py3
-rw-r--r--hydro_roll_core/libcore.pyi5
-rw-r--r--pyproject.toml4
-rw-r--r--src/lib.rs11
-rw-r--r--src/main.rs13
-rw-r--r--tests/test_corelib.py11
8 files changed, 82 insertions, 37 deletions
diff --git a/README.rst b/README.rst
index 0760f44..0132577 100644
--- a/README.rst
+++ b/README.rst
@@ -16,31 +16,55 @@ HydroRoll-Core <=> 水系核心 |Structure|
- 📚 *PDF* 生成,结合自定义 *PDF* 模板,能够生成符合需求的 *PDF* 书籍。
- 🌏 离线文档与在线协作站点,使用 *Sphinx* 框架与 *Vue* 技术栈生成本地文档与在线站点。
-架构设计
---------
-
-核心模块 ``corelib``
-
-包含 *CLI* 界面,用于单独使用。
-包含 *REST API* 和 *WebSocket* 通信模块,以便其他语言能够接入和与之交互。
-集成请求处理模块,确保能够处理大量请求。
-
-规则包加载模块 ``Rule Pack Loading Module``
-
-负责读取约定式的规则包。
-利用并行处理技术,可通过Rust实现以提高性能。
-PDF生成模块 ``PDF Generation Module``
-
-将规则包作为输入,结合高度自定义的PDF模板,生成符合要求的PDF书籍。
-
-文档站点生成模块 ``Documentation Site Generation Module``
-
-使用Sphinx框架生成本地在线文档站点。
-
-其他功能模块 ``Other Feature Modules``
+架构设计
+-------
+
+.. code-block:: mermaid
+
+ graph TD;
+ A-->B;
+ A-->C;
+ B-->D;
+ C-->D;
+
+
+具象化模型
+----------
+
+.. code-block:: stl
+
+ solid cube_corner
+ facet normal 0.0 -1.0 0.0
+ outer loop
+ vertex 0.0 0.0 0.0
+ vertex 1.0 0.0 0.0
+ vertex 0.0 0.0 1.0
+ endloop
+ endfacet
+ facet normal 0.0 0.0 -1.0
+ outer loop
+ vertex 0.0 0.0 0.0
+ vertex 0.0 1.0 0.0
+ vertex 1.0 0.0 0.0
+ endloop
+ endfacet
+ facet normal -1.0 0.0 0.0
+ outer loop
+ vertex 0.0 0.0 0.0
+ vertex 0.0 0.0 1.0
+ vertex 0.0 1.0 0.0
+ endloop
+ endfacet
+ facet normal 0.577 0.577 0.577
+ outer loop
+ vertex 1.0 0.0 0.0
+ vertex 0.0 1.0 0.0
+ vertex 0.0 0.0 1.0
+ endloop
+ endfacet
+ endsolid
-包括尚未确定的其他功能,如文档生成、数据分析等。
----
diff --git a/docs/source/conf.py b/docs/source/conf.py
index c423830..7b02611 100644
--- a/docs/source/conf.py
+++ b/docs/source/conf.py
@@ -47,7 +47,7 @@ templates_path = ["_templates"]
exclude_patterns = ["_build", "Thumbs.db", ".DS_Store"]
extlinks = {
"issue": ("https://github.com/HydroRoll-Team/HydroRollCore/%s", "issue %s"),
- "doc": ("https://core.hydroroll.team/en/latest/%s", "pages/%s"),
+ "doc": ("https://core.hydroroll.team/zh-cn/latest/%s", "pages/%s"),
}
source_suffix = {
".rst": "restructuredtext",
diff --git a/examples/BRP/src/character.py b/examples/BRP/src/character.py
index 1dd9442..54503eb 100644
--- a/examples/BRP/src/character.py
+++ b/examples/BRP/src/character.py
@@ -1,7 +1,6 @@
import inspect
from hydro_roll_core.development import Character
-from typing import Literal, List, Tuple, Union, Dict, Generic, Optional
-
+from typing import Literal, List, Tuple, Union, Dict, Generic, Optional, TYPE_CHECKING
class Identity:
"""
diff --git a/hydro_roll_core/libcore.pyi b/hydro_roll_core/libcore.pyi
index 937bef3..6364ca4 100644
--- a/hydro_roll_core/libcore.pyi
+++ b/hydro_roll_core/libcore.pyi
@@ -1,6 +1,7 @@
class libcore:
"""Core library for hydro roll"""
+
def __init__(self): ...
- def sum_as_string(self, a: int, b: int) -> str:
- """sum two numbers and return the result as a string"""
+
+ def process_rule_pack(rule_pack: str) -> str:
...
diff --git a/pyproject.toml b/pyproject.toml
index 5f9588c..7da0fc9 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -3,7 +3,7 @@ requires = ["maturin>=1.4,<2.0"]
build-backend = "maturin"
[project]
-name = "hydro_roll_core"
+name = "hydro-roll-core"
dynamic = ["version"]
description = "Core of HydroRoll SDK."
authors = [{ name = "简律纯", email = "leader@hydroroll.team" }]
@@ -12,7 +12,7 @@ dependencies = [
]
requires-python = ">=3.9"
readme = "README.rst"
-license = { text = "MIT" }
+license = { text = " AGPL-3.0" }
[project.urls]
homepage = "https://core.hydroroll.team/"
diff --git a/src/lib.rs b/src/lib.rs
index 213d20e..9d2c8e9 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -1,15 +1,16 @@
use pyo3::prelude::*;
+use pyo3::wrap_pyfunction;
-/// Formats the sum of two numbers as string.
#[pyfunction]
-fn sum_as_string(a: usize, b: usize) -> PyResult<String> {
- Ok((a + b).to_string())
+fn process_rule_pack(rule_pack: &str) -> PyResult<String> {
+ // 处理规则包的逻辑
+ Ok(format!("Processed rule pack: {}", rule_pack))
}
/// A Python module implemented in Rust.
#[pymodule]
#[pyo3(name = "libcore")]
-fn corelib(_py: Python, m: &PyModule) -> PyResult<()> {
- m.add_function(wrap_pyfunction!(sum_as_string, m)?)?;
+fn libcore(_py: Python, m: &PyModule) -> PyResult<()> {
+ m.add_function(wrap_pyfunction!(process_rule_pack, m)?)?;
Ok(())
} \ No newline at end of file
diff --git a/src/main.rs b/src/main.rs
new file mode 100644
index 0000000..a855efc
--- /dev/null
+++ b/src/main.rs
@@ -0,0 +1,13 @@
+use lib::process_rule_pack;
+
+fn main() {
+ let args: Vec<String> = std::env::args().collect();
+ if args.len() < 2 {
+ eprintln!("Usage: {} <rule_pack>", args[0]);
+ std::process::exit(1);
+ }
+ match process_rule_pack(&args[1]) {
+ Ok(result) => println!("Result: {}", result),
+ Err(e) => eprintln!("Error: {}", e),
+ }
+} \ No newline at end of file
diff --git a/tests/test_corelib.py b/tests/test_corelib.py
index aa402cd..a0a3424 100644
--- a/tests/test_corelib.py
+++ b/tests/test_corelib.py
@@ -1,4 +1,11 @@
from hydro_roll_core import libcore
-cb = libcore()
-cb.sum_as_string(1, 2) \ No newline at end of file
+cb = libcore
+
+def main():
+ rule_pack = "example_rule_pack"
+ result = cb.process_rule_pack(rule_pack)
+ print(result)
+
+if __name__ == "__main__":
+ main() \ No newline at end of file