labkey 3.1.0__tar.gz → 3.2.0__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 (28) hide show
  1. {labkey-3.1.0 → labkey-3.2.0}/CHANGE.txt +7 -0
  2. {labkey-3.1.0/labkey.egg-info → labkey-3.2.0}/PKG-INFO +12 -1
  3. {labkey-3.1.0 → labkey-3.2.0}/README.md +39 -16
  4. labkey-3.2.0/debug.txt +0 -0
  5. {labkey-3.1.0 → labkey-3.2.0}/labkey/__init__.py +1 -1
  6. {labkey-3.1.0 → labkey-3.2.0}/labkey/experiment.py +94 -0
  7. {labkey-3.1.0 → labkey-3.2.0/labkey.egg-info}/PKG-INFO +12 -1
  8. {labkey-3.1.0 → labkey-3.2.0}/labkey.egg-info/SOURCES.txt +1 -0
  9. labkey-3.2.0/labkey.egg-info/requires.txt +20 -0
  10. labkey-3.2.0/setup.cfg +7 -0
  11. {labkey-3.1.0 → labkey-3.2.0}/setup.py +3 -3
  12. labkey-3.1.0/labkey.egg-info/requires.txt +0 -7
  13. labkey-3.1.0/setup.cfg +0 -14
  14. {labkey-3.1.0 → labkey-3.2.0}/LICENSE.txt +0 -0
  15. {labkey-3.1.0 → labkey-3.2.0}/MANIFEST.in +0 -0
  16. {labkey-3.1.0 → labkey-3.2.0}/labkey/api_wrapper.py +0 -0
  17. {labkey-3.1.0 → labkey-3.2.0}/labkey/container.py +0 -0
  18. {labkey-3.1.0 → labkey-3.2.0}/labkey/domain.py +0 -0
  19. {labkey-3.1.0 → labkey-3.2.0}/labkey/exceptions.py +0 -0
  20. {labkey-3.1.0 → labkey-3.2.0}/labkey/query.py +0 -0
  21. {labkey-3.1.0 → labkey-3.2.0}/labkey/security.py +0 -0
  22. {labkey-3.1.0 → labkey-3.2.0}/labkey/server_context.py +0 -0
  23. {labkey-3.1.0 → labkey-3.2.0}/labkey/storage.py +0 -0
  24. {labkey-3.1.0 → labkey-3.2.0}/labkey/utils.py +0 -0
  25. {labkey-3.1.0 → labkey-3.2.0}/labkey.egg-info/dependency_links.txt +0 -0
  26. {labkey-3.1.0 → labkey-3.2.0}/labkey.egg-info/top_level.txt +0 -0
  27. {labkey-3.1.0 → labkey-3.2.0}/pyproject.toml +0 -0
  28. {labkey-3.1.0 → labkey-3.2.0}/pytest.ini +0 -0
@@ -2,6 +2,13 @@
2
2
  LabKey Python Client API News
3
3
  +++++++++++
4
4
 
5
+ What's New in the LabKey 3.2.0 package
6
+ ==============================
7
+
8
+ *Release date: 09/10/2024*
9
+ - Add lineage API to experiment module
10
+ - Accessible via API wrappers e.g. api.experiment.lineage()
11
+
5
12
  What's New in the LabKey 3.1.0 package
6
13
  ==============================
7
14
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: labkey
3
- Version: 3.1.0
3
+ Version: 3.2.0
4
4
  Summary: Python client API for LabKey Server
5
5
  Home-page: https://github.com/LabKey/labkey-api-python
6
6
  Author: LabKey
@@ -26,5 +26,16 @@ Requires-Dist: pytest; extra == "test"
26
26
  Requires-Dist: requests; extra == "test"
27
27
  Requires-Dist: mock; extra == "test"
28
28
  Requires-Dist: pytest-cov; extra == "test"
29
+ Provides-Extra: dev
30
+ Requires-Dist: pytest; extra == "dev"
31
+ Requires-Dist: requests; extra == "dev"
32
+ Requires-Dist: mock; extra == "dev"
33
+ Requires-Dist: pytest-cov; extra == "dev"
34
+ Requires-Dist: black; extra == "dev"
35
+ Provides-Extra: build
36
+ Requires-Dist: setuptools; extra == "build"
37
+ Requires-Dist: build; extra == "build"
38
+ Requires-Dist: twine; extra == "build"
39
+ Requires-Dist: wheel; extra == "build"
29
40
 
