Skip to content

Commit af6a06c

Browse files
committed
Revert "Update c-blosc2 commits"
This reverts commit a304204.
1 parent a304204 commit af6a06c

75 files changed

Lines changed: 14430 additions & 3 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

CMakeLists.txt

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,11 @@ set(MINIEXPR_BUILD_BENCH OFF CACHE BOOL "Build miniexpr benchmarks" FORCE)
5858

5959
FetchContent_Declare(miniexpr
6060
GIT_REPOSITORY https://github.com/Blosc/miniexpr.git
61-
GIT_TAG main # latest commit in main
61+
# GIT_TAG 979573da618e0443c3984bad8db3ed5d9ce72f75 # latest commit in main
62+
GIT_TAG main
6263
GIT_SHALLOW TRUE # fetch only the latest commit (only works with a branch in GIT_TAG)
64+
# In case you want to use a local copy of miniexpr for development, uncomment the line below
65+
# SOURCE_DIR "/Users/faltet/blosc/miniexpr"
6366
)
6467
FetchContent_MakeAvailable(miniexpr)
6568

@@ -117,8 +120,7 @@ else()
117120
include(FetchContent)
118121
FetchContent_Declare(blosc2
119122
GIT_REPOSITORY https://github.com/Blosc/c-blosc2
120-
GIT_TAG main # latest commit in main
121-
GIT_SHALLOW TRUE # fetch only the latest commit (only works with a branch in GIT_TAG)
123+
GIT_TAG 7fca7713fe77ab03ffbe31c30c3af5d7f0287bbc # latest commit in main
122124
)
123125
FetchContent_MakeAvailable(blosc2)
124126
include_directories("${blosc2_SOURCE_DIR}/include")
629 Bytes
Loading
989 Bytes
Loading

doc/_static/blosc-logo_128.png

3.49 KB
Loading

doc/_static/blosc-logo_256.png

6.98 KB
Loading

doc/_static/css/custom.css

