diff options
| -rw-r--r-- | .vscode/settings.json | 2 | ||||
| -rw-r--r-- | docs/source/COPYING.rst | 2 | ||||
| -rw-r--r-- | docs/source/conf.py | 16 | ||||
| -rw-r--r-- | hydro_roll_core/__init__.py | 3 | ||||
| -rw-r--r-- | hydro_roll_core/development/__init__.py (renamed from hydro_roll_core/dev/__init__.py) | 0 | ||||
| -rw-r--r-- | hydro_roll_core/document/__init__.py (renamed from hydro_roll_core/docs/__init__.py) | 0 | ||||
| -rw-r--r-- | hydro_roll_core/feature/__init__.py (renamed from hydro_roll_core/features/__init__.py) | 0 | ||||
| -rw-r--r-- | src/main.rs | 36 |
8 files changed, 48 insertions, 11 deletions
diff --git a/.vscode/settings.json b/.vscode/settings.json index 73dc9f3..f2907a5 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -1,3 +1,3 @@ { - "restructuredtext.preview.name": "docutils" + "restructuredtext.preview.name": "sphinx" }
\ No newline at end of file diff --git a/docs/source/COPYING.rst b/docs/source/COPYING.rst index ea3bea4..cb94ff9 100644 --- a/docs/source/COPYING.rst +++ b/docs/source/COPYING.rst @@ -1 +1 @@ -.. include:: ../../COPYING
\ No newline at end of file +.. include:: ../../LICENSE
\ No newline at end of file diff --git a/docs/source/conf.py b/docs/source/conf.py index 27e20a6..602956e 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -25,10 +25,10 @@ AUTHORS = ",".join([f"{aut}" for aut in AUTHOR_TABLE]) project = PROJECT_NAME # "Infini" release = PROJECT_VERSION # "latest" -copyright = "2023-PRESENT, HydroRoll-Team & AICMUniversity." +copyright = "2023-PRESENT, HydroRoll-Team." author = AUTHORS # "Hsiang Nianian" -html_title = "Nivis ❄" +html_title = "HydroRollCore" # -- General configuration --------------------------------------------------- # https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration @@ -46,8 +46,8 @@ extensions = [ templates_path = ["_templates"] exclude_patterns = ["_build", "Thumbs.db", ".DS_Store"] extlinks = { - "issue": ("https://github.com/HydroRoll-Team/nivis-python/%s", "issue %s"), - "doc": ("https://nivis.hydroroll.team/en/latest/%s", "pages/%s"), + "issue": ("https://github.com/HydroRoll-Team/HydroRollCore/%s", "issue %s"), + "doc": ("https://core.hydroroll.team/en/latest/%s", "pages/%s"), } source_suffix = { ".rst": "restructuredtext", @@ -65,7 +65,7 @@ gettext_uuid = True # optional. html_theme = "furo" html_static_path = ["../_static"] _html_logo = ( - "https://cdn.jsdelivr.net/gh/HydroRoll-Team/nivis-python@main/docs/_static/logo.png" + "https://cdn.jsdelivr.net/gh/HydroRoll-Team/HydroRollCore@main/docs/_static/logo.png" ) html_favicon = _html_logo @@ -76,19 +76,19 @@ html_css_files = [ html_theme_options = { "announcement": "<em><a href='#'>documentation</a> is still under construction now, welcome any <a href='contributing.html'>contribution</a>!</em>", - "source_repository": "https://github.com/HydroRoll-Team/nivis-python/", + "source_repository": "https://github.com/HydroRoll-Team/HydroRollCore/", "source_branch": "main", "source_directory": "docs/source/", "footer_icons": [ { "name": "GitHub", - "url": "https://github.com/HydroRoll-Team/nivis-python/", + "url": "https://github.com/HydroRoll-Team/HydroRollCore/", "html": "", "class": "fa-brands fa-github", }, { "name": "Pypi", - "url": "https://pypi.org/project/nivis-python/", + "url": "https://pypi.org/project/hydro_roll_core/", "html": "", "class": "fa-brands fa-python", }, diff --git a/hydro_roll_core/__init__.py b/hydro_roll_core/__init__.py index 0a04e23..12508e3 100644 --- a/hydro_roll_core/__init__.py +++ b/hydro_roll_core/__init__.py @@ -1 +1,2 @@ -from . import corelib
\ No newline at end of file +from . import corelib + diff --git a/hydro_roll_core/dev/__init__.py b/hydro_roll_core/development/__init__.py index e69de29..e69de29 100644 --- a/hydro_roll_core/dev/__init__.py +++ b/hydro_roll_core/development/__init__.py diff --git a/hydro_roll_core/docs/__init__.py b/hydro_roll_core/document/__init__.py index e69de29..e69de29 100644 --- a/hydro_roll_core/docs/__init__.py +++ b/hydro_roll_core/document/__init__.py diff --git a/hydro_roll_core/features/__init__.py b/hydro_roll_core/feature/__init__.py index e69de29..e69de29 100644 --- a/hydro_roll_core/features/__init__.py +++ b/hydro_roll_core/feature/__init__.py diff --git a/src/main.rs b/src/main.rs new file mode 100644 index 0000000..4c28efa --- /dev/null +++ b/src/main.rs @@ -0,0 +1,36 @@ +#![allow(unused)] +fn main() { + use pyo3::prelude::*; + + #[pymodule] + fn parent_module(py: Python<'_>, m: &PyModule) -> PyResult<()> { + register_child_module(py, m)?; + Ok(()) + } + + fn register_child_module(py: Python<'_>, parent_module: &PyModule) -> PyResult<()> { + let child_module = PyModule::new(py, "child_module")?; + child_module.add_function(wrap_pyfunction!(func, child_module)?)?; + parent_module.add_submodule(child_module)?; + Ok(()) + } + + #[pyfunction] + fn func() -> String { + "func".to_string() + } + + Python::with_gil(|py| { + use pyo3::types::IntoPyDict; + use pyo3::wrap_pymodule; + let parent_module = wrap_pymodule!(parent_module)(py); + let ctx = [("parent_module", parent_module)].into_py_dict(py); + + py.run( + "assert parent_module.child_module.func() == 'func'", + None, + Some(&ctx), + ) + .unwrap(); + }) +} |
