Skip to content

chore: modernize build system, add CI/CD, MPS support, and comprehensive tests#6

Merged
fcarli merged 22 commits intodevfrom
restructure
Feb 22, 2026
Merged

chore: modernize build system, add CI/CD, MPS support, and comprehensive tests#6
fcarli merged 22 commits intodevfrom
restructure

Conversation

@fcarli
Copy link
Copy Markdown
Owner

@fcarli fcarli commented Feb 22, 2026

Summary

Build system & tooling

  • Migrate from Poetry/setup.py to uv (uv.lock, pyproject.toml rewrite, remove poetry.lock/setup.py/requirements.txt/MANIFEST.in)
  • Add multi-CUDA version support via uv extras (cu124, cu126, etc.) alongside CPU extra
  • Add Makefile for common dev commands
  • Broaden PyTorch support to >=2.3.1

CI/CD

  • Add GitHub Actions CI: lint + test matrix (3 OS × 3 Python versions) on push/PR to main and dev
  • Add release workflow (tag-triggered PyPI publish via semantic-release)
  • Handle OpenMP env vars to prevent FAISS/PyTorch segfaults in CI

Device support

  • Auto-detect MPS device and handle sparse tensor limitation
  • Replace sparse tensors with searchsorted-based lookups in TorchSparseDataset for full MPS compatibility

Tests

  • Add comprehensive test suite: test_core, test_datasets_covariates, test_datasets_edge, test_models_mlp, test_utils_graph, test_utils_losses
  • Add shared fixtures in conftest.py with OpenMP conflict prevention

Code quality & docs

  • Add pre-commit config, .gitignore overhaul, py.typed marker
  • Add CHANGELOG.md, CONTRIBUTING.md
  • Enhance README with badges, updated install instructions, citation section
  • Fix ruff lint issues and add missing docstrings
  • Update example notebook

Test plan

  • CI lint job passes (ruff check + format)
  • CI test matrix passes across OS/Python combinations
  • MPS device path works on Apple Silicon
  • uv build produces valid wheel
  • Pre-commit hooks install and run cleanly

🤖 Generated with Claude Code

fcarli and others added 5 commits June 27, 2025 10:46
- Add GitHub Actions CI (lint + test matrix across 3 OS × 3 Python versions)
- Add GitHub Actions release workflow (tag-triggered PyPI publish)
- Add pre-commit config (ruff lint/format + standard hooks)
- Add comprehensive .gitignore for Python projects
- Add CHANGELOG.md, CONTRIBUTING.md, and py.typed marker
- Enhance README with badges, fixed URLs, code example fix, citation section
- Add classifiers and project.urls to pyproject.toml
- Fix ruff per-file-ignores path (test/* → tests/*)
- Target semantic-release at main branch instead of restructure
- Add pre-commit to dev dependencies, remove release dependency group
- Remove legacy files: setup.py, requirements.txt, MANIFEST.in, scripts/
- Clean up Makefile: remove release targets, add pre-commit target

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Feb 22, 2026

Note

Currently processing new changes in this PR. This may take a few minutes, please wait...

 _____________________________________________________________________________________________________________
< Hello, it's me. I was wondering if after all these reviews you'd like to meet...to celebrate bug-free code. >
 -------------------------------------------------------------------------------------------------------------
  \
   \   \
        \ /\
        ( )
      .( o ).

✏️ Tip: You can disable in-progress messages and the fortune message in your review settings.

Tip

You can customize the tone of the review comments and chat replies.

Configure the tone_instructions setting to customize the tone of the review comments and chat replies. For example, you can set the tone to Act like a strict teacher, Act like a pirate and more.

✨ Finishing Touches
  • 📝 Generate docstrings (stacked PR)
  • 📝 Generate docstrings (commit on current branch)
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch restructure

Tip

Issue Planner is now in beta. Read the docs and try it out! Share your feedback on Discord.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

fcarli and others added 10 commits February 22, 2026 15:17
Source code fixes:
- Modernize super() call in MLP (UP008)
- Fix unused loop variables (B007)
- Replace assert with ValueError in VariableDataset (S101)
- Use list.extend instead of append loop (PERF401)
- Use list comprehension for adjacency sets (PERF401)
- Remove commented-out code (ERA001)
- Add missing module, package, and method docstrings (D100/D104/D105/D107)

Test fixes:
- Remove unused variables (F841)
- Fix unused loop variables (B007)
- Remove commented-out code (ERA001)
- Fix docstring punctuation (D400/D401/D415)

Ruff config:
- Add targeted ignore list for ML/scientific conventions (N803/N806, FBT, etc.)
- Add per-file ignores for test patterns (S101, SLF001, ARG, etc.)
- All ruff checks now pass

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
CI:
- Set KMP_DUPLICATE_LIB_OK and OMP_NUM_THREADS globally to prevent
  dual-OpenMP crashes between FAISS and PyTorch

Test fixes (test_core.py):
- Fix fitted_pumap fixture to use real model instead of broken mocks
- Fix error match strings ("not fitted" → "must be fitted")
- Fix fit_transform mock assertions to include default kwargs
- Fix load() calls to use classmethod return value
- Fix device handling test to verify directly instead of via mocks

Test fixes (test_datasets_edge.py):
- Fix invalid batch_size test to match actual behavior (no validation)
- Fix adjacency set edge case assertions for correct graph logic

Test fixes (test_utils_graph.py):
- Fix single_point and k_larger_than_dataset tests (FAISS pads with -1)
- Fix invalid k test to expect correct exception types
- Fix convergence test with non-degenerate geometry and relaxed tolerance

Test fixes (test_datasets_covariates.py):
- Update expected exception from AssertionError to ValueError

Result: 191 passed, 0 failed, 12 skipped, 85% coverage

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The swiss_roll_data fixture imports sklearn which is in the examples
optional dependency group.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
… sources

Lower torch floor from >=2.6.0 to >=2.3.1 since no 2.6+-specific APIs are
used. The numpy>=2.2.3 constraint sets the practical floor at 2.3.1. Also
removes unused torchvision source entries from uv config.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Explicitly pass weights_only=True to silence FutureWarning on PyTorch
2.4-2.5 and match the new default in 2.6+. The save dict only contains
safe types (dicts, strings, ints, tensors) so this is safe.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Set KMP_DUPLICATE_LIB_OK and OMP_NUM_THREADS at test startup, matching
the CI environment variables that prevent dual-OpenMP conflicts between
FAISS and PyTorch.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Add optional extras (cpu, cu118, cu121, cu124, cu126, cu128) for
selecting the PyTorch CUDA build on Linux. Non-Linux platforms
automatically get the CPU build via marker. Update CI to use
--extra cpu since runners have no GPUs.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Rewrite install section with GPU acceleration guide and uv CUDA extras
usage. Update Makefile and CLAUDE.md to use explicit extras instead of
--all-extras which conflicts with mutually exclusive CUDA extras.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Remove dependency upper bounds (unnecessary resolver constraints)
- Remove dead [tool.semantic_release] config (release workflow is tag-based)
- Remove pytest defaults that restate built-in values
- Remove HTML/XML coverage reports from default addopts
- Remove blanket filterwarnings suppression

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
uv run re-syncs the environment, which on Linux resolves torch from
PyPI (CUDA-enabled) instead of the CPU index. Using --no-sync skips
the re-sync and uses the already-configured environment from uv sync.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
fcarli and others added 5 commits February 22, 2026 16:32
The torch CPU wheel from download.pytorch.org doesn't declare sympy
as a dependency, unlike the PyPI wheel. Some torch.optim code paths
require sympy at runtime.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Device selection now follows CUDA > MPS > CPU when no explicit device
is passed. MPS does not support sparse tensors, so the probability
matrix stays on CPU and is transferred per-batch (with a warning).
Docs, tests, and example notebook updated accordingly.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…mpatibility

TorchSparseDataset now stores COO data as sorted linear indices and uses
torch.searchsorted for lookups, eliminating sparse tensor usage entirely.
This fixes MPS support without special-casing and simplifies core.py.

Also fixes macOS multiprocessing deadlocks (use spawn context, set OMP
env vars, import FAISS before PyTorch) and adds a single-process fast
path for negative edge sampling.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…ective

Replace en dashes with hyphens in comments and multiplication sign with
asterisk in docstring to satisfy RUF002/RUF003. Remove unused E402 from
noqa directive (RUF100).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Update test assertions to use new internal attributes (_keys, _values,
_n) instead of the removed P_sparse. Adjust OOB tests to expect zero
returns instead of exceptions. Handle empty matrix edge case in
__getitem__.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@fcarli fcarli changed the base branch from main to dev February 22, 2026 18:42
@fcarli fcarli changed the title chore: professionalize repository infrastructure chore: modernize build system, add CI/CD, MPS support, and comprehensive tests Feb 22, 2026
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@fcarli fcarli self-assigned this Feb 22, 2026
@fcarli fcarli added the enhancement New feature or request label Feb 22, 2026
@fcarli fcarli merged commit 1071af6 into dev Feb 22, 2026
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant