refactor(api): move the 18 eigenvalue builders and `modify_rhs_*` under `spectraldiffx.fourier`; deprecate the un-numbered `solve_helmholtz_dst/dct` aliases; document what remains public

Open
#111 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
40/100
Issue type
Refactor
Clarity
Clearly specified
Activity status
Active
Tech stack
jupyter-notebook, python

Research direction

The work involves understanding the package structure in spectraldiffx/init.py and solvers.py. Start by reading the existing exports and the deprecation logic. The main tasks are creating a new subpackage spectraldiffx.fourier, moving eigenvalue builders and modify_rhs_* functions there, and adding all to modules. Check the linked issue #83 for context. Run mkdocs build --strict to verify documentation. 'Done' means the top-level all has ≤40 names, deprecated names warn, and the API docs are complete.

Written by the indexing model from the issue text.

Description

documentation enhancement

Part of #83. Do last in the epic, after the kernel and class consolidation.

Summary

spectraldiffx/__init__.py exports 116 names: 38 solve_{helmholtz,poisson}_{fft,dct,dct1,dct2,dst,dst1,dst2}[_1d|_3d], 18 {fft,dct1..4,dst1..4}_eigenvalues[_ps], 8 transforms, 3 modify_rhs_*, 3 BC/capacitance names, 46 classes. Of these:

  • solve_helmholtz_dst1 = solve_helmholtz_dst, solve_helmholtz_dct2 = solve_helmholtz_dct, and the two poisson equivalents (solvers.py:1589-1597) are exported aliases with no API page; the un-numbered names hide which grid type (regular vs staggered) they use.
  • The 18 eigenvalue builders are three formulas (FD2 2(cos θ − 1)/dx², PS −k², and the four identical mixed-BC wrappers at eigenvalues.py:213-306); fft_eigenvalues_ps duplicates grid.k**2. They are implementation details of the solvers and only appear at top level because nothing else was there to hold them.
  • modify_rhs_1d/2d/3d are solver internals.
  • 17 of the 116 names have no API page (list in #85's docs issue).
  • No module has an __all__ except the package root.

Proposed fix

  1. Create spectraldiffx.fourier (public subpackage) re-exporting grids, operators, filters, solvers, transforms; and spectraldiffx.fourier.eigenvalues holding one laplacian_eigenvalues(N, dx, bc, approximation) function plus the existing 18 as thin deprecated wrappers. Same pattern for spectraldiffx.chebyshev (after #79) and spectraldiffx.spherical.
  2. Keep the top-level exports for one release with DeprecationWarning on the moved names (via a module __getattr__), then remove them.
  3. Deprecate solve_helmholtz_dst, solve_helmholtz_dct, solve_poisson_dst, solve_poisson_dct in favour of the numbered names (or of solve_helmholtz_nd).
  4. Add __all__ to every module; make ruff's F401/PLC0414 configuration enforce it.
  5. Write docs/api/index.md with the intended public surface: transforms · grids · derivatives/filters · HelmholtzSolver + solve_helmholtz_nd · CapacitanceSolver · spherical/Chebyshev equivalents.

Acceptance criteria

  • Top-level __all__ ≤ 40 names after the deprecation window; every one has an API page (a test walks __all__ and greps docs/api/**/*.md for ::: spectraldiffx.<name>).
  • Deprecated names emit DeprecationWarning with the replacement in the message.
  • mkdocs build --strict passes.
Dominant language
Python
Stars
2
Forks
0
Avg merge
8h 13m
Merged PRs (30d)
8

Getting set up

This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from jejjohnson/spectraldiffx

All issues in jejjohnson/spectraldiffx

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.