synapseclient 3.2.0__tar.gz → 4.1.1__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 (104) hide show
  1. synapseclient-4.1.1/PKG-INFO +395 -0
  2. {synapseclient-3.2.0 → synapseclient-4.1.1}/README.md +10 -9
  3. {synapseclient-3.2.0 → synapseclient-4.1.1}/setup.cfg +18 -6
  4. {synapseclient-3.2.0 → synapseclient-4.1.1}/synapseclient/.synapseConfig +2 -2
  5. {synapseclient-3.2.0 → synapseclient-4.1.1}/synapseclient/__init__.py +4 -0
  6. {synapseclient-3.2.0 → synapseclient-4.1.1}/synapseclient/__main__.py +146 -133
  7. {synapseclient-3.2.0 → synapseclient-4.1.1}/synapseclient/activity.py +48 -61
  8. {synapseclient-3.2.0 → synapseclient-4.1.1}/synapseclient/annotations.py +165 -81
  9. synapseclient-4.1.1/synapseclient/api/__init__.py +7 -0
  10. synapseclient-4.1.1/synapseclient/api/annotations.py +42 -0
  11. {synapseclient-3.2.0 → synapseclient-4.1.1}/synapseclient/client.py +2096 -1323
  12. synapseclient-4.1.1/synapseclient/core/async_utils.py +127 -0
  13. {synapseclient-3.2.0 → synapseclient-4.1.1}/synapseclient/core/cache.py +68 -46
  14. {synapseclient-3.2.0 → synapseclient-4.1.1}/synapseclient/core/constants/concrete_types.py +4 -0
  15. synapseclient-4.1.1/synapseclient/core/constants/method_flags.py +4 -0
  16. synapseclient-4.1.1/synapseclient/core/credentials/__init__.py +2 -0
  17. synapseclient-4.1.1/synapseclient/core/credentials/cred_data.py +102 -0
  18. synapseclient-4.1.1/synapseclient/core/credentials/credential_provider.py +279 -0
  19. {synapseclient-3.2.0 → synapseclient-4.1.1}/synapseclient/core/exceptions.py +4 -14
  20. synapseclient-4.1.1/synapseclient/core/models/permission.py +190 -0
  21. {synapseclient-3.2.0 → synapseclient-4.1.1}/synapseclient/core/multithread_download/download_threads.py +88 -64
  22. {synapseclient-3.2.0 → synapseclient-4.1.1}/synapseclient/core/remote_file_storage_wrappers.py +119 -55
  23. {synapseclient-3.2.0 → synapseclient-4.1.1}/synapseclient/core/retry.py +35 -23
  24. {synapseclient-3.2.0 → synapseclient-4.1.1}/synapseclient/core/sts_transfer.py +18 -11
  25. {synapseclient-3.2.0 → synapseclient-4.1.1}/synapseclient/core/upload/multipart_upload.py +113 -65
  26. {synapseclient-3.2.0 → synapseclient-4.1.1}/synapseclient/core/upload/upload_functions.py +142 -69
  27. {synapseclient-3.2.0 → synapseclient-4.1.1}/synapseclient/core/utils.py +474 -135
  28. {synapseclient-3.2.0 → synapseclient-4.1.1}/synapseclient/core/version_check.py +26 -28
  29. {synapseclient-3.2.0 → synapseclient-4.1.1}/synapseclient/entity.py +207 -227
  30. {synapseclient-3.2.0 → synapseclient-4.1.1}/synapseclient/evaluation.py +89 -83
  31. synapseclient-4.1.1/synapseclient/models/__init__.py +47 -0
  32. synapseclient-4.1.1/synapseclient/models/activity.py +391 -0
  33. synapseclient-4.1.1/synapseclient/models/annotations.py +151 -0
  34. synapseclient-4.1.1/synapseclient/models/evaluation.py +1 -0
  35. synapseclient-4.1.1/synapseclient/models/file.py +902 -0
  36. synapseclient-4.1.1/synapseclient/models/folder.py +462 -0
  37. synapseclient-4.1.1/synapseclient/models/mixins/__init__.py +9 -0
  38. synapseclient-4.1.1/synapseclient/models/mixins/access_control.py +162 -0
  39. synapseclient-4.1.1/synapseclient/models/mixins/storable_container.py +422 -0
  40. synapseclient-4.1.1/synapseclient/models/project.py +510 -0
  41. synapseclient-4.1.1/synapseclient/models/protocols/__init__.py +1 -0
  42. synapseclient-4.1.1/synapseclient/models/protocols/access_control_protocol.py +107 -0
  43. synapseclient-4.1.1/synapseclient/models/protocols/activity_protocol.py +90 -0
  44. synapseclient-4.1.1/synapseclient/models/protocols/annotations_protocol.py +34 -0
  45. synapseclient-4.1.1/synapseclient/models/protocols/file_protocol.py +285 -0
  46. synapseclient-4.1.1/synapseclient/models/protocols/folder_protocol.py +133 -0
  47. synapseclient-4.1.1/synapseclient/models/protocols/project_protocol.py +162 -0
  48. synapseclient-4.1.1/synapseclient/models/protocols/storable_container_protocol.py +168 -0
  49. synapseclient-4.1.1/synapseclient/models/protocols/table_protocol.py +127 -0
  50. synapseclient-4.1.1/synapseclient/models/protocols/team_protocol.py +144 -0
  51. synapseclient-4.1.1/synapseclient/models/protocols/user_protocol.py +92 -0
  52. synapseclient-4.1.1/synapseclient/models/services/__init__.py +7 -0
  53. synapseclient-4.1.1/synapseclient/models/services/search.py +84 -0
  54. synapseclient-4.1.1/synapseclient/models/services/storable_entity_components.py +218 -0
  55. synapseclient-4.1.1/synapseclient/models/table.py +722 -0
  56. synapseclient-4.1.1/synapseclient/models/team.py +390 -0
  57. synapseclient-4.1.1/synapseclient/models/user.py +363 -0
  58. synapseclient-4.1.1/synapseclient/models/wiki.py +1 -0
  59. {synapseclient-3.2.0 → synapseclient-4.1.1}/synapseclient/synapsePythonClient +2 -2
  60. {synapseclient-3.2.0 → synapseclient-4.1.1}/synapseclient/table.py +526 -646
  61. synapseclient-4.1.1/synapseclient/team.py +108 -0
  62. {synapseclient-3.2.0 → synapseclient-4.1.1}/synapseclient/wiki.py +33 -47
  63. synapseclient-4.1.1/synapseclient.egg-info/PKG-INFO +395 -0
  64. {synapseclient-3.2.0 → synapseclient-4.1.1}/synapseclient.egg-info/SOURCES.txt +33 -1
  65. {synapseclient-3.2.0 → synapseclient-4.1.1}/synapseclient.egg-info/entry_points.txt +0 -1
  66. {synapseclient-3.2.0 → synapseclient-4.1.1}/synapseclient.egg-info/requires.txt +15 -8
  67. {synapseclient-3.2.0 → synapseclient-4.1.1}/synapseutils/__init__.py +2 -14
  68. {synapseclient-3.2.0 → synapseclient-4.1.1}/synapseutils/copy_functions.py +245 -224
  69. {synapseclient-3.2.0 → synapseclient-4.1.1}/synapseutils/describe_functions.py +45 -36
  70. {synapseclient-3.2.0 → synapseclient-4.1.1}/synapseutils/migrate_functions.py +74 -67
  71. {synapseclient-3.2.0 → synapseclient-4.1.1}/synapseutils/monitor.py +31 -28
  72. {synapseclient-3.2.0 → synapseclient-4.1.1}/synapseutils/sync.py +441 -205
  73. synapseclient-4.1.1/synapseutils/walk_functions.py +159 -0
  74. synapseclient-3.2.0/PKG-INFO +0 -357
  75. synapseclient-3.2.0/synapseclient/core/credentials/__init__.py +0 -4
  76. synapseclient-3.2.0/synapseclient/core/credentials/cached_sessions.py +0 -34
  77. synapseclient-3.2.0/synapseclient/core/credentials/cred_data.py +0 -197
  78. synapseclient-3.2.0/synapseclient/core/credentials/credential_provider.py +0 -295
  79. synapseclient-3.2.0/synapseclient/team.py +0 -101
  80. synapseclient-3.2.0/synapseclient.egg-info/PKG-INFO +0 -357
  81. synapseclient-3.2.0/synapseutils/walk_functions.py +0 -82
  82. {synapseclient-3.2.0 → synapseclient-4.1.1}/MANIFEST.in +0 -0
  83. {synapseclient-3.2.0 → synapseclient-4.1.1}/pyproject.toml +0 -0
  84. {synapseclient-3.2.0 → synapseclient-4.1.1}/setup.py +0 -0
  85. {synapseclient-3.2.0 → synapseclient-4.1.1}/synapseclient/core/__init__.py +0 -0
  86. {synapseclient-3.2.0 → synapseclient-4.1.1}/synapseclient/core/config.py +0 -0
  87. {synapseclient-3.2.0 → synapseclient-4.1.1}/synapseclient/core/constants/__init__.py +0 -0
  88. {synapseclient-3.2.0 → synapseclient-4.1.1}/synapseclient/core/constants/config_file_constants.py +0 -0
  89. {synapseclient-3.2.0 → synapseclient-4.1.1}/synapseclient/core/constants/limits.py +0 -0
  90. {synapseclient-3.2.0 → synapseclient-4.1.1}/synapseclient/core/cumulative_transfer_progress.py +0 -0
  91. {synapseclient-3.2.0 → synapseclient-4.1.1}/synapseclient/core/dozer.py +0 -0
  92. {synapseclient-3.2.0 → synapseclient-4.1.1}/synapseclient/core/lock.py +0 -0
  93. {synapseclient-3.2.0 → synapseclient-4.1.1}/synapseclient/core/logging_setup.py +0 -0
  94. {synapseclient-3.2.0 → synapseclient-4.1.1}/synapseclient/core/models/__init__.py +0 -0
  95. {synapseclient-3.2.0 → synapseclient-4.1.1}/synapseclient/core/models/custom_json.py +0 -0
  96. {synapseclient-3.2.0 → synapseclient-4.1.1}/synapseclient/core/models/dict_object.py +0 -0
  97. {synapseclient-3.2.0 → synapseclient-4.1.1}/synapseclient/core/multithread_download/__init__.py +0 -0
  98. {synapseclient-3.2.0 → synapseclient-4.1.1}/synapseclient/core/pool_provider.py +0 -0
  99. {synapseclient-3.2.0 → synapseclient-4.1.1}/synapseclient/core/upload/__init__.py +0 -0
  100. {synapseclient-3.2.0 → synapseclient-4.1.1}/synapseclient/services/__init__.py +0 -0
  101. {synapseclient-3.2.0 → synapseclient-4.1.1}/synapseclient/services/json_schema.py +0 -0
  102. {synapseclient-3.2.0 → synapseclient-4.1.1}/synapseclient.egg-info/dependency_links.txt +0 -0
  103. {synapseclient-3.2.0 → synapseclient-4.1.1}/synapseclient.egg-info/not-zip-safe +0 -0
  104. {synapseclient-3.2.0 → synapseclient-4.1.1}/synapseclient.egg-info/top_level.txt +0 -0
