polars-umap 0.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (34) hide show
  1. polars_umap-0.1.0/.gitignore +25 -0
  2. polars_umap-0.1.0/CHANGELOG.md +16 -0
  3. polars_umap-0.1.0/CONTRIBUTING.md +81 -0
  4. polars_umap-0.1.0/Cargo.lock +4338 -0
  5. polars_umap-0.1.0/Cargo.toml +47 -0
  6. polars_umap-0.1.0/LICENSE +21 -0
  7. polars_umap-0.1.0/NOTICE +17 -0
  8. polars_umap-0.1.0/PKG-INFO +141 -0
  9. polars_umap-0.1.0/README.md +116 -0
  10. polars_umap-0.1.0/pyproject.toml +123 -0
  11. polars_umap-0.1.0/python/polars_umap/__init__.py +36 -0
  12. polars_umap-0.1.0/python/polars_umap/_functions.py +404 -0
  13. polars_umap-0.1.0/python/polars_umap/_internal.pyi +1 -0
  14. polars_umap-0.1.0/python/polars_umap/_namespace.py +126 -0
  15. polars_umap-0.1.0/python/polars_umap/_typing.py +45 -0
  16. polars_umap-0.1.0/python/polars_umap/_utils.py +72 -0
  17. polars_umap-0.1.0/python/polars_umap/py.typed +0 -0
  18. polars_umap-0.1.0/rust-toolchain.toml +3 -0
  19. polars_umap-0.1.0/src/convert.rs +491 -0
  20. polars_umap-0.1.0/src/expressions.rs +542 -0
  21. polars_umap-0.1.0/src/lib.rs +10 -0
  22. polars_umap-0.1.0/tests/_helpers.py +20 -0
  23. polars_umap-0.1.0/tests/conftest.py +39 -0
  24. polars_umap-0.1.0/tests/test_basic.py +150 -0
  25. polars_umap-0.1.0/tests/test_errors.py +110 -0
  26. polars_umap-0.1.0/tests/test_gpu.py +31 -0
  27. polars_umap-0.1.0/tests/test_groups.py +62 -0
  28. polars_umap-0.1.0/tests/test_knn.py +120 -0
  29. polars_umap-0.1.0/tests/test_nulls.py +80 -0
  30. polars_umap-0.1.0/tests/test_params.py +126 -0
  31. polars_umap-0.1.0/tests/test_parity.py +29 -0
  32. polars_umap-0.1.0/tests/test_properties.py +50 -0
  33. polars_umap-0.1.0/tests/test_quality.py +73 -0
  34. polars_umap-0.1.0/tests/test_reproducibility.py +52 -0
@@ -0,0 +1,25 @@
1
+ __marimo__/
2
+ __pycache__/
3
+ _great_docs_build/
4
+ .benchmarks/
5
+ .DS_Store
6
+ .great-docs-build/
7
+ .great-docs-cache/
8
+ .great-docs/
9
+ .hypothesis/
10
+ .mypy_cache/
11
+ .pytest_cache/
12
+ .ruff_cache/
13
+ .venv/
14
+ *.dylib
15
+ *.egg-info/
16
+ *.py[cod]
17
+ *.pyd
18
+ *.so
19
+ /target
20
+ assets/notebooks/
21
+ benchmarks/data/
22
+ benchmarks/results/raw/
23
+ dist/
24
+ great-docs/
25
+ site/
@@ -0,0 +1,16 @@
1
+ # Changelog
2
+
3
+ ## 0.1.0 (2026-11-20)
4
+
5
+ First release.
6
+
7
+ - `umap()` expression and the `pl.Expr.umap.fit_transform()` namespace method. They take an
8
+ `Array`/`List` embedding column or several numeric columns and return `Array(Float32, k)`.
9
+ - `df.umap.fit_transform()` / `lf.umap.fit_transform()`, which add `umap_0…` columns or one Array
10
+ column.
11
+ - `knn()` / `.umap.knn()`: approximate nearest neighbors (NNDescent).
12
+ - `umap_from_knn()` / `.umap.from_knn()`: UMAP on a precomputed kNN graph.
13
+ - The umap-learn 0.6 pipeline is the default (deterministic). `layout="0.5"` gives the classic one.
14
+ - Support for `null_policy`, custom initial embeddings, `n_threads` and `gpu=True` (wgpu).
15
+ - Python ≥ 3.9, Polars ≥ 1.0.
16
+ - Built on apple/embedding-atlas @ `a0d0f09`.
@@ -0,0 +1,81 @@
1
+ # Contributing to polars-umap
2
+
3
+ Thanks for your interest! Bug reports, ideas and pull requests are welcome on
4
+ [GitHub](https://github.com/jeroenjanssens/polars-umap).
5
+
6
+ ## Setup
7
+
8
+ You need [uv](https://docs.astral.sh/uv/) and a stable [Rust toolchain](https://rustup.rs).
9
+
10
+ ```bash
11
+ git clone https://github.com/jeroenjanssens/polars-umap
12
+ cd polars-umap
13
+ uv sync # creates .venv and builds the extension
14
+ uv run maturin develop --uv --profile dev-release # faster rebuilds while developing
15
+ ```
16
+
17
+ `uv sync` builds in release mode (fat LTO), which takes a few minutes. While you iterate on the
18
+ Rust code, `maturin develop --profile dev-release` is much faster.
19
+
20
+ ## Tests and linting
21
+
22
+ ```bash
23
+ uv run pytest -n auto # Python tests
24
+ uv run --group parity pytest -m parity # compare with umap-learn
25
+ uv run pytest -m "slow or gpu" # larger and GPU tests
26
+ uv run pytest --doctest-modules python/polars_umap
27
+ cargo test --lib # Rust tests
28
+
29
+ uv run ruff check . && uv run ruff format --check . && uv run mypy
30
+ cargo fmt --check && cargo clippy --all-targets -- -D warnings
31
+ ```
32
+
33
+ CI runs all of these, and also tests the oldest supported Python and Polars versions.
34
+
35
+ ## Benchmarks
36
+
37
+ ```bash
38
+ uv run --group bench python benchmarks/run.py --quick # smoke run
39
+ uv run --group bench python benchmarks/report.py # regenerate the benchmarks page
40
+ ```
41
+
42
+ See `user_guide/benchmarks.qmd` for the full methodology and the command that produced the
43
+ published results.
44
+
45
+ ## Documentation
46
+
47
+ The site is built with [Great Docs](https://posit-dev.github.io/great-docs/) and
48
+ [Quarto](https://quarto.org), which you need to install separately.
49
+
50
+ ```bash
51
+ bash scripts/export_notebook.sh # export the marimo notebook to WebAssembly
52
+ QUARTO_PYTHON=.venv/bin/python uv run --group docs great-docs build
53
+ uv run --group docs great-docs preview
54
+ ```
55
+
56
+ - The configuration is in `great-docs.yml`.
57
+ - User guide pages live in `user_guide/`, examples in `gallery/`, and the marimo notebook in
58
+ `notebooks/`.
59
+ - The API reference is generated from the docstrings, which use the numpy style.
60
+ - Pages with Python code are executed during the build. Their outputs are cached in `_freeze/`,
61
+ which is committed, so CI doesn't need to build the Rust extension. After changing a page,
62
+ rebuild locally and commit the updated `_freeze/`.
63
+ - The marimo notebook can't run polars-umap in the browser. When you change the parameter grid,
64
+ regenerate its data with `uv run python scripts/precompute_notebook_data.py`.
65
+
66
+ ## Updating the upstream UMAP implementation
67
+
68
+ The `umap` and `nndescent` crates come from
69
+ [apple/embedding-atlas](https://github.com/apple/embedding-atlas), pinned to a commit in
70
+ `Cargo.toml`. To move to the latest commit and run all checks:
71
+
72
+ ```bash
73
+ scripts/bump_upstream.sh
74
+ ```
75
+
76
+ ## Releasing
77
+
78
+ 1. Update the version in `Cargo.toml` and add an entry to `CHANGELOG.md`.
79
+ 2. Commit, then tag and push: `git tag v0.2.0 && git push origin v0.2.0`.
80
+ 3. The release workflow builds the wheels, publishes them to PyPI through trusted publishing,
81
+ checks that the published package installs, and creates a GitHub release.