Skip to main content

allium-sekai-deck

Precompiled Python bindings for the Allium Sekai deck recommendation engine. The package includes the Rust card-pool, rule evaluation, and DFS search logic, so users do not need Rust, Cargo, or a local compiler.

It provides two Python interfaces:

  • allium_deck: a compact API for new integrations.
  • sekai_deck_recommend_cpp: the object and import surface used by LunaBot's C++ deck recommendation integration.

Installation

pip install allium-sekai-deck

Precompiled abi3 wheels support CPython 3.10 and newer on:

  • Linux x86_64 and aarch64
  • Windows x86_64
  • macOS x86_64 and Apple Silicon

Imports

from allium_deck import Engine, RecommendOptions, RecommendResult, UserData

Existing LunaBot integrations can keep their current namespace:

from sekai_deck_recommend_cpp import (
    DeckRecommendOptions,
    DeckRecommendUserData,
    SekaiDeckRecommend,
)

Masterdata, music metadata, and user data remain runtime inputs and are not bundled into the wheel. The recommendation engine uses Allium's DFS search.

Version 0.0.5 tracks allium-deck 0.0.8, including the optimized pool construction path, explicit AVX-512 dispatch on supported x86-64 CPUs, and portable scalar fallbacks for other targets. 0.0.8 also reads masterdata that ships cardParameters as the game's original per-level rows, in addition to the grouped per-parameter arrays. Performance depends on the CPU, account data, activity rules, and candidate pool shape.

API coverage

The sekai_deck_recommend_cpp interface includes the complete LunaBot deck workflow:

  • mutable option, user-data, card, deck, support-deck, and result objects
  • single and batch recommendation
  • World Bloom support-deck calculation
  • area-item upgrade recommendation
  • per-music score and event-point calculation
  • note-level exact live calculation
  • configurable batch worker count

Each recommendation result includes cost_ms, the wall-clock time spent in the native search itself. Batch results report this value independently for every request.

Pool reuse

A recommend call spends most of its time building the candidate pool and only a small fraction searching it. When the same user, masterdata and options are queried repeatedly, build the pool once and search it many times:

pool = engine.build_pool(options)
result = pool.recommend()          # search only
top5 = pool.recommend(limit=5)     # limit and timeout_ms may be overridden
print(pool.card_count)             # candidates in the pool

Measured on one dataset (672-card account, multi / score, 194 candidates): engine.recommend() 4549 us versus pool.recommend() 448 us at the median, about 10x, saving roughly 4.1 ms per call. Both paths return identical decks.

What a pool is bound to

A pool captures the user data, the masterdata and the options it was built from. It does not observe later changes to any of them, so reusing a stale pool silently returns results computed from outdated inputs. Rebuild when:

Change Effect
update_masterdata / update_musicmetas every pool for that region is stale
the user's cards change (new cards, levels, master ranks) that user's pools are stale
any option other than limit / timeout_ms needs its own pool

limit and timeout_ms affect only the search stage and can be passed per call.

Memory

A pool holds its candidate set, search context and resolved card details until it is released. Measured per pool:

Account cards Candidates Per pool
672 141-194 221-257 KB
1249 156-260 391-465 KB

Roughly 0.2-0.5 MB each, so keeping 100 pools costs about 22-47 MB.

Caller-owned cache

No pool cache is built in: the right bound and the right invalidation depend on the caller, and pools cost memory that the library should not claim on its own. A bounded LRU is a few lines:

from collections import OrderedDict


class PoolCache:
    def __init__(self, engine, max_pools=64):
        self._engine = engine
        self._max = max_pools
        self._pools = OrderedDict()

    def recommend(self, key, options, limit=None):
        pool = self._pools.pop(key, None)
        if pool is None:
            pool = self._engine.build_pool(options)
        self._pools[key] = pool                 # newest last
        while len(self._pools) > self._max:
            self._pools.popitem(last=False)     # evict oldest
        return pool.recommend(limit=limit)

    def drop_user(self, user_id):
        for key in [k for k in self._pools if k[0] == user_id]:
            del self._pools[key]

    def clear(self):
        self._pools.clear()

