Skip to content

Commit d709c5d

Browse files
committed
added spline transfer
1 parent 77d9946 commit d709c5d

8 files changed

Lines changed: 213 additions & 263 deletions

File tree

docs/source/_static/logo.png

631 KB
Loading

docs/source/conf.py

Lines changed: 149 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,22 @@
99
# import sys
1010
# sys.path.insert(0, os.path.abspath("../sphedron")) # Adjust path to your package
1111

12-
import os
13-
import sys
14-
sys.path.insert(0, os.path.abspath('../../sphedron/'))
15-
print("PATH:",os.path.abspath('../../sphedron/'))
12+
# import os
13+
# import sys
14+
# sys.path.insert(0, os.path.abspath('../../sphedron/'))
15+
# print("PATH:",os.path.abspath('../../sphedron/'))
16+
17+
import sphedron
18+
import inspect
19+
import importlib
1620

1721
project = "Sphedron"
1822
author = "Ayoub Ghriss"
19-
# copyright = "2025, Ayoub Ghriss"
23+
copyright = "2025, Ayoub Ghriss"
24+
25+
# add_module_names = False
26+
# typehints_fully_qualified = False # sphinx-autodoc-typehints >= 2.0
27+
2028

2129
# -- General configuration ---------------------------------------------------
2230
# https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration
@@ -29,16 +37,148 @@
2937

3038
extensions = [
3139
"sphinx.ext.autodoc",
32-
"sphinx.ext.napoleon", # Parses Google/NumPy docstrings
33-
"sphinx.ext.viewcode",
3440
"sphinx.ext.autosummary",
41+
"sphinx.ext.intersphinx",
3542
"sphinx.ext.mathjax",
43+
"sphinx.ext.napoleon",
44+
"sphinx.ext.viewcode",
45+
# 'sphinx_autodoc_typehints',
46+
# 'sphinx_copybutton',
47+
# 'nbsphinx',
48+
# 'pyg',
3649
]
50+
3751
autosummary_generate = True
52+
autosummary_generate_overwrite = True
3853
html_theme = "sphinx_rtd_theme"
3954
napoleon_google_docstring = True # Enable Google docstring parsing
40-
napoleon_numpy_docstring = False # Disable NumPy docstrings
55+
napoleon_numpy_docstring = True # Disable NumPy docstrings
56+
# suppress_warnings = ["autodoc.import_object"]
57+
# autodoc_default_flags = {
58+
# # "members": True,
59+
# # "show-inheritance": True,
60+
# "member-order": "groupwise", # groups methods vs attributes/properties
61+
# # "undoc-members": False,
62+
# "private-members": False,
63+
# }
64+
4165

4266
templates_path = ["_templates"]
4367
exclude_patterns = ["build", "Thumbs.db", ".DS_Store", "tests/*"]
44-
# html_static_path = ["_static"]
68+
html_static_path = ["_static"]
69+
70+
71+
def rst_jinja_render(app, _, source):
72+
if hasattr(app.builder, "templates"):
73+
rst_context = {"sphedron": sphedron}
74+
source[0] = app.builder.templates.render_string(source[0], rst_context)
75+
76+
77+
def autodoc_skip_member(app, what, name, obj, skip, options):
78+
# print(name)
79+
# if name in {"__init__", "__call__"}:
80+
# return False
81+
# Skip single-underscore private and non-magic double-underscore
82+
if name.startswith("_") and not (
83+
name.startswith("__") and name.endswith("__")
84+
):
85+
return True
86+
return skip
87+
88+
# def setup(app):
89+
# app.connect("source-read", rst_jinja_render)
90+
# app.connect("autodoc-skip-member", autodoc_skip_member)
91+
# app.connect("autodoc-skip-attribute", autodoc_skip_member)
92+
93+
# app.add_js_file('js/version_alert.js')
94+
95+
# Do not drop type hints in signatures:
96+
# del app.events.listeners["autodoc-process-signature"]
97+
98+
# conf.py
99+
# def _split_methods(fullname, names):
100+
# import importlib, inspect
101+
# mod, clsname = fullname.rsplit(".", 1)
102+
# cls = getattr(importlib.import_module(mod), clsname)
103+
# out = {"classmethods": [], "staticmethods": [], "instancemethods": []}
104+
# for n in names:
105+
# try:
106+
# attr = inspect.getattr_static(cls, n)
107+
# except Exception:
108+
# continue
109+
# if isinstance(attr, classmethod):
110+
# out["classmethods"].append(n)
111+
# elif isinstance(attr, staticmethod):
112+
# out["staticmethods"].append(n)
113+
# elif inspect.isfunction(attr):
114+
# out["instancemethods"].append(n)
115+
# return out
116+
117+
# def _split_attributes(fullname, names):
118+
# import importlib, inspect
119+
# mod, clsname = fullname.rsplit(".", 1)
120+
# cls = getattr(importlib.import_module(mod), clsname)
121+
# props, data = [], []
122+
# for n in names:
123+
# try:
124+
# attr = inspect.getattr_static(cls, n)
125+
# except Exception:
126+
# continue
127+
# (props if isinstance(attr, property) else data).append(n)
128+
# return {"properties": props, "data": data}
129+
130+
# def _register_filters(app):
131+
# env = app.builder.templates.environment # official way to extend template env
132+
# env.filters["split_methods"] = _split_methods
133+
# env.filters["split_attributes"] = _split_attributes
134+
135+
# def setup(app):
136+
# app.connect("builder-inited", _register_filters) # recommended event
137+
138+
139+
def classify(names, fullname):
140+
"""Split member names into properties vs data, and instance/class/static methods."""
141+
from sphinx.util import logging
142+
143+
log = logging.getLogger(__name__)
144+
mod, clsname = fullname.rsplit(".", 1)
145+
log.warning(f"Classify print: {fullname, names, mod, clsname}")
146+
cls = getattr(importlib.import_module(mod), clsname)
147+
148+
props, data = [], []
149+
inst_meths, cls_meths, static_meths = [], [], []
150+
151+
for n in names or []:
152+
try:
153+
a = inspect.getattr_static(cls, n)
154+
except Exception:
155+
continue
156+
if isinstance(a, property):
157+
props.append(n)
158+
elif isinstance(a, classmethod):
159+
cls_meths.append(n)
160+
elif isinstance(a, staticmethod):
161+
static_meths.append(n)
162+
elif inspect.isfunction(a):
163+
inst_meths.append(n)
164+
else:
165+
data.append(n)
166+
167+
return {
168+
"properties": props,
169+
"data": data,
170+
"methods": inst_meths,
171+
"classmethods": cls_meths,
172+
"staticmethods": static_meths,
173+
}
174+
175+
176+
def _register_filters(app):
177+
env = app.builder.templates.environment
178+
env.filters["classify"] = classify
179+
180+
181+
def setup(app):
182+
app.connect("builder-inited", _register_filters)
183+
app.connect("source-read", rst_jinja_render)
184+
app.connect("autodoc-skip-member", autodoc_skip_member)

docs/source/index.rst

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,21 @@
11
Spherical Polyhedral Meshes
2-
=====================================
2+
3+
4+
.. note::
5+
6+
This project is under active development.
7+
8+
9+
Contents
10+
--------
11+
12+
.. toctree::
13+
:caption: Understanding the meshes
14+
15+
tutorials/meshes
316

417
.. toctree::
5-
:maxdepth: 2
6-
:caption: Contents:
18+
:maxdepth: 1
19+
:caption: Package Reference
720

8-
icosphere
9-
modules
21+
modules/meshes

docs/source/modules/meshes.rst

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
sphedron.mesh.base
2+
==================
3+
4+
5+
6+
7+
.. currentmodule:: sphedron.mesh.base
8+
9+
.. autosummary::
10+
:nosignatures:
11+
:template: autosummary/class.rst
12+
{% for name in sphedron.mesh.base.classes %}
13+
{{ name }}
14+
{% endfor %}
15+
16+
17+
{% for name in sphedron.mesh.base.classes %}
18+
.. autoclass:: {{ name }}
19+
.. automethod::
20+
{% endfor %}
File renamed without changes.

docs/source/tutorials/meshes.rst

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
Mesh Construction
2+
=================
3+
4+
5+
.. toctree::
6+
7+
./icosphere

0 commit comments

Comments
 (0)