Skip to content

Installation

DS can be installed for TypeScript/JavaScript, Python, or used directly as a C++ library.

TypeScript/JavaScript

The TypeScript/JavaScript package atsds wraps the C++ core via WebAssembly.

1
npm install atsds

The package includes:

  • WebAssembly binaries (.wasm)
  • TypeScript type definitions (.d.mts)
  • ES module support

Requirements

  • Node.js 20+ or a modern browser with WebAssembly support

Browser Usage

The package works in browsers that support WebAssembly:

1
2
3
4
5
6
<script type="module">
  import { Term } from "https://unpkg.com/atsds/dist/index.mjs";

  const term = new Term("(hello world)");
  console.log(term.toString());
</script>

Python

The Python package apyds wraps the C++ core via pybind11.

1
pip install apyds

Requirements

  • Python 3.10-3.14
  • Pre-built wheels are available for common platforms (Linux, macOS, Windows)

It's recommended to use a virtual environment:

1
2
3
python -m venv venv
source venv/bin/activate  # On Windows: venv\Scripts\activate
pip install apyds

Development Installation

To install from source with development dependencies:

1
2
3
git clone https://github.com/USTC-KnowledgeComputingLab/ds.git
cd ds
uv sync --extra dev

C++

The C++ library is the core implementation. Both Python and TypeScript bindings are built on top of it.

Prerequisites

  • C++20 compatible compiler (GCC 10+, Clang 10+, MSVC 2019+)
  • CMake 3.30+

Using vcpkg

Clone the repository and use the overlay port:

1
2
git clone https://github.com/USTC-KnowledgeComputingLab/ds.git
vcpkg install ds --overlay-ports=./ds/ports

Add to your vcpkg.json:

1
2
3
{
  "dependencies": ["ds"]
}

In your CMakeLists.txt:

1
2
find_package(ds CONFIG REQUIRED)
target_link_libraries(your_target PRIVATE ds::ds)

Building from Source

1
2
3
4
git clone https://github.com/USTC-KnowledgeComputingLab/ds.git
cd ds
cmake -B build
cmake --build build

Using in Your Project

Include the headers from include/ds/ in your C++ project:

1
2
#include <ds/ds.hh>
#include <ds/search.hh>

Link against the ds static library produced by the build.

Building All Components

To build all language bindings from source:

TypeScript/JavaScript (requires Emscripten)

1
2
3
4
5
# Install Emscripten SDK first
# https://emscripten.org/docs/getting_started/downloads.html

npm install
npm run build

Python

1
uv sync --extra dev

C++

1
2
cmake -B build
cmake --build build

Running Tests

After installation, you can verify everything works by running the tests:

TypeScript/JavaScript Tests

1
npm test

Python Tests

1
uv run pytest

C++ Tests

1
2
cd build
ctest

Verifying Installation

1
2
3
4
5
import { Term } from "atsds";

const term = new Term("(hello world)");
console.log(term.toString());
// Output: (hello world)
1
2
3
4
5
import apyds
print(f"Version: {apyds.__version__}")

term = apyds.Term("(hello world)")
print(term)  # (hello world)
1
2
3
4
5
6
7
8
9
#include <ds/ds.hh>
#include <ds/utility.hh>
#include <iostream>

int main() {
    auto term = ds::text_to_term("(hello world)", 1000);
    std::cout << ds::term_to_text(term.get(), 1000).get() << std::endl;
    return 0;
}