key must cover everything the pool is bound to; a workable one is (user_id, user_data_revision, options_fingerprint). Call drop_user when that user's cards change and clear after reloading masterdata.

License

MIT

Release files for allium-sekai-deck 0.0.5

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Built distributions (wheels)

Table of built distributions (wheels) for allium-sekai-deck 0.0.5
File
allium_sekai_deck-0.0.5-cp310-abi3-win_amd64.whl CPython 3.10 abi3 Windows x86-64 Details
allium_sekai_deck-0.0.5-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl CPython 3.10 abi3 Linux glibc 2.17+ x86-64 Details
allium_sekai_deck-0.0.5-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl CPython 3.10 abi3 Linux glibc 2.17+ ARM64 Details
allium_sekai_deck-0.0.5-cp310-abi3-macosx_11_0_arm64.whl CPython 3.10 abi3 macOS 11.0+ ARM64 Details
allium_sekai_deck-0.0.5-cp310-abi3-macosx_10_12_x86_64.whl CPython 3.10 abi3 macOS 10.12+ x86-64 Details

Total release size: 5.8 MB

Release files / allium_sekai_deck-0.0.5-cp310-abi3-win_amd64.whl

Download URL allium_sekai_deck-0.0.5-cp310-abi3-win_amd64.whl
Size 1.1 MB
Tags CPython 3.10 Windows x86-64 abi3
SHA-256 checksum
How to use checksums
078504ea0f2064b7955340917bce936be61d18eadd01795bc635602d40bc9121
BLAKE2b-256 checksum
How to use checksums
41b7a35482995ed70e3a50d1652df93199600976050c86fc4a61c9f3d0893c4e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.13

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 29, 2026.

Transparency log

Release files / allium_sekai_deck-0.0.5-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL allium_sekai_deck-0.0.5-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 1.1 MB
Tags CPython 3.10 Linux glibc 2.17+ x86-64 abi3
SHA-256 checksum
How to use checksums
e1fec433bcf3e0c55bcaebb3d88e2b9e7f94deeffb9c549fb37f18b6bf335518
BLAKE2b-256 checksum
How to use checksums
c648d14b2a1cce54c96115c62efbc33e51d4732333a1fe8a71e775ba4d1519e2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.13

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 29, 2026.

Transparency log

Release files / allium_sekai_deck-0.0.5-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl

Download URL allium_sekai_deck-0.0.5-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Size 1.2 MB
Tags CPython 3.10 Linux glibc 2.17+ ARM64 abi3
SHA-256 checksum
How to use checksums
5bd2f84c294e404e5f3e13a59d60bed66253c3feda0aba74d76e6ea821ef409f
BLAKE2b-256 checksum
How to use checksums
03461fc7b7e249120ccec45a0b085986f387892c561463c862dd0041f5c1da4e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.13

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 29, 2026.

Transparency log

Release files / allium_sekai_deck-0.0.5-cp310-abi3-macosx_11_0_arm64.whl

Download URL allium_sekai_deck-0.0.5-cp310-abi3-macosx_11_0_arm64.whl
Size 1.2 MB
Tags CPython 3.10 abi3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
f9d396f616c4028ba87ff5c70e5ebddd27b6d0e7ab98b639e6a3c784e1bcbb61
BLAKE2b-256 checksum
How to use checksums
e39b6b93fa50f1da7d556e30e2a09e065efbd743f75090e0d729f2a9c51d30b7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.13

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 29, 2026.

Transparency log

Release files / allium_sekai_deck-0.0.5-cp310-abi3-macosx_10_12_x86_64.whl

Download URL allium_sekai_deck-0.0.5-cp310-abi3-macosx_10_12_x86_64.whl
Size 1.1 MB
Tags CPython 3.10 abi3 macOS 10.12+ x86-64
SHA-256 checksum
How to use checksums
4d8000b555d6a465a4b0c4b2392ecd1e12d7103cf4586b4b60d1741af84a2f3b
BLAKE2b-256 checksum
How to use checksums
b978aa988ea35820e6de979ce9375c596de6da7fb9ced78a23f712cae694fe07
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.13

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 29, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.0.5 This release

5 release files

0.0.3

5 release files

0.0.2

5 release files

0.0.1

5 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page