rspace-client 2.6.2__tar.gz → 2.7.2__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (25) hide show
  1. rspace_client-2.7.2/PKG-INFO +157 -0
  2. rspace_client-2.7.2/README.md +124 -0
  3. {rspace_client-2.6.2 → rspace_client-2.7.2}/pyproject.toml +9 -2
  4. {rspace_client-2.6.2 → rspace_client-2.7.2}/rspace_client/eln/field_content.py +0 -0
  5. {rspace_client-2.6.2 → rspace_client-2.7.2}/rspace_client/inv/inv.py +672 -46
  6. {rspace_client-2.6.2 → rspace_client-2.7.2}/rspace_client/inv/template_builder.py +92 -16
  7. rspace_client-2.7.2/rspace_client/notebook_sync/links.md +170 -0
  8. {rspace_client-2.6.2 → rspace_client-2.7.2}/rspace_client/notebook_sync/sync_notebook.py +2 -3
  9. rspace_client-2.6.2/PKG-INFO +0 -490
  10. rspace_client-2.6.2/README.md +0 -458
  11. {rspace_client-2.6.2 → rspace_client-2.7.2}/LICENSE +0 -0
  12. {rspace_client-2.6.2 → rspace_client-2.7.2}/rspace_client/.spyproject/config/workspace.ini +0 -0
  13. {rspace_client-2.6.2 → rspace_client-2.7.2}/rspace_client/__init__.py +0 -0
  14. {rspace_client-2.6.2 → rspace_client-2.7.2}/rspace_client/client_base.py +0 -0
  15. {rspace_client-2.6.2 → rspace_client-2.7.2}/rspace_client/eln/advanced_query_builder.py +0 -0
  16. {rspace_client-2.6.2 → rspace_client-2.7.2}/rspace_client/eln/dcs.py +0 -0
  17. {rspace_client-2.6.2 → rspace_client-2.7.2}/rspace_client/eln/eln.py +0 -0
  18. {rspace_client-2.6.2 → rspace_client-2.7.2}/rspace_client/eln/filetree_importer.py +0 -0
  19. {rspace_client-2.6.2 → rspace_client-2.7.2}/rspace_client/eln/fs.py +0 -0
  20. {rspace_client-2.6.2 → rspace_client-2.7.2}/rspace_client/fs_utils.py +0 -0
  21. {rspace_client-2.6.2 → rspace_client-2.7.2}/rspace_client/inv/attachment_fs.py +0 -0
  22. {rspace_client-2.6.2 → rspace_client-2.7.2}/rspace_client/inv/quantity_unit.py +0 -0
  23. {rspace_client-2.6.2 → rspace_client-2.7.2}/rspace_client/inv/sample_builder2.py +0 -0
  24. {rspace_client-2.6.2 → rspace_client-2.7.2}/rspace_client/utils.py +0 -0
  25. {rspace_client-2.6.2 → rspace_client-2.7.2}/rspace_client/validators.py +0 -0
