Skip to content

Commit 7d59423

Browse files
committed
DOC: write the readme file
1 parent d1e8102 commit 7d59423

File tree

4 files changed

+62
-32
lines changed

4 files changed

+62
-32
lines changed

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
BSD 3-Clause License
22

3-
Copyright (c) 2025, My Name.
3+
Copyright (c) 2025.
44
All rights reserved.
55

66
Redistribution and use in source and binary forms, with or without

README.md

Lines changed: 59 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,61 @@
11
# save-and-restore-api
22

3-
[![Actions Status][actions-badge]][actions-link]
4-
[![Documentation Status][rtd-badge]][rtd-link]
5-
6-
[![PyPI version][pypi-version]][pypi-link]
7-
[![Conda-Forge][conda-badge]][conda-link]
8-
[![PyPI platforms][pypi-platforms]][pypi-link]
9-
10-
[![GitHub Discussion][github-discussions-badge]][github-discussions-link]
11-
12-
<!-- SPHINX-START -->
13-
14-
<!-- prettier-ignore-start -->
15-
[actions-badge]: https://github.com/dmgav/save-and-restore-api/workflows/CI/badge.svg
16-
[actions-link]: https://github.com/dmgav/save-and-restore-api/actions
17-
[conda-badge]: https://img.shields.io/conda/vn/conda-forge/save-and-restore-api
18-
[conda-link]: https://github.com/conda-forge/save-and-restore-api-feedstock
19-
[github-discussions-badge]: https://img.shields.io/static/v1?label=Discussions&message=Ask&color=blue&logo=github
20-
[github-discussions-link]: https://github.com/dmgav/save-and-restore-api/discussions
21-
[pypi-link]: https://pypi.org/project/save-and-restore-api/
22-
[pypi-platforms]: https://img.shields.io/pypi/pyversions/save-and-restore-api
23-
[pypi-version]: https://img.shields.io/pypi/v/save-and-restore-api
24-
[rtd-badge]: https://readthedocs.org/projects/save-and-restore-api/badge/?version=latest
25-
[rtd-link]: https://save-and-restore-api.readthedocs.io/en/latest/?badge=latest
26-
27-
<!-- prettier-ignore-end -->
3+
Python package for communicating with Save-and-Restore service (CSS Phoebus). The
4+
package provides syncronous (thread-based) and asynchronous (asyncio) versions of
5+
the API functions.
6+
7+
## Examples
8+
9+
The following code creates a folder node named "My Folder" under the root node:
10+
11+
```python
12+
13+
from save_and_restore_api import SaveRestoreAPI
14+
15+
with SaveRestoreAPI(base_url="http://localhost:8080/save-restore") as SR:
16+
SR.auth_set(username="user", password="user_password")
17+
18+
root_folder_uid = SR.ROOT_NODE_UID
19+
node={"name": "My Folder", "nodeType": "FOLDER"}
20+
21+
folder = SR.node_add(root_folder_uid, node=node)
22+
23+
print(f"Created folder metadata: {folder}")
24+
```
25+
26+
Async version of the same code:
27+
28+
```python
29+
30+
from save_and_restore_api.aio import SaveRestoreAPI
31+
32+
async with SaveRestoreAPI(base_url="http://localhost:8080/save-restore") as SR:
33+
await SR.auth_set(username="user", password="user_password")
34+
35+
root_folder_uid = SR.ROOT_NODE_UID
36+
node={"name": "My Folder", "nodeType": "FOLDER"}
37+
38+
folder = await SR.node_add(root_folder_uid, node=node)
39+
print(f"Created folder metadata: {folder}")
40+
```
41+
42+
43+
## `save-and-restore` CLI Tool
44+
45+
The package also contains simple CLI tool (`save-and-restore`) for performing a small
46+
set of basic operations on the nodes of the Save-and-Restore service. The tool was
47+
primarily developed for creating snapshot configurations based on lists of PVs.
48+
For example, the tool can read a list of PVs from a .sav file generated by IOC autosave
49+
and create a configuration node based on that list. Currently only autosave files
50+
are supported, but support for other formats can be added if needed. The list of
51+
supported functions can also be extended. Current functions are:
52+
53+
- LOGIN: test login credentials;
54+
55+
- CONFIG ADD: create configuration node based on a list of PVs read from a file;
56+
57+
- CONFIG UPDATE: update an existing configuration node based on a list of PVs read from a file;
58+
59+
- CONFIG GET: get information about an existing configuration node, including the list of PVs.
60+
61+
Use `save-and-restore -h` to see the list of options.

docs/source/index.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
You can adapt this file completely to your liking, but it should at least
44
contain the root `toctree` directive.
55
6-
Bluesky Queue Server API Documentation
7-
======================================
6+
Save and Restore API Documentation
7+
==================================
88

99
.. toctree::
1010
:maxdepth: 2

docs/source/installation.rst

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,3 @@ Installation
55
Installation from PyPI::
66

77
$ pip install save-and-restore-api
8-
9-
Installation from `conda-forge`::
10-
11-
$ conda install save-and-restore-api -c conda-forge

0 commit comments

Comments
 (0)