30
41
  Python client API for LabKey Server. Supports query and experiment APIs.
@@ -93,12 +93,16 @@ from labkey.api_wrapper import APIWrapper
93
93
 
94
94
  print("Create an APIWrapper")
95
95
  labkey_server = 'localhost:8080'
96
- project_name = 'ModuleAssayTest' # Project folder name
96
+ # in this example, Tutorials is a project name and HIV study is a subfolder under it.
97
+ container_path = 'Tutorials/HIV Study'
97
98
  contextPath = 'labkey'
98
99
  schema = 'core'
99
100
  table = 'Users'
100
- api = APIWrapper(labkey_server, project_name, contextPath, use_ssl=False)
101
101
 
102
+ # Note: If developing against localhost with https disabled, set use_ssl=False below
103
+ api = APIWrapper(labkey_server, container_path, contextPath)
104
+
105
+ # Makes an API request to https://www.example.com/labkey/tutorials/hiv%20study/query-getQuery.api
102
106
  result = api.query.select_rows(schema, table)
103
107
 
104
108
  if result is not None:
@@ -113,28 +117,29 @@ Python 3.7+ is fully supported.
113
117
  LabKey Server v15.1 and later.
114
118
 
115
119
  ## Contributing
116
- This package is maintained by [LabKey](http://www.labkey.com/). If you have any questions or need support, please use
117
- the [LabKey Server developer support forum](https://www.labkey.org/home/developer/forum/project-start.view).
118
-
119
- When contributing changes please use `Black` to format your code. To run Black follow these instructions:
120
- 1. Install black: `pip install black`
121
- 2. Run black: `black .`
122
- 3. Commit the newly formatted code.
120
+ This package is maintained by [LabKey](http://www.labkey.com/). If you have any questions or need support, please use the
121
+ [LabKey Server developer support forum](https://www.labkey.org/home/developer/forum/project-start.view).
123
122
 
124
- ### Testing
125
- If you are looking to contribute please run the tests before issuing a PR. The tests can be initiated by running
123
+ ### Setup
124
+ To install the necessary dependencies for local development you can run the following command:
126
125
 
127
126
  ```bash
128
- $ python setup.py test
127
+ pip install -e '.[dev]'
129
128
  ```
130
129
 
131
- This runs the tests using [pytest](https://docs.pytest.org/en/latest/contents.html). If you'd like to run pytest directly you can install the testing dependencies in your virtual environment with:
130
+
131
+ ### Formatting your code
132
+ When contributing changes please use `Black` to format your code. To run Black you can run the following command:
132
133
 
133
134
  ```bash
134
- $ pip install -e .[test]
135
+ black .
135
136
  ```
136
137
 
137
- Then, the tests can be run with
138
+ After black has run it may have formatted some files, commit the changed files before opening a PR.
139
+
140
+ ### Testing
141
+ If you are looking to contribute please run the tests before issuing a PR. The tests can be run with:
142
+
138
143
  ```bash
139
144
  $ pytest .
140
145
  ```
@@ -147,4 +152,22 @@ $ pytest . -m "integration"
147
152
  ```
148
153
 
149
154
  ### Maintainers
150
- Package maintainer's can reference the [Python Package Maintenance](https://docs.google.com/document/d/13nVxwyctH4YZ6gDhcrOu9Iz6qGFPAxicE1VHiVYpw9A/) document (requires permission) for updating releases.
155
+ Package maintainer's can reference the [Python Package Maintenance](https://docs.google.com/document/d/13nVxwyctH4YZ6gDhcrOu9Iz6qGFPAxicE1VHiVYpw9A/) document (requires permission) for updating
156
+ releases.
157
+
158
+ To build the package before releasing you will need to install the build dependencies. This can be done by running:
159
+
160
+ ```bash
161
+ pip install -e '.[build]'
162
+ ```
163
+
164
+ To build the package you can run:
165
+
166
+ ```bash
167
+ python -m build
168
+ ```
169
+
170
+ You should now have a `dist/` folder with two files:
171
+
172
+ 1. `labkey-<version from __init__.py>.tar.gz` - This is the source distribution
173
+ 2. `labkey-<version from __init__.py>-py3-none-any.whl` - This is the wheel
labkey-3.2.0/debug.txt ADDED
File without changes
@@ -14,6 +14,6 @@
14
14
  # limitations under the License.
15
15
  #
16
16
  __title__ = "labkey"
17
- __version__ = "3.1.0"
17
+ __version__ = "3.2.0"
18
18
  __author__ = "LabKey"
19
19
  __license__ = "Apache License 2.0"
@@ -218,6 +218,70 @@ def save_batches(
218
218
  return None
219
219
 
220
220
 
221
+ def lineage(
222
+ server_context: ServerContext,
223
+ lsids: List[str],
224
+ children: bool = None,
225
+ container_path: str = None,
226
+ cpas_type: str = None,
227
+ depth: int = None,
228
+ exp_type: str = None,
229
+ include_inputs_and_outputs: bool = None,
230
+ include_properties: bool = None,
231
+ include_run_steps: bool = None,
232
+ parents: bool = None,
233
+ run_protocol_lsid: str = None,
234
+ ):
235
+ """
236
+ :param server_context: A LabKey server context. See utils.create_server_context.
237
+ :param lsids: Array of LSIDs for the seed ExpData, ExpMaterials, or ExpRun
238
+ :param children: Include children in the lineage response. Defaults to true.
239
+ :param container_path: labkey container path if not already set in context
240
+ :param cpas_type: Optional LSID of a SampleSet or DataClass to filter the response. Defaults to include all.
241
+ :param depth: An optional depth argument. Defaults to include all.
242
+ :param exp_type: Optional experiment type to filter response -- either "Data", "Material", or "ExperimentRun".
243
+ Defaults to include all.
244
+ :param include_inputs_and_outputs: Include inputs and outputs in the lineage response.
245
+ :param include_properties: Include properties in the lineage response.
246
+ :param include_run_steps: Include run steps in the lineage response.
247
+ :param parents: Include parents in the lineage response. Defaults to true.
248
+ :param run_protocol_lsid: Optional Exp Run Protocol Lsid to filter response. Defaults to include all.
249
+ """
250
+ lineage_url = server_context.build_url(
251
+ "experiment", "lineage.api", container_path=container_path
252
+ )
253
+ payload = {"lsids": lsids}
254
+
255
+ if children is not None:
256
+ payload["children"] = children
257
+
258
+ if cpas_type is not None:
259
+ payload["cpasType"] = cpas_type
260
+
261
+ if depth is not None:
262
+ payload["depth"] = depth
263
+
264
+ if exp_type is not None:
265
+ payload["expType"] = exp_type
266
+
267
+ if include_inputs_and_outputs is not None:
268
+ payload["includeInputsAndOutputs"] = include_inputs_and_outputs
269
+
270
+ if include_properties is not None:
271
+ payload["includeProperties"] = include_properties
272
+
273
+ if include_run_steps is not None:
274
+ payload["includeRunSteps"] = include_run_steps
275
+
276
+ if parents is not None:
277
+ payload["parents"] = parents
278
+
279
+ if run_protocol_lsid is not None:
280
+ payload["runProtocolLsid"] = run_protocol_lsid
281
+
282
+ return server_context.make_request(lineage_url, payload=payload, method="POST")
283
+
284
+
221
285
  class ExperimentWrapper:
222
286
  """
223
287
  Wrapper for all of the API methods exposed in the experiment module. Used by the APIWrapper class.
@@ -237,3 +301,33 @@ class ExperimentWrapper:
237
301
  @functools.wraps(save_batches)
238
302
  def save_batches(self, assay_id: int, batches: List[Batch]) -> Optional[List[Batch]]:
239
303
  return save_batches(self.server_context, assay_id, batches)
304
+
305
+ @functools.wraps(lineage)
306
+ def lineage(
307
+ self,
308
+ lsids: List[str],
309
+ children: bool = None,
310
+ container_path: str = None,
311
+ cpas_type: str = None,
312
+ exp_type: str = None,
313
+ depth: int = None,
314
+ include_properties: bool = None,
315
+ include_inputs_and_outputs: bool = None,
316
+ include_run_steps: bool = None,
317
+ parents: bool = None,
318
+ run_protocol_lsid: str = None,
319
+ ):
320
+ return lineage(
321
+ self.server_context,
322
+ lsids,
323
+ children,
324
+ container_path,
325
+ cpas_type,
326
+ depth,
327
+ exp_type,
328
+ parents,
329
+ include_inputs_and_outputs,
330
+ include_properties,
331
+ include_run_steps,
332
+ run_protocol_lsid,
333
+ )
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: labkey
3
- Version: 3.1.0
3
+ Version: 3.2.0
4
4
  Summary: Python client API for LabKey Server
5
5
  Home-page: https://github.com/LabKey/labkey-api-python
6
6
  Author: LabKey
@@ -26,5 +26,16 @@ Requires-Dist: pytest; extra == "test"
26
26
  Requires-Dist: requests; extra == "test"
27
27
  Requires-Dist: mock; extra == "test"
28
28
  Requires-Dist: pytest-cov; extra == "test"
29
+ Provides-Extra: dev
30
+ Requires-Dist: pytest; extra == "dev"
31
+ Requires-Dist: requests; extra == "dev"
32
+ Requires-Dist: mock; extra == "dev"
33
+ Requires-Dist: pytest-cov; extra == "dev"
34
+ Requires-Dist: black; extra == "dev"
35
+ Provides-Extra: build
36
+ Requires-Dist: setuptools; extra == "build"
37
+ Requires-Dist: build; extra == "build"
38
+ Requires-Dist: twine; extra == "build"
39
+ Requires-Dist: wheel; extra == "build"
29
40
 
30
41
  Python client API for LabKey Server. Supports query and experiment APIs.
@@ -2,6 +2,7 @@ CHANGE.txt
2
2
  LICENSE.txt
3
3
  MANIFEST.in
4
4
  README.md
5
+ debug.txt
5
6
  pyproject.toml
6
7
  pytest.ini
7
8
  setup.cfg
@@ -0,0 +1,20 @@
1
+ requests
2
+
3
+ [build]
4
+ setuptools
5
+ build
6
+ twine
7
+ wheel
8
+
9
+ [dev]
10
+ pytest
11
+ requests
12
+ mock
13
+ pytest-cov
14
+ black
15
+
16
+ [test]
17
+ pytest
18
+ requests
19
+ mock
20
+ pytest-cov
labkey-3.2.0/setup.cfg ADDED
@@ -0,0 +1,7 @@
1
+ [metadata]
2
+ description_file = README.md
3
+
4
+ [egg_info]
5
+ tag_build =
6
+ tag_date = 0
7
+
@@ -33,6 +33,8 @@ if not version:
33
33
  long_desc = "Python client API for LabKey Server. Supports query and experiment APIs."
34
34
 
35
35
  tests_require = ["pytest", "requests", "mock", "pytest-cov"]
36
+ dev_require = ["pytest", "requests", "mock", "pytest-cov", "black"]
37
+ build_require = ["setuptools", "build", "twine", "wheel"]
36
38
 
37
39
  setup(
38
40
  name="labkey",
@@ -48,9 +50,7 @@ setup(
48
50
  packages=packages,
49
51
  package_data={},
50
52
  install_requires=["requests"],
51
- tests_require=tests_require,
52
- setup_requires=["pytest-runner"],
53
- extras_require={"test": tests_require},
53
+ extras_require={"test": tests_require, "dev": dev_require, "build": build_require},
54
54
  keywords="labkey api client",
55
55
  classifiers=[
56
56
  "Development Status :: 4 - Beta",
@@ -1,7 +0,0 @@
1
- requests
2
-
3
- [test]
4
- pytest
5
- requests
6
- mock
7
- pytest-cov
labkey-3.1.0/setup.cfg DELETED
@@ -1,14 +0,0 @@
1
- [metadata]
2
- description-file = README.md
3
-
4
- [aliases]
5
- test = pytest
6
-
7
- [coverage:html]
8
- directory = build/coverage_html
9
- title = Test coverage report for labkey
10
-
11
- [egg_info]
12
- tag_build =
13
- tag_date = 0
14
-
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes