Contributing¶
We welcome and appreciate all contributions to the curvelets library! Please review the following guidelines before beginning your work.
To communicate with the core developers and maintainers, we request that you open a topic in our GitHub Discussions. Note that as explained in Issue #55, we ask external users and non-contributors to report bugs and request new features strictly via Discussions rather than opening direct issues on GitHub.
Furthermore, before participating, please read and abide by the NUMFOCUS Code of Conduct. We expect all community members to uphold these standards.
Welcomed contributions¶
Bug reports¶
If you encounter unexpected behavior while computing transforms with curvelets, please report the bug via our GitHub Discussion for bug reports.
To help us diagnose and reproduce the problem quickly, please include:
The exact name and version of your operating system.
Detailed details regarding your Python environment and dependencies.
A self-contained, minimal script or step-by-step instructions showing how to reproduce the bug from a clean installation.
New methods and features¶
If you have ideas for new directional transforms, operators, or functional improvements, we invite you to open a GitHub Discussion for new features.
When proposing a new method or feature:
Explain in detail the mathematical rationale and numerical behavior of the proposed method.
Keep the initial implementation scope narrow to ensure that we can review and maintain the code effectively.
Provide a minimal example that shows the intended usage and expected numerical output.
Fix issues¶
We maintain a tracked backlog of validated bugs and planned features in GitHub Issues. Note that these issues represent tasks that maintainers have triaged from community discussions.
We welcome contributors to inspect open issues and submit pull requests targeting our main branch to resolve them.
Add examples or improve documentation¶
Writing new code is only one of many ways to strengthen the library. We highly encourage contributors to develop new gallery examples showing practical applications of existing methods, or to improve the clarity and completeness of our API documentation.
Step-by-step instructions for contributing¶
When you are ready to contribute code or documentation, follow this workflow:
Environment setup with uv
We use
uvas our primary package and environment manager. First, clone the repository and install the package in development mode with all optional dependencies:uv pip install -e .[torch]
Next, install our development and testing dependencies:
uv pip install --group dev
Branch creation
Create a dedicated feature branch starting from our latest
mainbranch:git checkout -b name-of-your-branch main
You can now implement your modifications locally.
Running tests
We use
pytestmanaged vianoxto test across multiple Python environments. You can run the test suite directly using our convenientMakefileshortcut:make test
Note that this command delegates to
uv run nox -s tests. You can also invoke specific sessions explicitly if needed.Running static analysis and linting
We maintain strict standards for code formatting, linting, and static type safety (
ruff,ty,mypy). To verify that your code complies with our standards, run:make lintThis shortcut executes
uv run nox -s lintacross the codebase. Therefore, we strongly recommend runningmake lintbefore submitting your code for review.Updating documentation
If your contribution modifies any API signature or introduces new functionality, please update the documentation and gallery scripts accordingly. To build the HTML documentation locally:
make docThis command runs
uv run nox -s docsand generates our Sphinx documentation gallery indocs/_build/html.Committing your changes
Once you have verified that all tests and linting checks pass, stage and commit your changes:
git add . git commit -m "feat: detailed description of your changes" git push -u origin name-of-your-branch
We recommend following Conventional Commits formatting for all commit messages.
Submitting a pull request
Finally, open a pull request on GitHub comparing your feature branch against our
mainbranch.
Pull request guidelines¶
Before submitting a pull request, verify that your contribution meets the following criteria:
Comprehensive test coverage: Include unit tests verifying both forward and backward numerical precision for all newly added routines.
Documentation synchronization: Ensure that docstrings and gallery tutorials accurately reflect any changes to function arguments or behavior.
Clean verification: Confirm that your branch passes all automated checks by running
make testandmake lintlocally without errors or warnings.
Project structure¶
We organize the curvelets repository into the following functional directories:
src/curvelets: Core Python package containing our Uniform Discrete Curvelet Transform (UDCT) implementations for NumPy and PyTorch.tests: Unit and integration test suites executed viapytest.testdata: Standard reference images and synthetic datasets used across our test assertions and gallery examples.docs: Sphinx configuration, ReStructuredText manuals, and bibliography files (references.bib).examples: Python scripts formatted forsphinx-gallerythat generate our visual tutorials and verification charts.
Development tools¶
We rely on modern, high-performance tooling to maintain our developer workflow:
uv: Fast Python package and virtual environment manager.
nox: Automated task runner managing isolated testing and documentation sessions.
pre-commit: Git hooks enforcing rapid formatting and checks prior to commits.
ruff: High-speed Python linter and code formatter.
ty: Ultra-fast Rust-based static type checker.
mypy: Standard static type checker ensuring structural typing integrity across modules.
pytest: Comprehensive testing framework used for numerical precision and gradient verification.
sphinx: Documentation engine powering our HTML manual and gallery build.
Benchmarking the PyTorch backend¶
Performance work on curvelets.torch is measured, not guessed. The scripts live in benchmarks/ and need a machine with a CUDA GPU for the GPU numbers (the CPU numbers run anywhere):
benchmarks/gpu_bench.pytimes the torchUDCTfor several 2D and 3D sizes, compares the current path against reference variants, counts kernel launches and device-to-host synchronizations withtorch.profiler, reports peak memory, and checks thatUDCTbackpropagates on the device.benchmarks/gpu_check.pyruns the torch test suite first and the benchmark afterwards. It exits with a non-zero status if the tests fail (the benchmark still runs, for diagnosis).
# time the transform and save the raw numbers
python benchmarks/gpu_bench.py --export benchmarks/data/gpu.json
# quicker subset
python benchmarks/gpu_bench.py --quick
# tests + benchmark, e.g. before opening a performance pull request
python benchmarks/gpu_check.py --export benchmarks/data/check.json
Results, the hardware they were measured on, and the prioritized list of follow-ups are recorded in benchmarks/GPU_PERFORMANCE.md; the raw JSON files are kept in benchmarks/data/. When you open a performance pull request, include the before/after numbers from these scripts and say which GPU produced them.
Two further scripts help decide where the time goes and which optimization to try next:
benchmarks/stage_profile.pyreplays the fused execution plan one stage at a time with CUDA events. For each stage it reports the device time, the host time needed to enqueue it, a lower bound on the memory bandwidth reached and the kernel count, and it checks that the replay matches the library output. Use--configs,--batch,--dtypeand--kindto choose the case and--jsonto save the result.benchmarks/compile_experiments.pytimes the library under eager execution, manual CUDA graphs, per-row batch loops and thetorch.compilemodes (--configs,--batch,--modes,--skip).
python benchmarks/stage_profile.py --configs 2d_512,3d_128 --json benchmarks/data/stages.json
python benchmarks/compile_experiments.py --configs 2d_512 --batch 1,8
The RTX 4090 results and the ranked list of follow-ups are in benchmarks/GPU_STAGE_PROFILE.md.
Automated workflows (GitHub Actions)¶
We automate quality assurance, multi-platform testing, and package distribution using GitHub Actions configured in .github/workflows/:
Continuous Integration (
ci.yml): Whenever you push commits or open a pull request, our CI pipeline automatically verifies your changes across a comprehensive build matrix:Code formatting and linting: A dedicated job checks all files against our pre-commit hooks and runs
pylintvianoxto guarantee formatting consistency.Multi-platform and multi-version testing: We run our complete
pytestsuite across Linux (Ubuntu), macOS, and Windows for Python versions3.11through3.15(including free-threaded3.14t/3.15tandPyPy 3.11).Coverage tracking: Test execution generates XML coverage reports that are automatically uploaded and analyzed via Codecov.
Continuous Deployment (
cd.yml): When maintainers publish a new release on GitHub, our CD workflow verifies package integrity usingbuild-and-inspect-python-packageand automatically publishes the built artifacts to PyPI using secure OIDC authentication (pypa/gh-action-pypi-publish).
Therefore, when you submit a pull request, you can monitor these automated workflow checks directly on the GitHub PR page to verify that your branch works seamlessly across all supported environments.