# fastdb (WIP)

[![PyPI version](https://badge.fury.io/py/fastdb4py.svg)](https://badge.fury.io/py/fastdb4py)
[![Run Tests](https://github.com/world-in-progress/fastdb/actions/workflows/tests.yml/badge.svg)](https://github.com/world-in-progress/fastdb/actions/workflows/tests.yml)

**Wait and hope for the best...**

A C++ local database library with cross language bindings. Aiming to be a fast, lightweight, and easy-to-use data communication solution for RPC and coupled modeling in scientific computing.

## What's new
- **2026-02-28 (Release Improvement)**: Fix bugs related to build process in Windows. (PR #20)
- **2025-12-31(Bug Fix)**: Fixed an issue where shared memory segments were not being properly unregistered from the resource tracker upon closing, which could lead to resource leaks. (PR #17)
- **2025-12-15 (Release Improvement)**: Enabled distribution of pre-compiled binary wheels for macOS (Intel/Apple Silicon) and Linux (x86_64/aarch64), eliminating the need for local compilation tools during installation. (PR #15)
- **2025-12-10 (Bug Fix)**: Fixed the data type mapping for `U32` fields in Python bindings to ensure correct representation as unsigned 32-bit integers in NumPy arrays. (PR #13)
- **2025-12-10 (Bug Fix)**: Fixed an out-of-bounds access issue in `FastVectorDbLayer::Impl::getFieldOffset()` when the field index is equal to the field count. (PR #12)
- **2025-12-10 (Performance Improvement)**: Modified `ORM.truncate()` to support directly allocating features without initializing them for performance consideration. Note that this change may have side effects; please test thoroughly. (PR #11)

## Installation
You can install the Python package of fastdb via pip:

```bash
pip install fastdb4py
```

**Note:** Pre-compiled binary wheels are provided for major platforms (macOS, Linux). For other systems (including Windows), the package will build from source, requiring a C++ compiler and CMake.

## Development Environment
This project uses DevContainer for development environment. Please refer to the `.devcontainer/devcontainer.example.json` file for configuration details.

For setting up the development environment, ensure you have Docker / Podman and VSCode DevContainer extension installed. Open the project in VSCode and create the `.devcontainer/devcontainer.json` file based on the example provided.

After connecting to the DevContainer, you can develop and test the project within the containerized environment.

### Python-Related Development

The `py_utils.sh` script is provided to facilitate common development tasks related to the Python bindings of fastdb. When first launching the DevContainer, `py_utils.sh` will automatically set up a Python virtual environment and install the necessary dependencies.

#### Cleaning Builds
```bash
# This operation will remove C++ build artifacts and the core Python bindings (fastdb.core, auto-generated by SWIG) within the Python package.
./py_utils.sh --clean
```

#### Building
```bash
# This operation will build the C++ core library and the Python bindings.
./py_utils.sh --build
```

#### Testing
```bash
# This operation will run the Python unit tests for the fastdb package.
./py_utils.sh --test
```