@@ -0,0 +1,157 @@
1
+ Metadata-Version: 2.4
2
+ Name: rspace-client
3
+ Version: 2.7.2
4
+ Summary: A client for calling RSpace ELN and Inventory APIs
5
+ License: Apache-2.0
6
+ License-File: LICENSE
7
+ Keywords: RSpace,ResearchSpace,ELN,Inventory
8
+ Author: Research Innovations Ltd
9
+ Author-email: support@researchspace.com
10
+ Maintainer: Matthias Kowalski
11
+ Maintainer-email: matthias@researchspace.com
12
+ Requires-Python: >=3.9,<4.0
13
+ Classifier: Development Status :: 4 - Beta
14
+ Classifier: Intended Audience :: Developers
15
+ Classifier: Intended Audience :: Science/Research
16
+ Classifier: License :: OSI Approved :: Apache Software License
17
+ Classifier: Programming Language :: Python :: 3
18
+ Classifier: Programming Language :: Python :: 3.9
19
+ Classifier: Programming Language :: Python :: 3.10
20
+ Classifier: Programming Language :: Python :: 3.11
21
+ Classifier: Programming Language :: Python :: 3.12
22
+ Classifier: Programming Language :: Python :: 3.13
23
+ Classifier: Programming Language :: Python :: 3.14
24
+ Classifier: Topic :: Software Development :: Libraries
25
+ Requires-Dist: beautifulsoup4 (>=4.9.3,<5.0.0)
26
+ Requires-Dist: fs (>=2.4.16,<3.0.0)
27
+ Requires-Dist: requests (>=2.25.1,<3.0.0)
28
+ Requires-Dist: setuptools (<82)
29
+ Project-URL: Documentation, https://github.com/rspace-os/rspace-client-python
30
+ Project-URL: Repository, https://github.com/rspace-os/rspace-client-python
31
+ Description-Content-Type: text/markdown
32
+
33
+ # rspace-client-python
34
+
35
+ [![PyPI version](https://img.shields.io/pypi/v/rspace-client.svg)](https://pypi.org/project/rspace-client/)
36
+ [![Python versions](https://img.shields.io/pypi/pyversions/rspace-client.svg)](https://pypi.org/project/rspace-client/)
37
+ [![License: Apache 2.0](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](LICENSE)
38
+
39
+ The official Python client for the [RSpace](https://www.researchspace.com) ELN and Inventory APIs. It wraps the raw REST endpoints in a Pythonic interface so you can create and search documents, manage Inventory samples and containers, export your work, and read/write Gallery and Inventory files — from a script, a Jupyter notebook, or your own application.
40
+
41
+ Don't have an RSpace account? Sign up for free at [community.researchspace.com](https://community.researchspace.com), or run [RSpace locally in Docker](https://github.com/rspace-os/rspace-docker). You'll need an API key from your [profile page](https://researchspace.helpdocs.io/article/v0dxtfvj7u-rspace-api-introduction) to use this client. This client is especially easy to use from Jupyter notebooks — see the [round-trip data analysis video](https://researchspace.helpdocs.io/article/5xqzm36v9t-video-round-trip-data-analysis-using-jupyter-notebook-and-the-rspace-api) for a walkthrough.
42
+
43
+ ## Quick start
44
+
45
+ ```bash
46
+ pip install rspace-client
47
+ ```
48
+
49
+ ```python
50
+ import os
51
+ from rspace_client.inv import inv
52
+ from rspace_client.eln import eln
53
+
54
+ inv_cli = inv.InventoryClient(os.getenv("RSPACE_URL"), os.getenv("RSPACE_API_KEY"))
55
+ eln_cli = eln.ELNClient(os.getenv("RSPACE_URL"), os.getenv("RSPACE_API_KEY"))
56
+
57
+ samples = inv_cli.list_samples()
58
+ print(f"There are {samples['totalHits']} samples")
59
+
60
+ print(eln_cli.get_status())
61
+ ```
62
+
63
+ Set `RSPACE_URL` and `RSPACE_API_KEY` as environment variables first:
64
+
65
+ ```bash
66
+ bash> export RSPACE_URL=https://myrspace.com
67
+ bash> export RSPACE_API_KEY=abcdefgh...
68
+ ```
69
+
70
+ Full REST API reference is served by your own RSpace instance at `https://<YOUR_RSPACE_DOMAIN>/public/apiDocs` (e.g. `https://community.researchspace.com/public/apiDocs`).
71
+
72
+ ## Core features
73
+
74
+ | Feature | What it does |
75
+ | ---------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
76
+ | Documents & basic/advanced search | Create, read, and update documents; search by tag, name, form, or date; page through results |
77
+ | Inventory: samples, subsamples, containers | Create and manage samples, split/duplicate subsamples, organise items into containers |
78
+ | Instruments & Instrument Templates *(new in 2.7.0, RSpace 2.24)* | Create, update, and manage Inventory instruments and instrument templates |
79
+ | Export | Async export of a user's or group's work (or specific documents/notebooks/folders) to HTML or XML, with progress polling |
80
+ | PyFilesystem access | `GalleryFilesystem` and `InventoryAttachmentFilesystem` implement the [PyFilesystem](https://docs.pyfilesystem.org/en/latest/index.html) API for Gallery files and Inventory attachments |
81
+ | Notebook / Jupyter / R interop (`notebook_sync`) | Helpers for round-tripping data between RSpace notebook entries and Jupyter or R workflows |
82
+ | Activity / audit trail | Query "who did what, when" for a record or across a date range |
83
+ | Forms | Create, publish, share, and list custom forms; create documents from them |
84
+
85
+ Full worked examples for every feature above are in the **[Usage Guide](docs/usage-guide.md)**.
86
+
87
+ ## Compatibility & limitations
88
+
89
+ | | |
90
+ | -------------------- | ----------------------------------- |
91
+ | Python | 3.9 or later (see `pyproject.toml`) |
92
+ | RSpace ELN API | 1.69 or later |
93
+ | RSpace Inventory API | 1.73  or later |
94
+
95
+ **This client doesn't cover 100% of the REST API.** It's a convenience layer, and some capabilities are only exposed through the web application or the raw REST endpoints — for example, sharing a notebook into the Shared Folder currently has to be done in the UI (see [Creating a Folder / Notebook](docs/usage-guide.md#creating-a-folder--notebook)). If something you need isn't covered here, check the full REST API docs at `<YOUR_RSPACE_DOMAIN>/public/apiDocs` before assuming it isn't possible.
96
+
97
+ ## Examples & notebooks
98
+
99
+ Runnable scripts in [`examples/`](examples) (run with `python3 examples/<script>.py $RSPACE_URL $RSPACE_API_KEY` from that folder):
100
+
101
+ | Script | What it demonstrates |
102
+ | ------------------------------- | ------------------------------------------------------------------------------------- |
103
+ | `status.py` | Check RSpace server status and API version |
104
+ | `create_document.py` | Create a document, upload a file, and link the file into it |
105
+ | `create_folder_and_notebook.py` | Create, retrieve, and delete folders and notebooks |
106
+ | `create_form.py` | Create a custom form and list/page through published forms |
107
+ | `create_sample.py` | Create an Inventory sample, including one with barcodes |
108
+ | `download_attachments.py` | Download file attachments from a document |
109
+ | `export_records.py` | Export a selection of documents/notebooks/folders |
110
+ | `freezer.py` | Build a freezer → shelf → rack → tray → box container hierarchy in Inventory |
111
+ | `get_activity.py` | Query the audit trail for a document, or for recent create/edit activity |
112
+ | `import_directory.py` | Import a local directory of files into RSpace |
113
+ | `import_word_file.py` | Import a Word (.docx) file as an RSpace document |
114
+ | `paging_through_results.py` | Page through document search results via HATEOAS links |
115
+ | `paging_through_users.py` | Page through users and batch-process accounts (admin use case) |
116
+ | `search_documents_by_form.py` | Find and export documents created from a specific form |
117
+ | `share_documents.py` | Share a newly created document with a group |
118
+ | `tree_upload.py` | Bulk-import a converted eCAT export (folders of .docx/images) with resume/log support |
119
+
120
+ Interactive notebooks in [`jupyter_notebooks/`](jupyter_notebooks):
121
+
122
+ | Notebook | What it demonstrates |
123
+ | ------------------------------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
124
+ | `rspace_demo.ipynb` | Full round-trip workflow: pull data from RSpace, analyse it, write results back |
125
+ | `rspace-demo-kaggle-v11.ipynb` | The same round-trip workflow using a Kaggle dataset — matches the [walkthrough video](https://researchspace.helpdocs.io/article/5xqzm36v9t-video-round-trip-data-analysis-using-jupyter-notebook-and-the-rspace-api) |
126
+ | `samples_to_lom.ipynb` | Bulk-creates a notebook entry per sample assay, each with a List of Materials linking back to the sample's physical location |
127
+
128
+ (`proteins.csv` and `temp_data.csv` in the same folder are sample data used by these notebooks.)
129
+
130
+ ## Testing
131
+
132
+ CI (`.github/workflows/codeql-and-tests.yml`) runs unit tests across supported Python versions, then integration tests against a real RSpace instance: it builds `rspace-web` from source and starts it with a freshly seeded database (no Docker image, no browser automation), logs in once to initialize the built-in test account, then runs the suite against it.
133
+
134
+ To run tests locally:
135
+
136
+ ```bash
137
+ # unit tests only
138
+ poetry run pytest -m "not integration"
139
+
140
+ # integration tests, against your own RSpace instance
141
+ export RSPACE_URL=https://<your-rspace-domain>
142
+ export RSPACE_API_KEY=<your-api-key>
143
+ poetry run pytest -m integration
144
+ ```
145
+
146
+ ## Community projects
147
+
148
+ See what others have built on top of RSpace and RSpace Python SDK on the **[Community Projects](https://github.com/rspace-os/community/blob/main/community-projects/community-projects.md)** page. Built something with this client? Share it in an [office hour](https://github.com/rspace-os/community/blob/main/the%20rspace%20project/Guide/calendar.md) or open a PR to add it.
149
+
150
+ ## Contributing
151
+
152
+ Contributions of all sizes are welcome — from a typo fix to a new feature. See [CONTRIBUTING.md](CONTRIBUTING.md) for how to get started, [DEVELOPING.md](DEVELOPING.md) for local setup and running tests, and the [Guide to the RSpace Project](https://github.com/rspace-os/community/blob/main/the%20rspace%20project/README.md) for the project's wider vision and governance.
153
+
154
+ ## License & security
155
+
156
+ Apache 2.0 — see [LICENSE](LICENSE). Security policy is maintained org-wide at [rspace-os/.github](https://github.com/rspace-os/.github/blob/main/SECURITY.md).
157
+
@@ -0,0 +1,124 @@
1
+ # rspace-client-python
2
+
3
+ [![PyPI version](https://img.shields.io/pypi/v/rspace-client.svg)](https://pypi.org/project/rspace-client/)
4
+ [![Python versions](https://img.shields.io/pypi/pyversions/rspace-client.svg)](https://pypi.org/project/rspace-client/)
5
+ [![License: Apache 2.0](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](LICENSE)
6
+
7
+ The official Python client for the [RSpace](https://www.researchspace.com) ELN and Inventory APIs. It wraps the raw REST endpoints in a Pythonic interface so you can create and search documents, manage Inventory samples and containers, export your work, and read/write Gallery and Inventory files — from a script, a Jupyter notebook, or your own application.
8
+
9
+ Don't have an RSpace account? Sign up for free at [community.researchspace.com](https://community.researchspace.com), or run [RSpace locally in Docker](https://github.com/rspace-os/rspace-docker). You'll need an API key from your [profile page](https://researchspace.helpdocs.io/article/v0dxtfvj7u-rspace-api-introduction) to use this client. This client is especially easy to use from Jupyter notebooks — see the [round-trip data analysis video](https://researchspace.helpdocs.io/article/5xqzm36v9t-video-round-trip-data-analysis-using-jupyter-notebook-and-the-rspace-api) for a walkthrough.
10
+
11
+ ## Quick start
12
+
13
+ ```bash
14
+ pip install rspace-client
15
+ ```
16
+
17
+ ```python
18
+ import os
19
+ from rspace_client.inv import inv
20
+ from rspace_client.eln import eln
21
+
22
+ inv_cli = inv.InventoryClient(os.getenv("RSPACE_URL"), os.getenv("RSPACE_API_KEY"))
23
+ eln_cli = eln.ELNClient(os.getenv("RSPACE_URL"), os.getenv("RSPACE_API_KEY"))
24
+
25
+ samples = inv_cli.list_samples()
26
+ print(f"There are {samples['totalHits']} samples")
27
+
28
+ print(eln_cli.get_status())
29
+ ```
30
+
31
+ Set `RSPACE_URL` and `RSPACE_API_KEY` as environment variables first:
32
+
33
+ ```bash
34
+ bash> export RSPACE_URL=https://myrspace.com
35
+ bash> export RSPACE_API_KEY=abcdefgh...
36
+ ```
37
+
38
+ Full REST API reference is served by your own RSpace instance at `https://<YOUR_RSPACE_DOMAIN>/public/apiDocs` (e.g. `https://community.researchspace.com/public/apiDocs`).
39
+
40
+ ## Core features
41
+
42
+ | Feature | What it does |
43
+ | ---------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
44
+ | Documents & basic/advanced search | Create, read, and update documents; search by tag, name, form, or date; page through results |
45
+ | Inventory: samples, subsamples, containers | Create and manage samples, split/duplicate subsamples, organise items into containers |
46
+ | Instruments & Instrument Templates *(new in 2.7.0, RSpace 2.24)* | Create, update, and manage Inventory instruments and instrument templates |
47
+ | Export | Async export of a user's or group's work (or specific documents/notebooks/folders) to HTML or XML, with progress polling |
48
+ | PyFilesystem access | `GalleryFilesystem` and `InventoryAttachmentFilesystem` implement the [PyFilesystem](https://docs.pyfilesystem.org/en/latest/index.html) API for Gallery files and Inventory attachments |
49
+ | Notebook / Jupyter / R interop (`notebook_sync`) | Helpers for round-tripping data between RSpace notebook entries and Jupyter or R workflows |
50
+ | Activity / audit trail | Query "who did what, when" for a record or across a date range |
51
+ | Forms | Create, publish, share, and list custom forms; create documents from them |
52
+
53
+ Full worked examples for every feature above are in the **[Usage Guide](docs/usage-guide.md)**.
54
+
55
+ ## Compatibility & limitations
56
+
57
+ | | |
58
+ | -------------------- | ----------------------------------- |
59
+ | Python | 3.9 or later (see `pyproject.toml`) |
60
+ | RSpace ELN API | 1.69 or later |
61
+ | RSpace Inventory API | 1.73  or later |
62
+
63
+ **This client doesn't cover 100% of the REST API.** It's a convenience layer, and some capabilities are only exposed through the web application or the raw REST endpoints — for example, sharing a notebook into the Shared Folder currently has to be done in the UI (see [Creating a Folder / Notebook](docs/usage-guide.md#creating-a-folder--notebook)). If something you need isn't covered here, check the full REST API docs at `<YOUR_RSPACE_DOMAIN>/public/apiDocs` before assuming it isn't possible.
64
+
65
+ ## Examples & notebooks
66
+
67
+ Runnable scripts in [`examples/`](examples) (run with `python3 examples/<script>.py $RSPACE_URL $RSPACE_API_KEY` from that folder):
68
+
69
+ | Script | What it demonstrates |
70
+ | ------------------------------- | ------------------------------------------------------------------------------------- |
71
+ | `status.py` | Check RSpace server status and API version |
72
+ | `create_document.py` | Create a document, upload a file, and link the file into it |
73
+ | `create_folder_and_notebook.py` | Create, retrieve, and delete folders and notebooks |
74
+ | `create_form.py` | Create a custom form and list/page through published forms |
75
+ | `create_sample.py` | Create an Inventory sample, including one with barcodes |
76
+ | `download_attachments.py` | Download file attachments from a document |
77
+ | `export_records.py` | Export a selection of documents/notebooks/folders |
78
+ | `freezer.py` | Build a freezer → shelf → rack → tray → box container hierarchy in Inventory |
79
+ | `get_activity.py` | Query the audit trail for a document, or for recent create/edit activity |
80
+ | `import_directory.py` | Import a local directory of files into RSpace |
81
+ | `import_word_file.py` | Import a Word (.docx) file as an RSpace document |
82
+ | `paging_through_results.py` | Page through document search results via HATEOAS links |
83
+ | `paging_through_users.py` | Page through users and batch-process accounts (admin use case) |
84
+ | `search_documents_by_form.py` | Find and export documents created from a specific form |
85
+ | `share_documents.py` | Share a newly created document with a group |
86
+ | `tree_upload.py` | Bulk-import a converted eCAT export (folders of .docx/images) with resume/log support |
87
+
88
+ Interactive notebooks in [`jupyter_notebooks/`](jupyter_notebooks):
89
+
90
+ | Notebook | What it demonstrates |
91
+ | ------------------------------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
92
+ | `rspace_demo.ipynb` | Full round-trip workflow: pull data from RSpace, analyse it, write results back |
93
+ | `rspace-demo-kaggle-v11.ipynb` | The same round-trip workflow using a Kaggle dataset — matches the [walkthrough video](https://researchspace.helpdocs.io/article/5xqzm36v9t-video-round-trip-data-analysis-using-jupyter-notebook-and-the-rspace-api) |
94
+ | `samples_to_lom.ipynb` | Bulk-creates a notebook entry per sample assay, each with a List of Materials linking back to the sample's physical location |
95
+
96
+ (`proteins.csv` and `temp_data.csv` in the same folder are sample data used by these notebooks.)
97
+
98
+ ## Testing
99
+
100
+ CI (`.github/workflows/codeql-and-tests.yml`) runs unit tests across supported Python versions, then integration tests against a real RSpace instance: it builds `rspace-web` from source and starts it with a freshly seeded database (no Docker image, no browser automation), logs in once to initialize the built-in test account, then runs the suite against it.
101
+
102
+ To run tests locally:
103
+
104
+ ```bash
105
+ # unit tests only
106
+ poetry run pytest -m "not integration"
107
+
108
+ # integration tests, against your own RSpace instance
109
+ export RSPACE_URL=https://<your-rspace-domain>
110
+ export RSPACE_API_KEY=<your-api-key>
111
+ poetry run pytest -m integration
112
+ ```
113
+
114
+ ## Community projects
115
+
116
+ See what others have built on top of RSpace and RSpace Python SDK on the **[Community Projects](https://github.com/rspace-os/community/blob/main/community-projects/community-projects.md)** page. Built something with this client? Share it in an [office hour](https://github.com/rspace-os/community/blob/main/the%20rspace%20project/Guide/calendar.md) or open a PR to add it.
117
+
118
+ ## Contributing
119
+
120
+ Contributions of all sizes are welcome — from a typo fix to a new feature. See [CONTRIBUTING.md](CONTRIBUTING.md) for how to get started, [DEVELOPING.md](DEVELOPING.md) for local setup and running tests, and the [Guide to the RSpace Project](https://github.com/rspace-os/community/blob/main/the%20rspace%20project/README.md) for the project's wider vision and governance.
121
+
122
+ ## License & security
123
+
124
+ Apache 2.0 — see [LICENSE](LICENSE). Security policy is maintained org-wide at [rspace-os/.github](https://github.com/rspace-os/.github/blob/main/SECURITY.md).
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "rspace-client"
3
- version = "2.6.2"
3
+ version = "2.7.2"
4
4
  description = "A client for calling RSpace ELN and Inventory APIs"
5
5
  license = "Apache-2.0"
6
6
  authors = ["Research Innovations Ltd <support@researchspace.com>"]
@@ -25,12 +25,19 @@ python = "^3.9"
25
25
  requests = "^2.25.1"
26
26
  beautifulsoup4 = "^4.9.3"
27
27
  fs = "^2.4.16"
28
+ setuptools = "<82"
28
29
 
29
30
  [tool.poetry.group.dev.dependencies]
30
31
  python-dotenv = "^1.1.1"
31
32
  black = "^21.6b0"
32
- pytest = "^6.2.4"
33
+ pytest = "^8.0.0"
33
34
 
34
35
  [build-system]
35
36
  requires = ["poetry-core>=1.0.0"]
36
37
  build-backend = "poetry.core.masonry.api"
38
+
39
+ [tool.pytest.ini_options]
40
+ testpaths = ["rspace_client/tests"]
41
+ markers = [
42
+ "integration: marks tests as integration tests requiring a live RSpace server (deselect with '-m not integration')",
43
+ ]