{"id":18818440,"url":"https://github.com/smithsonian/smax-python","last_synced_at":"2026-01-15T18:30:15.592Z","repository":{"id":248594424,"uuid":"200275413","full_name":"Smithsonian/smax-python","owner":"Smithsonian","description":"Client side python library for communicating with SMA-X (aka Redis).","archived":false,"fork":false,"pushed_at":"2024-11-18T18:13:31.000Z","size":3309,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":11,"default_branch":"main","last_synced_at":"2024-12-30T02:43:18.859Z","etag":null,"topics":["data-exchange","python","python-3","python-library","python3","realtime-database","sma-x","structured-data"],"latest_commit_sha":null,"homepage":"https://smithsonian.github.io/smax-python/","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"unlicense","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Smithsonian.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-08-02T17:45:29.000Z","updated_at":"2024-11-18T18:13:28.000Z","dependencies_parsed_at":"2024-07-16T01:22:42.457Z","dependency_job_id":"784a125b-792b-40af-a569-0c94c3b114a0","html_url":"https://github.com/Smithsonian/smax-python","commit_stats":null,"previous_names":["smithsonian/smax-python"],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Smithsonian%2Fsmax-python","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Smithsonian%2Fsmax-python/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Smithsonian%2Fsmax-python/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Smithsonian%2Fsmax-python/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Smithsonian","download_url":"https://codeload.github.com/Smithsonian/smax-python/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":239753733,"owners_count":19691162,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["data-exchange","python","python-3","python-library","python3","realtime-database","sma-x","structured-data"],"created_at":"2024-11-08T00:16:46.564Z","updated_at":"2026-01-15T18:30:15.517Z","avatar_url":"https://github.com/Smithsonian.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![Unit tests](https://github.com/Smithsonian/sma-python-redis-client/actions/workflows/test.yml/badge.svg)](https://github.com/Smithsonian/sma-python-redis-client/actions/workflows/test.yml)\n[![API Documentation](https://github.com/Smithsonian/sma-python-redis-client/actions/workflows/docs.yml/badge.svg)](https://github.com/Smithsonian/sma-python-redis-client/actions/workflows/docs.yml)\n[![codecov](https://codecov.io/gh/Smithsonian/smax-python/graph/badge.svg?token=BTEFMR9W4F)](https://codecov.io/gh/Smithsonian/smax-python)\n\n\u003cpicture\u003e\n  \u003csource srcset=\"resources/CfA-logo-dark.png\" alt=\"CfA logo\" media=\"(prefers-color-scheme: dark)\"/\u003e\n  \u003csource srcset=\"resources/CfA-logo.png\" alt=\"CfA logo\" media=\"(prefers-color-scheme: light)\"/\u003e\n  \u003cimg src=\"resources/CfA-logo.png\" alt=\"CfA logo\" width=\"400\" height=\"67\" align=\"right\"/\u003e\n\u003c/picture\u003e\n\u003cbr clear=\"all\"\u003e\n\n# SMAX for Python \n\nClient side python library for the [SMA Exchange (SMA-X)](https://docs.google.com/document/d/1eYbWDClKkV7JnJxv4MxuNBNV47dFXuUWu7C4Ve_YTf0/edit?usp=sharing) realtime structured database.\n\nVersion 1.0.3\n\n- [API Documentation](https://smithsonian.github.io/smax-python/)\n \n\n## Table of Contents\n\n - [Introduction](#introduction)\n - [Installing](#installing)\n - [Examples](#examples)\n\n\u003ca name=\"introduction\"\u003e\u003c/a\u003e\n## Introduction\n\nThe [SMA Exchange (SMA-X)](https://docs.google.com/document/d/1eYbWDClKkV7JnJxv4MxuNBNV47dFXuUWu7C4Ve_YTf0/edit?usp=sharing) \nis a high performance and versatile real-time data sharing platform for distributed software systems. It is built \naround a central Redis database, and provides atomic access to structured data, including specific branches and/or \nleaf nodes, with associated metadata. SMA-X was developed at the Submillimeter Array (SMA) observatory, where we use \nit to share real-time data among hundreds of computers and nearly a thousand individual programs.\n\nSMA-X consists of a set of server-side [LUA](https://lua.org/) scripts that run on [Redis](https://redis.io) (or one \nof its forks / clones such as [Valkey](https://valkey.io) or [Dragonfly](https://dragonfly.io)); a set of libraries to \ninterface client applications; and a set of command-line tools built with them. Currently we provide client libraries \nfor Python 3 and C/C++ (C99). This repository contains the Python 3 client libraries for SMA-X.\n\nThere are no official releases of __smax-python__ yet. An initial 1.0.0 release is expected early/mid 2025. \nBefore then the API may undergo slight changes and tweaks. Use the repository as is at your own risk for now.\n\n### Related links\n\n - [SMA-X specification](https://docs.google.com/document/d/1eYbWDClKkV7JnJxv4MxuNBNV47dFXuUWu7C4Ve_YTf0/edit?usp=sharing)\n - [Smithsonian/smax-clib](https://github.com/Smithsonian/smax-clib) an alternative library for C/C++ (C99).\n - [Smithsonian/smax-postgres](https://github.com/Smithsonian/smax-postgres) for creating a time-series history of \n   SMA-X in a __PostgreSQL__ database.\n\n\n\u003ca name=\"introduction\"\u003e\u003c/a\u003e\n## Installing\nThere is a proper python package in this repo named \"smax\".  You can use pip to install\ndirectly from the repo, which is useful if you just need to import the library for your\nown application. For development of this package, clone the repo and install with the \neditable flag. \n\n### Install with pip directly from github\n```bash\npip install git+ssh://git@github.com/Smithsonian/smax-python.git\n```\n### Upgrade with pip directly from github\n```bash\npip install git+ssh://git@github.com/Smithsonian/smax-python.git -U\n```\n\n### Clone repo and install in editable mode\n```bash\ngit clone git@github.com:Smithsonian/smax-python.git\ncd smax-python\npip install . -e\n```\n\n### Set up redis server for local SMAX testing and development\n* Install Redis or Valkey or equivalent, e.g.:\n  * Using [Conda](https://anaconda.org/conda-forge/redis-server)\n  * For [Raspberry pi](https://redis.io/topics/ARM)\n  * [From source](https://redis.io/topics/quickstart)\n* Set up the SMA-X server on top of Redis\n  1. Clone [Smithsonian/smax-server](https://github.com/Smithsonian/smax-server)\n  2. In `smax-server`: edit `redis.conf` files as necessary or desired for your application.\n  3. In `smax-server`: run `sudo install.sh`.\n* Clone this repo ([Smithsonian/smax-python](https://github.com/Smithsonian/smax-python)) locally\n\nThat's it, you now have SMAX running locally.\n\n\n\u003ca name=\"examples\"\u003e\u003c/a\u003e\n## Examples\n\nThe best place to find example usages is the unit tests (`test_smax_redis_client.py`), but here are \na few simple ones to help get you started.\n\n### Share/Pull roundtrip\n```python\n  from smax import SmaxRedisClient\n\n  smax_client = SmaxRedisClient(\"localhost\") # Replace localhost with redis hostname or IP.\n  value = 0.183\n  table = \"weather:forecast:gfs\"\n  key = \"test_tau\"\n  smax_client.smax_share(table, key, value)\n  result = smax_client.smax_pull(table, key)\n  print(result.data, result.type)\n```\n### Pub/sub\n\n```python\n  from smax import SmaxRedisClient\n\n  smax_client = SmaxRedisClient(\"localhost\") # Replace localhost with redis hostname or IP.\n  table = \"weather:forecast:gfs\"\n  key = \"test_array\"\n  smax_client.smax_subscribe(f\"{table}:{key}\")\n\n  # Share something, which send publish notifications automatically.\n  value = [0.0, 1.12345, -1.54321, 100000.12345]\n  smax_client.smax_share(table, key, value)\n\n  # Wait for publish notifications.\n  result = smax_client.smax_wait_on_any_subscribed()\n  print(result.data, result.type)\n```\n\n------------------------------------------------------------------------------\nCopyright (C) 2024 Center for Astrophysics \\| Harvard \\\u0026 Smithsonian\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsmithsonian%2Fsmax-python","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsmithsonian%2Fsmax-python","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsmithsonian%2Fsmax-python/lists"}