Skip to content

no-std Step 8 — Set ndarray dependency to default-features = false #421

Description

@Mec-iS

Part of #413feat: no-std feature flag for embedded/edge targets

Task

The ndarray dependency (0.17, optional, ndarray-bindings feature) currently inherits its default features, which include std. ndarray 0.17 natively supports no_std + alloc.

Change Required

In Cargo.toml, update the ndarray dep entry:

# Before
ndarray = { version = "0.17", optional = true }

# After
ndarray = { version = "0.17", optional = true, default-features = false, features = ["std"] }

Then, in the no_std path (i.e. when std feature is disabled), the ndarray-bindings feature should not pull ndarray/std:

[features]
ndarray-bindings = ["dep:ndarray"]    # drop ndarray/std from this line
std = ["ndarray/std", ...]            # let std feature re-enable it

Acceptance

  • cargo check --no-default-features --features ndarray-bindings compiles without pulling std from ndarray
  • cargo build --features "default,ndarray-bindings" (with std) compiles and all ndarray-backed tests pass
  • No std-only ndarray API (e.g. ndarray::Array::from_file) is used anywhere in smartcore's ndarray-bindings code path

Estimated effort

~30 min. One Cargo.toml line change + verification that no std-only ndarray surface is used.

Dependencies

Independent — can be done in parallel with Steps 1, 3, 4, 7.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions