Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions .github/workflows/_release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
on:
workflow_call:

jobs:
artifacts:
runs-on: ubuntu-latest

steps:
- name: Download artifacts
uses: actions/download-artifact@v4
with:
merge-multiple: true

- name: Create GitHub Release
uses: softprops/action-gh-release@v2
with:
files: |
*.whl
*.tar.gz
generate_release_notes: true
21 changes: 8 additions & 13 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,6 @@ jobs:
runs-on: ${{ matrix.runs-on }}
python-version: ${{ matrix.python-version }}

# docs:
# uses: ./.github/workflows/_docs.yml
# permissions:
# contents: write

dist:
uses: ./.github/workflows/_dist.yml

Expand All @@ -45,12 +40,12 @@ jobs:
permissions:
id-token: write

# codeql:
# uses: ./.github/workflows/_codeql.yml
codeql:
uses: ./.github/workflows/_codeql.yml

# release:
# needs: [dist, test, docs]
# if: github.ref_type == 'tag'
# uses: ./.github/workflows/_release.yml
# permissions:
# contents: write
release:
needs: [dist, test]
if: github.ref_type == 'tag'
uses: ./.github/workflows/_release.yml
permissions:
contents: write
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ repos:
hooks:
- id: prettier
types_or: [yaml, markdown, html, css, scss, javascript, json]
args: [--prose-wrap=always]
args: [--prose-wrap=preserve]

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: "v0.15.2"
Expand Down
25 changes: 15 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
[![CI](https://github.lightsource.ca/daq/kv-dict/actions/workflows/ci.yml/badge.svg)](https://github.lightsource.ca/daq/kv-dict/actions/workflows/ci.yml)
[![CI](https://github.com/Canadian-Light-Source/kv-dict/actions/workflows/ci.yml/badge.svg)](https://github.com/Canadian-Light-Source/kv-dict/actions/workflows/ci.yml)

# kv-dict

KV backed dictionary, similar to RedisJSONDict

## Install Package

- pip: `pip install git+https://github.lightsource.ca/daq/kv-dict`
- uv: `uv add git+https://github.lightsource.ca/daq/kv-dict`
- pip: `pip install kv-dict`
- uv: `uv add kv-dict`
- add `--optional FEATURE` to add as an optional dependency
- pixi: `pixi add --git https://github.lightsource.ca/daq/kv-dict`
- pixi: `pixi add --pypi kv-dict`
- add `--feature FEATURE` to add as an optional dependency

## Development
Expand All @@ -19,7 +19,7 @@ instructions may be found
[here](https://docs.astral.sh/uv/getting-started/installation/).

```bash
git clone https://github.lightsource.ca/daq/kv-dict.git
git clone https://github.com/Canadian-Light-Source/kv-dict.git
cd kv-dict
uv sync --all-extras
```
Expand All @@ -40,7 +40,8 @@ Run a basic `RemoteKVMapping` flow backed by a Redis-compatible server:
uv run python examples/remote_mapping_redis_example.py
```

> [!NOTE] In the devcontainer compose setup, the Redis-compatible service
> [!NOTE]
> In the devcontainer compose setup, the Redis-compatible service
> hostname is `redis`.

## Remote Mapping + PostgreSQL Backend Example
Expand All @@ -51,7 +52,8 @@ Run a basic `RemoteKVMapping` flow backed by PostgreSQL:
uv run python examples/remote_mapping_postgres_example.py
```

> [!NOTE] In the devcontainer compose setup, PostgreSQL is available on the
> [!NOTE]
> In the devcontainer compose setup, PostgreSQL is available on the
> internal hostname/port `postgres:5432`.

## Remote Mapping + NATS JetStream KV Backend Example
Expand All @@ -62,10 +64,12 @@ Run a basic `RemoteKVMapping` flow backed by NATS JetStream KV:
uv run python examples/remote_mapping_nats_example.py
```

> [!IMPORTANT] This example uses `create_bucket=False` (production-style).
> [!IMPORTANT]
> This example uses `create_bucket=False` (production-style).
> Ensure the `kv_dict` bucket already exists.

> [!NOTE] In the devcontainer compose setup, NATS is also available to host-side
> [!NOTE]
> In the devcontainer compose setup, NATS is also available to host-side
> tools at `nats://127.0.0.1:14222`.

Watch the changes in the NATS KV with the CLI client:
Expand Down Expand Up @@ -124,7 +128,8 @@ replacement of the built-in `dict` behavior.

### Practical guidance

> [!WARNING] `RemoteKVMapping` is backend-backed, not purely in-memory. Avoid
> [!WARNING]
> `RemoteKVMapping` is backend-backed, not purely in-memory. Avoid
> relying on insertion-order behavior and reassignment-free updates for mutable
> non-list, non-dict nested values.

Expand Down