Lines changed: 121 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,121 @@
1+
li.nav-item i.fa-external-link-alt { display: none }
2+
3+
:root {
4+
/*****************************************************************************
5+
* Theme config
6+
**/
7+
--pst-header-height: 60px;
8+
9+
/*****************************************************************************
10+
* Font size
11+
**/
12+
--pst-font-size-base: 15px; /* base font size - applied at body / html level */
13+
14+
/* heading font sizes */
15+
--pst-font-size-h1: 36px;
16+
--pst-font-size-h2: 32px;
17+
--pst-font-size-h3: 26px;
18+
--pst-font-size-h4: 21px;
19+
--pst-font-size-h5: 18px;
20+
--pst-font-size-h6: 16px;
21+
22+
/* smaller then heading font sizes*/
23+
--pst-font-size-milli: 12px;
24+
25+
--pst-sidebar-font-size: .9em;
26+
--pst-sidebar-caption-font-size: .9em;
27+
28+
/*****************************************************************************
29+
* Font family
30+
**/
31+
/* These are adapted from https://systemfontstack.com/ */
32+
--pst-font-family-base-system: -apple-system, BlinkMacSystemFont, Segoe UI, "Helvetica Neue",
33+
Arial, sans-serif, Apple Color Emoji, Segoe UI Emoji, Segoe UI Symbol;
34+
--pst-font-family-monospace-system: "SFMono-Regular", Menlo, Consolas, Monaco,
35+
Liberation Mono, Lucida Console, monospace;
36+
37+
--pst-font-family-base: var(--pst-font-family-base-system);
38+
--pst-font-family-heading: var(--pst-font-family-base);
39+
--pst-font-family-monospace: var(--pst-font-family-monospace-system);
40+
41+
/*****************************************************************************
42+
* Color
43+
*
44+
* Colors are defined in rgb string way, "red, green, blue"
45+
**/
46+
--pst-color-primary: 3, 134, 150;
47+
--pst-color-primary-dark: 2, 89, 100;
48+
--pst-color-secondary: 230, 169, 10;
49+
--pst-color-success: 40, 167, 69;
50+
--pst-color-info: 0, 123, 255; /*23, 162, 184;*/
51+
--pst-color-warning: 255, 193, 7;
52+
--pst-color-danger: 220, 53, 69;
53+
--pst-color-text-base: 51, 51, 51;
54+
55+
--pst-color-h1: var(--pst-color-primary-dark);
56+
--pst-color-h2: var(--pst-color-primary-dark);
57+
--pst-color-h3: var(--pst-color-text-base);
58+
--pst-color-h4: var(--pst-color-text-base);
59+
--pst-color-h5: var(--pst-color-text-base);
60+
--pst-color-h6: var(--pst-color-text-base);
61+
--pst-color-paragraph: var(--pst-color-text-base);
62+
--pst-color-link: var(--pst-color-primary);
63+
--pst-color-link-hover: var(--pst-color-secondary);
64+
--pst-color-headerlink: var(--pst-color-primary);
65+
--pst-color-headerlink-hover: 255, 255, 255;
66+
--pst-color-preformatted-text: 34, 34, 34;
67+
--pst-color-preformatted-background: 250, 250, 250;
68+
--pst-color-inline-code: var(--pst-color-primary);
69+
70+
--pst-color-active-navigation: var(--pst-color-secondary);
71+
--pst-color-navbar-link: 77, 77, 77;
72+
--pst-color-navbar-link-hover: var(--pst-color-active-navigation);
73+
--pst-color-navbar-link-active: var(--pst-color-active-navigation);
74+
--pst-color-sidebar-link: 77, 77, 77;
75+
--pst-color-sidebar-link-hover: var(--pst-color-active-navigation);
76+
--pst-color-sidebar-link-active: var(--pst-color-active-navigation);
77+
--pst-color-sidebar-expander-background-hover: 244, 244, 244;
78+
--pst-color-sidebar-caption: 77, 77, 77;
79+
--pst-color-toc-link: 119, 117, 122;
80+
--pst-color-toc-link-hover: var(--pst-color-active-navigation);
81+
--pst-color-toc-link-active: var(--pst-color-active-navigation);
82+
83+
/*****************************************************************************
84+
* Icon
85+
**/
86+
87+
/* font awesome icons*/
88+
--pst-icon-check-circle: '\f058';
89+
--pst-icon-info-circle: '\f05a';
90+
--pst-icon-exclamation-triangle: '\f071';
91+
--pst-icon-exclamation-circle: '\f06a';
92+
--pst-icon-times-circle: '\f057';
93+
--pst-icon-lightbulb: '\f0eb';
94+
95+
/*****************************************************************************
96+
* Admonitions
97+
**/
98+
99+
--pst-color-admonition-default: var(--pst-color-info);
100+
--pst-color-admonition-note: var(--pst-color-info);
101+
--pst-color-admonition-attention: var(--pst-color-warning);
102+
--pst-color-admonition-caution: var(--pst-color-warning);
103+
--pst-color-admonition-warning: var(--pst-color-warning);
104+
--pst-color-admonition-danger: var(--pst-color-danger);
105+
--pst-color-admonition-error: var(--pst-color-danger);
106+
--pst-color-admonition-hint: var(--pst-color-success);
107+
--pst-color-admonition-tip: var(--pst-color-success);
108+
--pst-color-admonition-important: var(--pst-color-success);
109+
110+
--pst-icon-admonition-default: var(--pst-icon-info-circle);
111+
--pst-icon-admonition-note: var(--pst-icon-info-circle);
112+
--pst-icon-admonition-attention: var(--pst-icon-exclamation-circle);
113+
--pst-icon-admonition-caution: var(--pst-icon-exclamation-triangle);
114+
--pst-icon-admonition-warning: var(--pst-icon-exclamation-triangle);
115+
--pst-icon-admonition-danger: var(--pst-icon-exclamation-triangle);
116+
--pst-icon-admonition-error: var(--pst-icon-times-circle);
117+
--pst-icon-admonition-hint: var(--pst-icon-lightbulb);
118+
--pst-icon-admonition-tip: var(--pst-icon-lightbulb);
119+
--pst-icon-admonition-important: var(--pst-icon-exclamation-circle);
120+
121+
}

doc/conf.py

Lines changed: 252 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,252 @@
1+
# -- Path setup --------------------------------------------------------------
2+
import inspect
3+
import os
4+
import sys
5+
6+
import numpy as np
7+
8+
import blosc2
9+
10+
11+
def genbody(f, func_list, lib="blosc2"):
12+
for func in func_list:
13+
f.write(f" {func}\n")
14+
15+
f.write("\n\n\n")
16+
for func in func_list:
17+
f.write(f".. autofunction:: {lib}.{func}\n")
18+
19+
20+
sys.path.insert(0, os.path.abspath(os.path.dirname(blosc2.__file__)))
21+
22+
project = "Python-Blosc2"
23+
copyright = "2019-present, The Blosc Developers"
24+
author = "The Blosc Developers"
25+
extensions = [
26+
"sphinx.ext.autosummary",
27+
"sphinx.ext.autodoc",
28+
"sphinx.ext.intersphinx",
29+
"sphinx.ext.napoleon",
30+
"sphinx.ext.linkcode",
31+
"numpydoc",
32+
"myst_parser",
33+
"sphinx_paramlinks",
34+
"sphinx_design",
35+
"nbsphinx",
36+
# For some reason, the following extensions are not working
37+
# "IPython.sphinxext.ipython_directive",
38+
# "IPython.sphinxext.ipython_console_highlighting",
39+
]
40+
source_suffix = [".rst", ".md"]
41+
html_theme = "furo"
42+
html_static_path = ["_static"]
43+
html_css_files = [
44+
"css/custom.css",
45+
"https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0/css/all.min.css",
46+
]
47+
html_logo = "_static/blosc-logo_256.png"
48+
# Just use the favicon from the parent project
49+
# html_favicon = "_static/blosc-logo_128.png"
50+
html_favicon = "_static/blosc-favicon_64x64.png"
51+
html_theme_options = {
52+
"logo": {
53+
"link": "/index",
54+
"alt_text": "Blosc",
55+
},
56+
"icon_links": [
57+
{
58+
"name": "GitHub",
59+
"url": "https://github.com/Blosc/python-blosc2",
60+
"icon": "fab fa-github-square",
61+
},
62+
{
63+
"name": "Mastodon",
64+
"url": "https://fosstodon.org/@Blosc2",
65+
"icon": "fab fa-mastodon",
66+
},
67+
{
68+
"name": "Bluesky",
69+
"url": "https://bsky.app/profile/blosc.org",
70+
"icon": "fas fa-cloud-sun",
71+
},
72+
],
73+
"external_links": [
74+
{"name": "C-Blosc2", "url": "/c-blosc2/c-blosc2.html"},
75+
{"name": "Python-Blosc2", "url": "/python-blosc2/"},
76+
{"name": "Donate to Blosc", "url": "/pages/donate/"},
77+
],
78+
}
79+
80+
exclude_patterns = ["_build", ".DS_Store", "**.ipynb_checkpoints"]
81+
82+
html_show_sourcelink = False
83+
84+
autosummary_generate_overwrite = False
85+
autosummary_generate = True
86+
87+
# GENERATE ufuncs.rst
88+
blosc2_ufuncs = []
89+
for name, obj in vars(np).items():
90+
if isinstance(obj, np.ufunc) and hasattr(blosc2, name):
91+
blosc2_ufuncs.append(name)
92+
93+
with open("reference/ufuncs.rst", "w") as f:
94+
f.write(
95+
"""Universal Functions (`ufuncs`)
96+
------------------------------
97+
98+
The following elementwise functions can be used for computing with any of :ref:`NDArray <NDArray>`, :ref:`C2Array <C2Array>`, :ref:`NDField <NDField>` and :ref:`LazyExpr <LazyExpr>`.
99+
100+
Their result is always a :ref:`LazyExpr` instance, which can be evaluated (with ``compute`` or ``__getitem__``) to get the actual values of the computation.
101+
102+
Note: The functions ``conj``, ``real``, ``imag``, ``contains``, ``where`` are not technically ufuncs.
103+
104+
.. currentmodule:: blosc2
105+
106+
.. autosummary::
107+
108+
"""
109+
)
110+
genbody(f, blosc2_ufuncs)
111+
112+
# GENERATE additional_funcs.rst
113+
blosc2_addfuncs = sorted(["conj", "real", "imag", "contains", "where", "clip", "round"])
114+
blosc2_dtypefuncs = sorted(["astype", "can_cast", "result_type", "isdtype"])
115+
116+
with open("reference/additional_funcs.rst", "w") as f:
117+
f.write(
118+
"""Additional Functions and Type Utilities
119+
=======================================
120+
121+
Functions
122+
---------
123+
124+
The following functions can also be used for computing with any of :ref:`NDArray <NDArray>`, :ref:`C2Array <C2Array>`, :ref:`NDField <NDField>` and :ref:`LazyExpr <LazyExpr>`.
125+
126+
Their result is typically a :ref:`LazyExpr` instance, which can be evaluated (with ``compute`` or ``__getitem__``) to get the actual values of the computation.
127+
128+
.. currentmodule:: blosc2
129+
130+
.. autosummary::
131+
132+
"""
133+
)
134+
genbody(f, blosc2_addfuncs)
135+
f.write(
136+
"""Type Utilities
137+
--------------
138+
139+
The following functions are useful for working with datatypes.
140+
141+
.. currentmodule:: blosc2
142+
143+
.. autosummary::
144+
145+
"""
146+
)
147+
genbody(f, blosc2_dtypefuncs)
148+
149+
# GENERATE index_funcs.rst
150+
blosc2_indexfuncs = sorted(
151+
[
152+
"count_nonzero",
153+
"squeeze",
154+
"expand_dims",
155+
"sort",
156+
"take",
157+
"take_along_axis",
158+
"broadcast_to",
159+
"meshgrid",
160+
"indices",
161+
]
162+
)
163+
164+
with open("reference/index_funcs.rst", "w") as f:
165+
f.write(
166+
"""Indexing Functions and Utilities
167+
=======================================
168+
169+
The following functions are useful for performing indexing and other associated operations.
170+
171+
.. currentmodule:: blosc2
172+
173+
.. autosummary::
174+
175+
"""
176+
)
177+
genbody(f, blosc2_indexfuncs)
178+
179+
# GENERATE linear_algebra.rst
180+
linalg_funcs = [
181+
name
182+
for name, obj in vars(blosc2.linalg).items()
183+
if (inspect.isfunction(obj) and getattr(obj, "__doc__", None))
184+
]
185+
186+
with open("reference/linalg.rst", "w") as f:
187+
f.write(
188+
"""Linear Algebra
189+
-----------------
190+
The following functions can be used for computing linear algebra operations with :ref:`NDArray <NDArray>`.
191+
192+
.. currentmodule:: blosc2.linalg
193+
194+
.. autosummary::
195+
196+
"""
197+
)
198+
genbody(f, linalg_funcs, "blosc2.linalg")
199+
200+
hidden = "_ignore_multiple_size"
201+
202+
203+
def linkcode_resolve(domain, info):
204+
if domain != "py":
205+
return None
206+
if not info["module"]:
207+
return None
208+
209+
import importlib
210+
import inspect
211+
212+
# Modify this to point to your package
213+
module_name = info["module"]
214+
full_name = info["fullname"]
215+
216+
try:
217+
module = importlib.import_module(module_name)
218+
except ImportError:
219+
return None
220+
221+
obj = module
222+
for part in full_name.split("."):
223+
obj = getattr(obj, part, None)
224+
if obj is None:
225+
return None
226+
227+
try:
228+
fn = inspect.getsourcefile(obj)
229+
source, lineno = inspect.getsourcelines(obj)
230+
except Exception:
231+
return None
232+
233+
# Replace this with your repo info
234+
github_base_url = "https://github.com/Blosc/python-blosc2/blob/main/"
235+
# Get the path relative to the repository root, not the module directory
236+
repo_root = os.path.abspath(os.path.join(os.path.dirname(blosc2.__file__), "..", ".."))
237+
relpath = os.path.relpath(fn, start=repo_root)
238+
return f"{github_base_url}{relpath}#L{lineno}"
239+
240+
241+
def process_sig(app, what, name, obj, options, signature, return_annotation):
242+
if signature and hidden in signature:
243+
signature = signature.split(hidden)[0] + ")"
244+
return (signature, return_annotation)
245+
246+
247+
def setup(app):
248+
app.connect("autodoc-process-signature", process_sig)
249+
250+
251+
# Allow errors (e.g. with numba asking for a specific numpy version)
252+
nbsphinx_allow_errors = True

0 commit comments

Comments
 (0)