@@ -0,0 +1,395 @@
1
+ Metadata-Version: 2.1
2
+ Name: synapseclient
3
+ Version: 4.1.1
4
+ Summary: A client for Synapse, a collaborative, open-source research platform that allows teams to share data, track analyses, and collaborate.
5
+ Home-page: https://www.synapse.org
6
+ Author: The Synapse Engineering Team
7
+ Author-email: platform@sagebase.org
8
+ License: Apache-2.0
9
+ Project-URL: Source, https://github.com/Sage-Bionetworks/synapsePythonClient
10
+ Project-URL: Tracker, https://github.com/Sage-Bionetworks/synapsePythonClient/issues
11
+ Project-URL: Documentation, https://python-docs.synapse.org
12
+ Project-URL: Changelog, https://python-docs.synapse.org/build/html/index.html#release-notes
13
+ Platform: any
14
+ Classifier: Development Status :: 5 - Production/Stable
15
+ Classifier: Programming Language :: Python
16
+ Classifier: Programming Language :: Python :: 3.8
17
+ Classifier: Programming Language :: Python :: 3.9
18
+ Classifier: Programming Language :: Python :: 3.10
19
+ Classifier: Programming Language :: Python :: 3.11
20
+ Classifier: Operating System :: MacOS
21
+ Classifier: Operating System :: Microsoft :: Windows
22
+ Classifier: Operating System :: Unix
23
+ Classifier: Operating System :: POSIX :: Linux
24
+ Classifier: Intended Audience :: Developers
25
+ Classifier: Intended Audience :: Science/Research
26
+ Classifier: License :: OSI Approved :: Apache Software License
27
+ Classifier: Topic :: Software Development :: Libraries
28
+ Classifier: Topic :: Scientific/Engineering
29
+ Classifier: Topic :: Scientific/Engineering :: Bio-Informatics
30
+ Requires-Python: >=3.8
31
+ Description-Content-Type: text/markdown; charset=UTF-8; variant=GFM
32
+ Requires-Dist: requests<3.0,>=2.22.0
33
+ Requires-Dist: urllib3<2,>=1.26.18
34
+ Requires-Dist: deprecated<2.0,>=1.2.4
35
+ Requires-Dist: opentelemetry-api~=1.21.0
36
+ Requires-Dist: opentelemetry-sdk~=1.21.0
37
+ Requires-Dist: opentelemetry-exporter-otlp-proto-http~=1.21.0
38
+ Requires-Dist: nest-asyncio~=1.6.0
39
+ Provides-Extra: dev
40
+ Requires-Dist: pytest<7.0,>=6.0.0; extra == "dev"
41
+ Requires-Dist: pytest-mock<4.0,>=3.0; extra == "dev"
42
+ Requires-Dist: pytest-socket~=0.6.0; extra == "dev"
43
+ Requires-Dist: pytest-asyncio~=0.19; extra == "dev"
44
+ Requires-Dist: flake8<4.0,>=3.7.0; extra == "dev"
45
+ Requires-Dist: pytest-xdist[psutil]<3.0.0,>=2.2; extra == "dev"
46
+ Requires-Dist: pytest-rerunfailures~=12.0; extra == "dev"
47
+ Requires-Dist: func-timeout~=4.3; extra == "dev"
48
+ Requires-Dist: pytest-cov~=4.1.0; extra == "dev"
49
+ Requires-Dist: black; extra == "dev"
50
+ Requires-Dist: pre-commit; extra == "dev"
51
+ Provides-Extra: tests
52
+ Requires-Dist: pytest<7.0,>=6.0.0; extra == "tests"
53
+ Requires-Dist: pytest-mock<4.0,>=3.0; extra == "tests"
54
+ Requires-Dist: pytest-socket~=0.6.0; extra == "tests"
55
+ Requires-Dist: pytest-asyncio~=0.19; extra == "tests"
56
+ Requires-Dist: flake8<4.0,>=3.7.0; extra == "tests"
57
+ Requires-Dist: pytest-xdist[psutil]<3.0.0,>=2.2; extra == "tests"
58
+ Requires-Dist: pytest-rerunfailures~=12.0; extra == "tests"
59
+ Requires-Dist: func-timeout~=4.3; extra == "tests"
60
+ Requires-Dist: pytest-cov~=4.1.0; extra == "tests"
61
+ Provides-Extra: pandas
62
+ Requires-Dist: pandas<3.0,>=1.5; extra == "pandas"
63
+ Provides-Extra: pysftp
64
+ Requires-Dist: pysftp<0.3,>=0.2.8; extra == "pysftp"
65
+ Provides-Extra: boto3
66
+ Requires-Dist: boto3<2.0,>=1.7.0; extra == "boto3"
67
+ Provides-Extra: docs
68
+ Requires-Dist: mkdocs>=1.5.3; extra == "docs"
69
+ Requires-Dist: mkdocs-material>=9.4.14; extra == "docs"
70
+ Requires-Dist: mkdocstrings>=0.24.0; extra == "docs"
71
+ Requires-Dist: mkdocstrings-python>=1.7.5; extra == "docs"
72
+ Requires-Dist: termynal>=0.11.1; extra == "docs"
73
+ Requires-Dist: mkdocs-open-in-new-tab~=1.0.3; extra == "docs"
74
+ Requires-Dist: markdown-include~=0.8.1; extra == "docs"
75
+
76
+ Python Synapse Client
77
+ =====================
78
+
79
+ Branch | Build Status
80
+ --------|-------------
81
+ develop | [![Build Status develop branch](https://github.com/Sage-Bionetworks/synapsePythonClient/workflows/build/badge.svg?branch=develop)](https://github.com/Sage-Bionetworks/synapsePythonClient/actions?query=branch%3Adevelop)
82
+ master | [![Build Status master branch](https://github.com/Sage-Bionetworks/synapsePythonClient/workflows/build/badge.svg?branch=master)](https://github.com/Sage-Bionetworks/synapsePythonClient/actions?query=branch%3Amaster)
83
+
84
+ [![Get the synapseclient from PyPI](https://img.shields.io/pypi/v/synapseclient.svg)](https://pypi.python.org/pypi/synapseclient/) [![Supported Python Versions](https://img.shields.io/pypi/pyversions/synapseclient.svg)](https://pypi.python.org/pypi/synapseclient/)
85
+
86
+ A Python client for [Sage Bionetworks'](https://www.sagebase.org) [Synapse](https://www.synapse.org/), a collaborative, open-source research platform that allows teams to share data, track analyses, and collaborate. The Python client can be used as a library for development of software that communicates with Synapse or as a command-line utility.
87
+
88
+ There is also a [Synapse client for R](https://github.com/Sage-Bionetworks/synapser/).
89
+
90
+ Documentation
91
+ -------------
92
+
93
+ For more information about the Python client, see:
94
+
95
+ * [Python client API docs](https://python-docs.synapse.org)
96
+
97
+ For more information about interacting with Synapse, see:
98
+
99
+ * [Synapse API docs](https://rest-docs.synapse.org/rest/)
100
+ * [Use cases](https://help.synapse.org/docs/Use-Cases.1985151645.html)
101
+ * [Getting Started Guide to Synapse](https://help.synapse.org/docs/Getting-Started.2055471150.html)
102
+
103
+ For release information, see:
104
+
105
+ * [Release notes](https://python-docs.synapse.org/news/)
106
+
107
+ <!-- Subscribe to release and other announcements [here](https://groups.google.com/a/sagebase.org/forum/#!forum/python-announce)
108
+ or by sending an email to [python-announce+subscribe@sagebase.org](mailto:python-announce+subscribe@sagebase.org) -->
109
+
110
+
111
+ Installation
112
+ ------------
113
+
114
+ The Python Synapse client has been tested on 3.8, 3.9, 3.10 and 3.11 on Mac OS X, Ubuntu Linux and Windows.
115
+
116
+ **Starting from Synapse Python client version 3.0, Synapse Python client requires Python >= 3.8**
117
+
118
+ ### Install using pip
119
+
120
+ The [Python Synapse Client is on PyPI](https://pypi.python.org/pypi/synapseclient) and can be installed with pip:
121
+
122
+ (sudo) pip install synapseclient[pandas,pysftp]
123
+
124
+ ...or to upgrade an existing installation of the Synapse client:
125
+
126
+ (sudo) pip install --upgrade synapseclient
127
+
128
+ The dependencies on `pandas` and `pysftp` are optional. Synapse [Tables](https://python-docs.synapse.org/reference/tables/) integrate
129
+ with [Pandas](http://pandas.pydata.org/). The library `pysftp` is required for users of
130
+ [SFTP](https://python-docs.synapse.org/guides/data_storage/#sftp) file storage. Both libraries require native code
131
+ to be compiled or installed separately from prebuilt binaries.
132
+
133
+ ### Install from source
134
+
135
+ Clone the [source code repository](https://github.com/Sage-Bionetworks/synapsePythonClient).
136
+
137
+ git clone git://github.com/Sage-Bionetworks/synapsePythonClient.git
138
+ cd synapsePythonClient
139
+ pip install .
140
+
141
+
142
+ Command line usage
143
+ ------------------
144
+
145
+ The Synapse client can be used from the shell command prompt. Valid commands
146
+ include: query, get, cat, add, update, delete, and onweb. A few examples are
147
+ shown.
148
+
149
+ ### downloading test data from Synapse
150
+
151
+ synapse -p auth_token get syn1528299
152
+
153
+ ### getting help
154
+
155
+ synapse -h
156
+
157
+ Note that a [Synapse account](https://www.synapse.org/#RegisterAccount:0) is required.
158
+
159
+
160
+ Usage as a library
161
+ ------------------
162
+
163
+ The Synapse client can be used to write software that interacts with the Sage Bionetworks Synapse repository. More examples can be found in the Tutorial section found [here](https://python-docs.synapse.org/tutorials/home/)
164
+
165
+ ### Examples
166
+
167
+ #### Log-in and create a Synapse object
168
+ ```
169
+ import synapseclient
170
+
171
+ syn = synapseclient.Synapse()
172
+ ## You may optionally specify the debug flag to True to print out debug level messages.
173
+ ## A debug level may help point to issues in your own code, or uncover a bug within ours.
174
+ # syn = synapseclient.Synapse(debug=True)
175
+
176
+ ## log in using auth token
177
+ syn.login(authToken='auth_token')
178
+ ```
179
+
180
+ #### Sync a local directory to synapse
181
+ This is the recommended way of synchronizing more than one file or directory to a synapse project through the use of `synapseutils`. Using this library allows us to handle scheduling everything required to sync an entire directory tree. Read more about the manifest file format in [`synapseutils.syncToSynapse`](https://python-docs.synapse.org/reference/synapse_utils/#synapseutils.sync.syncToSynapse)
182
+ ```
183
+ import synapseclient
184
+ import synapseutils
185
+ import os
186
+
187
+ syn = synapseclient.Synapse()
188
+
189
+ ## log in using auth token
190
+ syn.login(authToken='auth_token')
191
+
192
+ path = os.path.expanduser("~/synapse_project")
193
+ manifest_path = f"{path}/my_project_manifest.tsv"
194
+ project_id = "syn1234"
195
+
196
+ # Create the manifest file on disk
197
+ with open(manifest_path, "w", encoding="utf-8") as f:
198
+ pass
199
+
200
+ # Walk the specified directory tree and create a TSV manifest file
201
+ synapseutils.generate_sync_manifest(
202
+ syn,
203
+ directory_path=path,
204
+ parent_id=project_id,
205
+ manifest_path=manifest_path,
206
+ )
207
+
208
+ # Using the generated manifest file, sync the files to Synapse
209
+ synapseutils.syncToSynapse(
210
+ syn,
211
+ manifestFile=manifest_path,
212
+ sendMessages=False,
213
+ )
214
+ ```
215
+
216
+ #### Store a Project to Synapse
217
+ ```
218
+ import synapseclient
219
+ from synapseclient.entity import Project
220
+
221
+ syn = synapseclient.Synapse()
222
+
223
+ ## log in using auth token
224
+ syn.login(authToken='auth_token')
225
+
226
+ project = Project('My uniquely named project')
227
+ project = syn.store(project)
228
+
229
+ print(project.id)
230
+ print(project)
231
+ ```
232
+
233
+ #### Store a Folder to Synapse (Does not upload files within the folder)
234
+ ```
235
+ import synapseclient
236
+
237
+ syn = synapseclient.Synapse()
238
+
239
+ ## log in using auth token
240
+ syn.login(authToken='auth_token')
241
+
242
+ folder = Folder(name='my_folder', parent="syn123")
243
+ folder = syn.store(folder)
244
+
245
+ print(folder.id)
246
+ print(folder)
247
+
248
+ ```
249
+
250
+ #### Store a File to Synapse
251
+ ```
252
+ import synapseclient
253
+
254
+ syn = synapseclient.Synapse()
255
+
256
+ ## log in using auth token
257
+ syn.login(authToken='auth_token')
258
+
259
+ file = File(
260
+ path=filepath,
261
+ parent="syn123",
262
+ )
263
+ file = syn.store(file)
264
+
265
+ print(file.id)
266
+ print(file)
267
+ ```
268
+
269
+ #### Get a data matrix
270
+ ```
271
+ import synapseclient
272
+
273
+ syn = synapseclient.Synapse()
274
+
275
+ ## log in using auth token
276
+ syn.login(authToken='auth_token')
277
+
278
+ ## retrieve a 100 by 4 matrix
279
+ matrix = syn.get('syn1901033')
280
+
281
+ ## inspect its properties
282
+ print(matrix.name)
283
+ print(matrix.description)
284
+ print(matrix.path)
285
+
286
+ ## load the data matrix into a dictionary with an entry for each column
287
+ with open(matrix.path, 'r') as f:
288
+ labels = f.readline().strip().split('\t')
289
+ data = {label: [] for label in labels}
290
+ for line in f:
291
+ values = [float(x) for x in line.strip().split('\t')]
292
+ for i in range(len(labels)):
293
+ data[labels[i]].append(values[i])
294
+
295
+ ## load the data matrix into a numpy array
296
+ import numpy as np
297
+ np.loadtxt(fname=matrix.path, skiprows=1)
298
+ ```
299
+
300
+
301
+ Authentication
302
+ --------------
303
+ Authentication toward [Synapse](https://www.synapse.org/#RegisterAccount:0) can be accomplished with the clients using personal access tokens. Learn more about [Synapse personal access tokens](https://help.synapse.org/docs/Managing-Your-Account.2055405596.html#ManagingYourAccount-PersonalAccessTokens)
304
+
305
+ Learn about the [multiple ways one can login to Synapse](https://python-docs.synapse.org/tutorials/authentication/).
306
+
307
+
308
+ Synapse Utilities (synapseutils)
309
+ --------------------------------
310
+
311
+ The purpose of synapseutils is to create a space filled with convenience functions that includes traversing through large projects, copying entities, recursively downloading files and many more.
312
+
313
+ ### Example
314
+
315
+ import synapseutils
316
+ import synapseclient
317
+ syn = synapseclient.login()
318
+
319
+ # copies all Synapse entities to a destination location
320
+ synapseutils.copy(syn, "syn1234", destinationId = "syn2345")
321
+
322
+ # copies the wiki from the entity to a destination entity. Only a project can have sub wiki pages.
323
+ synapseutils.copyWiki(syn, "syn1234", destinationId = "syn2345")
324
+
325
+
326
+ # Traverses through Synapse directories, behaves exactly like os.walk()
327
+ walkedPath = synapseutils.walk(syn, "syn1234")
328
+
329
+ for dirpath, dirname, filename in walkedPath:
330
+ print(dirpath)
331
+ print(dirname)
332
+ print(filename)
333
+
334
+ OpenTelemetry (OTEL)
335
+ --------------------------------
336
+ [OpenTelemetry](https://opentelemetry.io/) helps support the analysis of traces and spans which can provide insights into latency, errors, and other performance metrics. The synapseclient is ready to provide traces should you want them. The Synapse Python client supports OTLP Exports and can be configured via environment variables as defined [here](https://opentelemetry-python.readthedocs.io/en/stable/exporter/otlp/otlp.html).
337
+
338
+ Read more about OpenTelemetry in Python [here](https://opentelemetry.io/docs/instrumentation/python/)
339
+
340
+ ### Quick-start
341
+ The following shows an example of setting up [jaegertracing](https://www.jaegertracing.io/docs/1.50/deployment/#all-in-one) via docker and executing a simple python script that implements the Synapse Python client.
342
+
343
+ #### Running the jaeger docker container
344
+ Start a docker container with the following options:
345
+ ```
346
+ docker run --name jaeger \
347
+ -e COLLECTOR_OTLP_ENABLED=true \
348
+ -p 16686:16686 \
349
+ -p 4318:4318 \
350
+ jaegertracing/all-in-one:latest
351
+ ```
352
+ Explanation of ports:
353
+ * `4318` HTTP
354
+ * `16686` Jaeger UI
355
+
356
+ Once the docker container is running you can access the Jaeger UI via: `http://localhost:16686`
357
+
358
+ #### Example
359
+ By default the OTEL exporter sends trace data to `http://localhost:4318/v1/traces`, however you may override this by setting the `OTEL_EXPORTER_OTLP_TRACES_ENDPOINT` environment variable.
360
+
361
+ ```
362
+ import synapseclient
363
+ from opentelemetry import trace
364
+ from opentelemetry.sdk.trace import TracerProvider
365
+ from opentelemetry.sdk.trace.export import BatchSpanProcessor
366
+ from opentelemetry.sdk.resources import SERVICE_NAME, Resource
367
+ from opentelemetry.exporter.otlp.proto.http.trace_exporter import OTLPSpanExporter
368
+
369
+ trace.set_tracer_provider(
370
+ TracerProvider(
371
+ resource=Resource(attributes={SERVICE_NAME: "my_own_code_above_synapse_client"})
372
+ )
373
+ )
374
+ trace.get_tracer_provider().add_span_processor(BatchSpanProcessor(OTLPSpanExporter()))
375
+ tracer = trace.get_tracer("my_tracer")
376
+
377
+ @tracer.start_as_current_span("my_span_name")
378
+ def main():
379
+ syn = synapseclient.Synapse()
380
+ syn.login()
381
+ my_entity = syn.get("syn52569429")
382
+ print(my_entity)
383
+
384
+ main()
385
+ ```
386
+
387
+
388
+
389
+
390
+ License and Copyright
391
+ ---------------------
392
+
393
+ &copy; Copyright 2013-23 Sage Bionetworks
394
+
395
+ This software is licensed under the [Apache License, Version 2.0](http://www.apache.org/licenses/LICENSE-2.0).
@@ -22,12 +22,12 @@ For more information about the Python client, see:
22
22
  For more information about interacting with Synapse, see:
23
23
 
24
24
  * [Synapse API docs](https://rest-docs.synapse.org/rest/)
25
- * [User cases](https://help.synapse.org/docs/Use-Cases.1985151645.html)
25
+ * [Use cases](https://help.synapse.org/docs/Use-Cases.1985151645.html)
26
26
  * [Getting Started Guide to Synapse](https://help.synapse.org/docs/Getting-Started.2055471150.html)
27
27
 
28
28
  For release information, see:
29
29
 
30
- * [Release notes](https://python-docs.synapse.org/build/html/news.html)
30
+ * [Release notes](https://python-docs.synapse.org/news/)
31
31
 
32
32
  <!-- Subscribe to release and other announcements [here](https://groups.google.com/a/sagebase.org/forum/#!forum/python-announce)
33
33
  or by sending an email to [python-announce+subscribe@sagebase.org](mailto:python-announce+subscribe@sagebase.org) -->
@@ -50,9 +50,9 @@ The [Python Synapse Client is on PyPI](https://pypi.python.org/pypi/synapseclien
50
50
 
51
51
  (sudo) pip install --upgrade synapseclient
52
52
 
53
- The dependencies on `pandas` and `pysftp` are optional. Synapse [Tables](http://python-docs.synapse.org/build/html/#tables) integrate
53
+ The dependencies on `pandas` and `pysftp` are optional. Synapse [Tables](https://python-docs.synapse.org/reference/tables/) integrate
54
54
  with [Pandas](http://pandas.pydata.org/). The library `pysftp` is required for users of
55
- [SFTP](http://python-docs.synapse.org/build/html/sftp.html) file storage. Both libraries require native code
55
+ [SFTP](https://python-docs.synapse.org/guides/data_storage/#sftp) file storage. Both libraries require native code
56
56
  to be compiled or installed separately from prebuilt binaries.
57
57
 
58
58
  ### Install from source
@@ -85,7 +85,7 @@ Note that a [Synapse account](https://www.synapse.org/#RegisterAccount:0) is req
85
85
  Usage as a library
86
86
  ------------------
87
87
 
88
- The Synapse client can be used to write software that interacts with the Sage Bionetworks Synapse repository. More examples can be found in the Tutorial section found [here](https://python-docs.synapse.org/build/html/getting_started/basics.html)
88
+ The Synapse client can be used to write software that interacts with the Sage Bionetworks Synapse repository. More examples can be found in the Tutorial section found [here](https://python-docs.synapse.org/tutorials/home/)
89
89
 
90
90
  ### Examples
91
91
 
@@ -94,13 +94,16 @@ The Synapse client can be used to write software that interacts with the Sage Bi
94
94
  import synapseclient
95
95
 
96
96
  syn = synapseclient.Synapse()
97
+ ## You may optionally specify the debug flag to True to print out debug level messages.
98
+ ## A debug level may help point to issues in your own code, or uncover a bug within ours.
99
+ # syn = synapseclient.Synapse(debug=True)
97
100
 
98
101
  ## log in using auth token
99
102
  syn.login(authToken='auth_token')
100
103
  ```
101
104
 
102
105
  #### Sync a local directory to synapse
103
- This is the recommended way of synchronizing more than one file or directory to a synapse project through the use of `synapseutils`. Using this library allows us to handle scheduling everything required to sync an entire directory tree. Read more about the manifest file format in [`synapseutils.syncToSynapse`](https://python-docs.synapse.org/build/html/articles/synapseutils.html#synapseutils.sync.syncToSynapse)
106
+ This is the recommended way of synchronizing more than one file or directory to a synapse project through the use of `synapseutils`. Using this library allows us to handle scheduling everything required to sync an entire directory tree. Read more about the manifest file format in [`synapseutils.syncToSynapse`](https://python-docs.synapse.org/reference/synapse_utils/#synapseutils.sync.syncToSynapse)
104
107
  ```
105
108
  import synapseclient
106
109
  import synapseutils
@@ -224,9 +227,7 @@ Authentication
224
227
  --------------
225
228
  Authentication toward [Synapse](https://www.synapse.org/#RegisterAccount:0) can be accomplished with the clients using personal access tokens. Learn more about [Synapse personal access tokens](https://help.synapse.org/docs/Managing-Your-Account.2055405596.html#ManagingYourAccount-PersonalAccessTokens)
226
229
 
227
- Authentication via passwords and API keys will be deprecated early 2024.
228
-
229
- Learn about the multiple ways one can login to Synapse [here](https://python-docs.synapse.org/build/html/getting_started/credentials.html).
230
+ Learn about the [multiple ways one can login to Synapse](https://python-docs.synapse.org/tutorials/authentication/).
230
231
 
231
232
 
232
233
  Synapse Utilities (synapseutils)
@@ -40,47 +40,59 @@ python_requires = >=3.8
40
40
  install_requires =
41
41
  requests>=2.22.0,<3.0
42
42
  urllib3>=1.26.18,<2
43
- keyring>=15,<23.5
44
- keyrings.alt==3.1; sys_platform == "linux"
45
43
  deprecated>=1.2.4,<2.0
46
44
  opentelemetry-api~=1.21.0
47
45
  opentelemetry-sdk~=1.21.0
48
46
  opentelemetry-exporter-otlp-proto-http~=1.21.0
47
+ nest-asyncio~=1.6.0
49
48
  tests_require =
50
49
  pytest>=6.0.0,<7.0
51
50
  pytest-mock>=3.0,<4.0
51
+ pytest-socket~=0.6.0
52
+ pytest-asyncio~=0.19
52
53
  flake8>=3.7.0,<4.0
53
54
  pytest-xdist[psutil]>=2.2,<3.0.0
54
55
  pytest-rerunfailures~=12.0
55
56
  func-timeout~=4.3
57
+ pytest-cov~=4.1.0
56
58
 
57
59
  [options.extras_require]
58
60
  dev =
59
61
  pytest>=6.0.0,<7.0
60
62
  pytest-mock>=3.0,<4.0
63
+ pytest-socket~=0.6.0
64
+ pytest-asyncio~=0.19
61
65
  flake8>=3.7.0,<4.0
62
66
  pytest-xdist[psutil]>=2.2,<3.0.0
63
67
  pytest-rerunfailures~=12.0
64
68
  func-timeout~=4.3
69
+ pytest-cov~=4.1.0
65
70
  black
66
71
  pre-commit
67
72
  tests =
68
73
  pytest>=6.0.0,<7.0
69
74
  pytest-mock>=3.0,<4.0
75
+ pytest-socket~=0.6.0
76
+ pytest-asyncio~=0.19
70
77
  flake8>=3.7.0,<4.0
71
78
  pytest-xdist[psutil]>=2.2,<3.0.0
72
79
  pytest-rerunfailures~=12.0
73
80
  func-timeout~=4.3
81
+ pytest-cov~=4.1.0
74
82
  pandas =
75
- pandas>=1.5,<2.1
83
+ pandas>=1.5,<3.0
76
84
  pysftp =
77
85
  pysftp>=0.2.8,<0.3
78
86
  boto3 =
79
87
  boto3>=1.7.0,<2.0
80
88
  docs =
81
- sphinx>=4.0,<5.0
82
- sphinx-argparse>=0.2,<0.3
83
- sphinx_rtd_theme
89
+ mkdocs>=1.5.3
90
+ mkdocs-material>=9.4.14
91
+ mkdocstrings>=0.24.0
92
+ mkdocstrings-python>=1.7.5
93
+ termynal>=0.11.1
94
+ mkdocs-open-in-new-tab~=1.0.3
95
+ markdown-include~=0.8.1
84
96
 
85
97
  [options.entry_points]
86
98
  console_scripts =
@@ -2,8 +2,8 @@
2
2
  # Login Credentials #
3
3
  ###########################
4
4
 
5
- ## Used for logging in to Synapse
6
- ## Alternatively, you can use rememberMe=True in synapseclient.login or login subcommand of the commandline client.
5
+ ## Used for logging in to Synapse. See https://python-docs.synapse.org/tutorials/authentication/
6
+ ## for information on retrieving an auth token.
7
7
  #[authentication]
8
8
  #username = <username>
9
9
  #authtoken = <authtoken>
@@ -26,9 +26,11 @@ from .table import (
26
26
  SubmissionViewSchema,
27
27
  MaterializedViewSchema,
28
28
  Dataset,
29
+ delete_rows,
29
30
  )
30
31
  from .team import Team, UserProfile, UserGroupHeader, TeamMember
31
32
  from .wiki import Wiki
33
+ from .core.models.permission import Permissions
32
34
 
33
35
  # ref = importlib.resources.files(__name__).joinpath("synapsePythonClient")
34
36
  # with ref.open("r") as fp:
@@ -66,9 +68,11 @@ __all__ = [
66
68
  "SubmissionViewSchema",
67
69
  "MaterializedViewSchema",
68
70
  "Dataset",
71
+ "Permissions",
69
72
  # functions
70
73
  "login",
71
74
  "build_table",
75
+ "delete_rows",
72
76
  "as_table_columns",
73
77
  "check_for_updates",
74
78
  "release_notes",