Skip to content

Make CLI independent of DataLad, bundle git-annex binaries #22

Closed

Description

@neuromechanist

Summary

Make the NEMAR CLI truly standalone by removing the DataLad dependency and potentially bundling git-annex binaries.

Background

Currently, the CLI requires DataLad to be installed externally. Analysis shows that we only use 4 DataLad commands, all of which can be replaced with direct git-annex operations:

DataLad Command Purpose Replacement
datalad create Initialize repo git init + git annex init
datalad save Stage + commit git add + git annex add + git commit
datalad push Push to remote git push + git annex copy --to
datalad siblings add Configure remotes git remote add + git annex initremote

Proposed Approach

Phase 1: Replace DataLad with direct git-annex

  • Refactor src/lib/datalad.ts to use git-annex directly
  • Maintain the same API for consuming code
  • Still require external git-annex installation

Phase 2: Bundle git-annex binaries

  • Explore packaging pre-built git-annex binaries for major platforms:
    • macOS (x64, arm64)
    • Linux (x64)
    • Windows (x64)
  • Look at how other tools handle this (e.g., isomorphic-git approach)
  • Consider lazy download of binaries on first use

Phase 3: Alternative - Pure JavaScript

  • Investigate if git-annex operations can be replicated in JS
  • OpenNeuro CLI uses isomorphic-git for git operations
  • May not be feasible for all git-annex features

Benefits

  • Users don't need to install external dependencies
  • Simpler onboarding experience
  • More reliable CI/CD integration
  • Better cross-platform support

Considerations

  • Binary size for bundled git-annex (~50MB per platform)
  • License compatibility (git-annex is GPL)
  • Maintenance burden for binary updates
  • Platform-specific issues

Related

Activity

  1. neuromechanist commented on Jan 21, 2026

    @neuromechanist
    ContributorAuthor

    Research: DataLad Compatibility with Pure git-annex Repos

    Question: If we move to git-annex only (removing DataLad dependency), can users still pull data with DataLad?

    Answer: Yes, DataLad users can still pull data from pure git-annex repos.

    How it works

    DataLad is built on top of git-annex, so compatibility goes both ways:

    User has Clone command Get files
    DataLad datalad clone <url> datalad get <files>
    git-annex only git clone <url> git-annex get <files>
    Both Either works Either works

    Key findings from documentation

    1. datalad clone auto-initializes annex - When cloning any git repo (including pure git-annex repos), DataLad automatically sets up the annex. From the DataLad clone docs: "pure Git repositories are equally supported."

    2. OpenNeuro proves this works - Their datasets are git-annex repos that users access via both datalad get and git-annex get. From OpenNeuro Git docs: "The underlying format for datasets is a git-annex repo... To download the annexed objects, use DataLad or git-annex."

    3. The .datalad/ directory is optional - It contains DataLad-specific metadata (like dataset ID), but is not required for data retrieval. A pure git-annex repo has all the information needed for annex operations.

    What NEMAR would need to ensure

    For DataLad users to seamlessly access NEMAR datasets:

    1. S3 special remote must be configured - The repo needs git annex initremote set up so clones know where to fetch data
    2. Push the git-annex branch - So clones can see remote configurations
    3. Public S3 bucket or registered URLs - Either configure the S3 remote for public access, or use git annex addurl to register public URLs

    What we lose (acceptable tradeoffs)

    • DataLad dataset ID (used for tracking lineage)
    • datalad run provenance tracking
    • Nested subdataset management

    None of these affect basic data download workflows.

    Conclusion

    Moving to pure git-annex is safe for data consumers. This unblocks Phase 1 of the proposal.

  2. added a commit that references this issue on Jan 21, 2026
    c8da5b4
  3. added a commit that references this issue on Jan 21, 2026
    852761a
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions