Skip to content

V0.1.1/fixes and updates - #22

Merged
thanos merged 9 commits into
mainfrom
v0.1.1/fixes-and-updates
Jun 15, 2026
Merged

thanos merged 9 commits into
mainfrom
v0.1.1/fixes-and-updates

Conversation

@thanos

@thanos thanos commented Jun 14, 2026

Copy link
Copy Markdown
Collaborator

Add livebook testing CI workflow and fix livebook issues (#20, #21)

Issue #20: Add :bit shuffle support to blosc2 codec

  • Implement bit_shuffle/bit_unshuffle in Rust NIF using block-based
    bit transposition (8-element blocks, remainder copied as-is)
  • Add BLOSC_BITSHUFFLE constant (2) and dispatch in compress/decompress
  • Add :bit to @valid_shuffles and shuffle_to_int/1 in Elixir
  • Update tests: replace rejection test with acceptance, add round-trip
  • Update README blosc2 options table to include :bit shuffle

Issue #21: Fix errors in livebooks

  • 02_compression_fundamentals.livemd: add {:jason, "~> 1.4"} to
    Mix.install, fix Jason.encode!(%{for...}) → Jason.encode!(for...),
    wrap for-comprehension in map value with parentheses,
    replace Kino.VegaLite.new() with returning VegaLite pipeline
  • 03_codec_comparison.livemd: remove all Kino.VegaLite.new() calls
  • 04_building_storage_systems.livemd: add {:jason, "~> 1.4"} to
    Mix.install, fix Jason.encode!(%{for...}) → Jason.encode!(for...),
    wrap for-comprehensions in map values with parentheses

CI: Add .github/workflows/test_livebooks.yml for livebook_test
on Elixir 1.17.3 / OTP 26.2 (livebook v0.19 is incompatible with
Elixir 1.18+ / OTP 27+). Dependency injected via sed at CI time.

Add livebook_test-issues.md documenting the livebook compilation bug.

thanos added 9 commits June 14, 2026 13:35
Rust NIF (native/ex_codecs_native/src/blosc2_codec.rs):
- Added BLOSC_BITSHUFFLE = 2 constant
- Implemented bit_shuffle and bit_unshuffle functions using block-based bit transposition (blocks of 8 elements, remainder copied as-is)
- Updated blosc2_compress to accept shuffle values 0-2 (was 0-1) and dispatch to bit_shuffle for value 2
- Updated blosc2_decompress to dispatch to bit_unshuffle for value 2
Elixir (lib/ex_codecs/compression/blosc2.ex):
- Added :bit to @valid_shuffles: [:none, :byte, :bit]
- Added shuffle_to_int(:bit) -> 2 mapping
- Updated module docs to document the :bit shuffle option
Tests:
- Updated existing test that rejected :bit to now accept it
- Added round-trip test for bit shuffle with float64 data
- Updated other tests to include :bit in shuffle mode iterations
- All 154 tests pass
Docs: Updated README blosc2 row to include :none / :byte / :bit shuffle options.
1. Added {:jason, "~> 1.4"} to Mix.install
2. Fixed Jason.encode!(%{for ...}) → Jason.encode!(for ...) (removed extra %{})
3. Wrapped for comprehension in map value with parentheses: (for _ <- ..., into: <<>>, do: ...)
4. Replaced Kino.VegaLite.new() with just returning the VegaLite pipeline (Livebook auto-renders)
5. Replaced the broken JSON dataset cell with a clean version using Jason.encode!
03_codec_comparison.livemd:
4. Removed all 4 |> Kino.VegaLite.new() calls (Livebook auto-renders VegaLite pipelines)
04_building_storage_systems.livemd:
1. Added {:jason, "~> 1.4"} to Mix.install
2. Fixed Jason.encode!(%{for ...}) → Jason.encode!(for ...)
3. Wrapped for comprehensions in map values with parentheses
Issue #20: Add :bit shuffle support to blosc2 codec
- Implement bit_shuffle/bit_unshuffle in Rust NIF using block-based
  bit transposition (8-element blocks, remainder copied as-is)
- Add BLOSC_BITSHUFFLE constant (2) and dispatch in compress/decompress
- Add :bit to @valid_shuffles and shuffle_to_int/1 in Elixir
- Update tests: replace rejection test with acceptance, add round-trip
- Update README blosc2 options table to include :bit shuffle

Issue #21: Fix errors in livebooks
- 02_compression_fundamentals.livemd: add {:jason, "~> 1.4"} to
  Mix.install, fix Jason.encode!(%{for...}) → Jason.encode!(for...),
  wrap for-comprehension in map value with parentheses,
  replace Kino.VegaLite.new() with returning VegaLite pipeline
- 03_codec_comparison.livemd: remove all Kino.VegaLite.new() calls
- 04_building_storage_systems.livemd: add {:jason, "~> 1.4"} to
  Mix.install, fix Jason.encode!(%{for...}) → Jason.encode!(for...),
  wrap for-comprehensions in map values with parentheses

CI: Add .github/workflows/test_livebooks.yml for livebook_test
on Elixir 1.17.3 / OTP 26.2 (livebook v0.19 is incompatible with
Elixir 1.18+ / OTP 27+). Dependency injected via sed at CI time.

Add livebook_test-issues.md documenting the livebook compilation bug.
…ey should be in the lockfile for reproducibility even though they're only compiled in the :livebook env. This is normal Elixir convention.

Here's the summary of changes:
mix.exs:
- Added {:livebook_test, "~> 0.1.0", only: :livebook, runtime: false} to deps
- Added "livebook.test": :livebook to preferred_cli_env
config/livebook.exs: (new)
- Configures livebook_test paths, dependency mode, and timeout
.github/workflows/test_livebooks.yml:
- Removed the sed hack
- All steps now use MIX_ENV: livebook
- Runs on Elixir 1.17.3 / OTP 26.2 where livebook compiles
mix.lock:
- Includes livebook + livebook_test lock entries (needed for reproducibility)
livebook_test-issues.md:
- Updated to document the :livebook env approach
…ivebook ~> 0.19 requirement of Elixir ~> 1.18 while staying on OTP 26.2 (which avoids the put_in nil error that occurs on OTP 27+).
…vebook testing works — the remaining failures are in the livebook content itself (Kino-specific cells, multi-cell module definitions, Mix.install). These are separate content issues from the original issue #19, #20, #21 fixes.

The key changes for this issue are:
- .github/workflows/test_livebooks.yml: Uses Elixir 1.18.4/OTP 26.2 with MIX_ENV=livebook
- mix.exs: livebook_test dep with only: :livebook, preferred_cli_env entry
- config/config.exs: Loads livebook.exs for the :livebook env with rustler_precompiled force_build
- config/livebook.exs: Full livebook config needed for compilation + livebook_test settings
…xs exists:

- Local dev (path: dep exists): uses path: dep + rustler + force_build
- Published (no local repo): uses {:ex_codecs, "~> 0.1"} from Hex with pre-compiled NIFs, no rustler needed
@thanos
thanos merged commit 0644c0b into main Jun 15, 2026
6 checks passed
thanos added a commit that referenced this pull request Jun 15, 2026
Merge pull request #22 from thanos/v0.1.1/fixes-and-updates
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant