Install & Compatibility
Where this runs
tested against v1.0.0 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
muslpy 3.10–3.920 runs
build_error
glibcpy 3.10–3.920 runs
installs and imports cleanly · install 10.6s · import 19.301s · 411MB
412MB installed
● package 412MB
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
splinebox
✓ import splinebox
Spline
✓ from splinebox.spline_curves import Spline
✗ import splinebox.Spline
The Spline class is located within the splinebox.spline_curves submodule, not directly under splinebox.
B3
✓ from splinebox.basis_functions import B3
✗ import splinebox.B3
Basis functions like B3 are located within the splinebox.basis_functions submodule.
This quickstart demonstrates how to create and visualize a closed cubic B-spline using Splinebox. It defines a set of control points (knots), instantiates a Spline object with a B3 basis function, evaluates the spline along a range of parameter values, and then plots both the knots and the resulting spline curve using Matplotlib.
import splinebox
import numpy as np
import matplotlib.pyplot as plt
# Define the number of knots and the basis function
n_knots = 4
basis_function = splinebox.basis_functions.B3()
# Create a closed cubic B-spline with initial knots
spline = splinebox.spline_curves.Spline(M=n_knots, basis_function=basis_function, closed=True)
spline.knots = np.array([[1, 2], [3, 2], [4, 3], [1, 1]])
# Evaluate the spline at parameter values
t = np.linspace(0, n_knots, 100) # Parameter values along the spline
vals = spline(t, derivative=0) # Get the spline points
# Plot the spline and its knots
plt.figure(figsize=(6, 6))
plt.scatter(spline.knots[:, 0], spline.knots[:, 1], color='red', marker='o', label='Knots')
plt.plot(vals[:, 0], vals[:, 1], color='blue', label='Spline Curve')
plt.title('Splinebox Quickstart Example')
plt.xlabel('X-coordinate')
plt.ylabel('Y-coordinate')
plt.grid(True)
plt.legend()
plt.axis('equal')
plt.show()
Debug
Known issues
deprecatedThe `eval` method on `Spline` and `HermiteSpline` classes is deprecated. Direct calling of the spline object (`spline(t)`) should be used instead.fixReplace `spline.eval(t)` with `spline(t)` for evaluating the spline.
affects: >=0.5.0
breakingA future warning indicates an upcoming change in the 'squeeze' policy for outputs. This means the default behavior for reshaping single-dimensional outputs might change, potentially affecting code that implicitly relies on the current squeezing behavior.fixCode should explicitly handle the expected shape of spline outputs, e.g., by checking `output.shape` or using explicit reshaping, rather than relying on automatic squeezing.
affects: >=0.5.0 (warning issued), future major versions (breaking change)
gotchaWhen using `moving_frame` for unsorted arrays of parameters, versions prior to 0.5.1 could produce incorrect results. This was fixed in v0.5.1.fixEnsure that parameter arrays passed to `moving_frame` are sorted, especially if using older versions. Upgrade to v0.5.1 or newer to benefit from the fix.
affects: <0.5.1
gotchaSplinebox automatically handles periodicity and padding for closed splines. This differs from `scipy.interpolate.splprep`, which requires manual pre-computation of parameter values for knots and data points, accounting for padding and periodicity.fixWhen migrating from or comparing with SciPy, be aware that Splinebox simplifies these aspects, so manual pre-computation is generally not needed and can lead to incorrect results if misapplied.
affects: All versions
Errors
Common errors & fixes
ModuleNotFoundError: No module named 'splinebox'
The splinebox package is not installed in the current Python environment or the environment is not activated.
AttributeError: module 'splinebox' has no attribute 'HermiteSpline'
The HermiteSpline class is located within the `splinebox.splines` submodule, not directly under the top-level `splinebox` package.
fixfrom splinebox.splines import HermiteSpline
ValueError: Unknown spline_type: 'invalid_type_name'
The `spline_type` argument provided to the `fit_spline` function or Spline constructor does not correspond to a recognized spline class or its string alias.
fixUse a valid spline class (e.g., `HermiteSpline`) or its corresponding string alias (e.g., `'hermite'`) for the `spline_type` argument.
TypeError: my_custom_loss() missing 1 required positional argument: 'spline_eval_func'
A custom loss function provided to `fit_spline` or `Spline` has an incorrect number of arguments in its signature; it expects three arguments.
fixAdjust the custom loss function's signature to accept three arguments: `(x_data, y_data, spline_eval_func)`.
Upgrade
Version history
1.0.0latest on PyPI · released May 8, 2026
Audit
Dependencies
numpyoptionalEssential for array manipulation and numerical operations in typical spline fitting workflows.
matplotliboptionalCommonly used for plotting splines and their properties, as shown in examples.
scipyoptionalUsed for optimization in fitting routines and for comparison with SciPy's spline implementations.