Programmatic interface to Synapse services for Python

Overview

Python Synapse Client

Branch Build Status
develop Build Status develop branch
master Build Status master branch

Get the synapseclient from PyPI Supported Python Versions

A Python client for Sage Bionetworks' Synapse, 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.

There is also a Synapse client for R.

Documentation

For more information about the Python client, see:

For more information about interacting with Synapse, see:

For release information, see:

Subscribe to release and other announcements here or by sending an email to [email protected]

Installation

The Python Synapse client has been tested on 3.6, 3.7, and 3.8 on Mac OS X, Ubuntu Linux and Windows.

Starting from Synapse Python client version 2.0, Synapse Python client requires Python 3.6+

Install using pip

The Python Synapse Client is on PyPI and can be installed with pip:

(sudo) pip install synapseclient[pandas,pysftp]

...or to upgrade an existing installation of the Synapse client:

(sudo) pip install --upgrade synapseclient

The dependencies on pandas and pysftp are optional. Synapse Tables integrate with Pandas. The library pysftp is required for users of SFTP file storage. Both libraries require native code to be compiled or installed separately from prebuilt binaries.

Install from source

Clone the source code repository.

git clone git://github.com/Sage-Bionetworks/synapsePythonClient.git
cd synapsePythonClient
python setup.py install

Command line usage

The Synapse client can be used from the shell command prompt. Valid commands include: query, get, cat, add, update, delete, and onweb. A few examples are shown.

downloading test data from Synapse

synapse -u my_username -p my_password get syn1528299

getting help

synapse -h

Note that a Synapse account is required.

Usage as a library

The Synapse client can be used to write software that interacts with the Sage Bionetworks Synapse repository.

Example

import synapseclient

syn = synapseclient.Synapse()

## log in using username and password
syn.login('my_username', 'my_password')

## retrieve a 100 by 4 matrix
matrix = syn.get('syn1901033')

## inspect its properties
print(matrix.name)
print(matrix.description)
print(matrix.path)

## load the data matrix into a dictionary with an entry for each column
with open(matrix.path, 'r') as f:
    labels = f.readline().strip().split('\t')
    data = {label: [] for label in labels}
    for line in f:
        values = [float(x) for x in line.strip().split('\t')]
        for i in range(len(labels)):
            data[labels[i]].append(values[i])

## load the data matrix into a numpy array
import numpy as np
np.loadtxt(fname=matrix.path, skiprows=1)

Authentication

Authentication toward Synapse can be accomplished in a few different ways. One is by passing username and password to the syn.login function.

import synapseclient
syn = synapseclient.Synapse()
syn.login('my_username', 'my_password')

It is much more convenient to use an API key, which can be generated and cached locally by doing the following once:

syn.login('my_username', 'my_password', rememberMe=True)

Then, in subsequent interactions, specifying username and password is optional and only needed to login as a different user. Calling login with no arguments uses cached credentials when they are available.

syn.login('my_username')

As a short-cut, creating the Synapse object and logging in can be done in one step:

import synapseclient
syn = synapseclient.login()

Caching credentials can also be done from the command line client:

synapse login -u my_username -p my_password --rememberMe

Synapse Utilities (synapseutils)

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.

Example

import synapseutils
import synapseclient
syn = synapseclient.login()

#COPY: copies all Synapse entities to a destination location
synapseutils.copy(syn, "syn1234", destinationId = "syn2345")

#COPY WIKI: copies the wiki from the entity to a destination entity. Only a project can have sub wiki pages.
synapseutils.copyWiki(syn, "syn1234", destinationId = "syn2345")


#WALK: Traverses through Synapse directories, behaves exactly like os.walk()
walkedPath = synapseutils.walk(syn, "syn1234")

for dirpath, dirname, filename in walkedPath:
    print(dirpath)
    print(dirname)
    print(filename)

License and Copyright

© Copyright 2013-19 Sage Bionetworks

This software is licensed under the Apache License, Version 2.0.

Comments
  • Synapse login not the same with `authToken` and `apiKey`

    Synapse login not the same with `authToken` and `apiKey`

    Bug Report

    Operating system

    MacOS Big Sur

    Client version

    Versions 2.2.2 and 2.3.1.

    Description of the problem

    When using the .synapseConfig file (with the apiKey attribute) as in (for example) synapseclient==2.2.2) the synapseclient.Synapse.login() method works perfectly. However, when using the .synapseConfig (with the authToken attribute) as in (for example), synapseclient==2.3.1), the login method doesn't work as expected.

    A minimal reproducible example:

    • Install version 2.2.2 of the synapseclient
    $ pip install synapseclient==2.2.2
    
    $ python
    >>> import synapseclient
    >>> syn = synapseclient.Synapse(configPath='/Users/spatil/Desktop/schematic/.synapseConfig')
    >>> syn.login(silent=True)
    
    • Repeat the above with version 2.3.1
    • Observe the differences in behaviour

    Note: Make sure to you the right versions of the .synapseConfig file too.

    Expected behavior

    User should be logged in successfully.

    Actual behavior

    No output to console when testing with synapseclient==2.3.1 and using .synapseConfig file with authToken.

    opened by sujaypatil96 11
  • UnicodeDecodeError on special characters when storing file

    UnicodeDecodeError on special characters when storing file

    Bug Report

    Operating system

    Ubuntu 18.04

    Client version

    1.9.2

    Description of the problem

    Throws exception when uploading a file where the file path contains special characters.

    This is a blocking issue for us.

    Repro Script:

    #!/usr/bin/env python
    # -*- coding: utf-8 -*-
    
    import synapseclient
    
    filename = "TestûTest.txt"
    
    with open(filename, mode='w') as f:
        f.write('test text')
    
    syn = synapseclient.Synapse()
    syn.login()
    syn.store(synapseclient.File(path=filename, parent="syn18521874"))
    

    Expected behavior

    Does not error. Uploads file.

    Actual behavior

    Throws exception. Does not upload file.

    Traceback (most recent call last):
      File "./bug.py", line 14, in <module>
        syn.store(synapseclient.File(path=filename, parent="syn18521874"))
      File "/home/user/source/.venv/local/lib/python2.7/site-packages/synapseclient/entity.py", line 578, in __init__
        kwargs['name'] = utils.guess_file_name(path)
      File "/home/user/source/.venv/local/lib/python2.7/site-packages/synapseclient/utils.py", line 243, in guess_file_name
        tokens = [x for x in path.split('/') if x != '']
    UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 62: ordinal not in range(128)
    
    bug 
    opened by pcstout 11
  • [SYNPY-1165] Generate manifest template from local folder structure

    [SYNPY-1165] Generate manifest template from local folder structure

    I added a generateUploadManifest() function to synapseutils that generates a manifest for uploading an entire directory tree. The key is that it replicates the local folder structure on Synapse so you can list the parent IDs in the generated manifest.

    This is a draft because I still need to flesh out the documentation and add unit/integration tests. I had a version that handled dashes (-) for input and output as stdin and stdout, respectively, but I've omitted those changes from this PR for now.

    ❯ synapse manifest --parentId syn25922647 --manifestFile /dev/stdout ./docs | synapse sync /dev/stdin
    
    Validation and upload of: /dev/stdin
    Validating columns of manifest.....OK
    Validating that all paths exist.............................................................................OK
    Validating that all files are unique...OK
    Validating that all the files are not empty...OK
    Validating provenance...OK
    Validating that parents exist and are containers...OK
    ==================================================
    We are about to upload 77 files with a total size of 1.6MB.
     ==================================================
    Starting upload...
    
    opened by BrunoGrandePhD 8
  • maxThreads configurable

    maxThreads configurable

    1. Extends the threading configurability to allow you to specify a value for S3 downloads as well as uploads since it seems nicely symmetrical that way.
    2. Adds a [transfer] section to the synapseConfig with a maxThreads option for specifying the setting so you don't have to always specify it on each call.
    3. Makes the public facing API param for maxThreads mixed case since that matches the existing convention on those calls. Internal function params may still be snake_cased per PEP8.
    4. Adds some doc for this to the release notes.
    opened by jkiang13 7
  • 2to3

    2to3

    Hey,

    Not sure why your code is not compatible with python3. Anyway I ported it mostly using 2to3, and some manual changes, and tested some basic features like login, and get.

    I'll be using python3, and will try to fix issues if I encounter any.

    Cheers, Adrin.

    opened by adrinjalali 7
  • [SYNPY-1207] Add Dataset support

    [SYNPY-1207] Add Dataset support

    This PR will add initial support for the new Datasets entity (mentioned by this JIRA ticket), including methods such as:

    • adding a single DatasetItem
    • adding a list of DatasetItems
    • removing a single DatasetItem
    • ~~adding a Synapse Folder to the Dataset~~
    • ~~adding a list of Synapse Folders to the Dataset~~
    opened by vpchung 6
  • Data are uploaded in duplicate if rows are added and the schema changes simulatneously

    Data are uploaded in duplicate if rows are added and the schema changes simulatneously

    As discussed in the RTI/Synapse call, we are seeing duplicated rows in data uploaded to the server while uploading batched data to Synapse. For each table, we load flattened JSON data into a pandas dataframe after processing every 100 records, the data gets saved to Synapse by calling store(). The issue arrises after the initial upload of the table, when during the second upload rows are added and the schema changes.

    To reproduce the issue, run the dup_test.py file in our github repo: synapse-span-table

    Operating system

    • Docker image (Ubuntu Linux) running on AWS or OSX

    Client version

    2.3.1
    
    opened by esurface 6
  • SYNPY-1058 username not required with authtoken

    SYNPY-1058 username not required with authtoken

    Per validation feedback, this makes it so that username is not needed with an auth token login, and furthermore logging in with a username and an auth token will raise an error if the token doesn't match the user (rather than ambiguously logging in to the token user ignoring the username).

    Per feedback, we also now require a view scoped token since lacking a view scope can fail in unexpected ways as the client makes many meta data calls.

    opened by jkiang13 6
  • KeyError when trying to download using Synapse Client 1.8.1

    KeyError when trying to download using Synapse Client 1.8.1

    I am trying to download syn3157325 using files = synapseutils.syncFromSynapse(syn, 'syn3157325', path = 'ROSMAP/'). I get the error

    Traceback (most recent call last):
      File "download_data.py", line 32, in <module>
        files = synapseutils.syncFromSynapse(syn, 'syn3157325', path = 'ROSMAP/')
      File "/apps/software/Python/3.6.3-foss-2015b/lib/python3.6/site-packages/synapseutils/sync.py", line 104, in syncFromSynapse
        generateManifest(syn, allFiles, filename)
      File "/apps/software/Python/3.6.3-foss-2015b/lib/python3.6/site-packages/synapseutils/sync.py", line 116, in generateManifest
        keys, data = _extract_file_entity_metadata(syn, allFiles)
      File "/apps/software/Python/3.6.3-foss-2015b/lib/python3.6/site-packages/synapseutils/sync.py", line 135, in _extract_file_entity_metadata
        row.update(_get_file_entity_provenance_dict(syn, entity))
      File "/apps/software/Python/3.6.3-foss-2015b/lib/python3.6/site-packages/synapseutils/sync.py", line 152, in _get_file_entity_provenance_dict
        'executed' : ';'.join(prov._getExecutedStringList()),
      File "/apps/software/Python/3.6.3-foss-2015b/lib/python3.6/site-packages/synapseclient/activity.py", line 339, in _getExecutedStringList
        return self._getStringList(wasExecuted=True)
      File "/apps/software/Python/3.6.3-foss-2015b/lib/python3.6/site-packages/synapseclient/activity.py", line 329, in _getStringList
        usedList.append(source['name'])
    

    printing usedList:

    {'wasExecuted': True, 'concreteType': 'org.sagebionetworks.repo.model.provenance.UsedURL', 'url': 'https://github.com/Sage-Bionetworks/ampAdScripts/blob/master/Broad-Rush/migrateROSMAPGenotypesFeb2015.R'}

    I put a try/except around usedList.append(source['name']), as far as I double check it allowed me to download all the data correctly.

    opened by npklein 6
  • Add ability to set annotations from the command line.

    Add ability to set annotations from the command line.

    Added command line function for setting annotations. This works with the user passing a JSON string as annotations, which must evaluate to a dict.

    Some missing components:

    1. Should check type of each annotation to make sure it's allowed (string, int, float, lists).
    2. Doesn't handle dates (as no JSON does). I've seen a number of options (e.g. {'mydate': Date(2012-08-07T07:47:46Z)'}, and then using a regex to parse the dates.

    Feedback would be much appreciated.

    opened by kdaily 6
  • SynapseFileCacheError on Ubuntu Server edition

    SynapseFileCacheError on Ubuntu Server edition

    Bug Report

    Operating system

    Ubuntu Server 18.04

    Client version

    1.9.1

    Description of the problem

    Something related to mime when attempting to store data on Synapse. Dependency issue on Ubuntu Server edition? On the desktop editions of Ubuntu 18.04 or Debian 9 the issue is absent using the same synapseclient version and same file to upload.

    In [1] import synapseclient
    In [2] syn = synapseclient.login()
    In [3] f ="/path/to/file"
    In [4] syn.store(synapseclient.File(f, parent = "syn17931318"))
    
    ##################################################
     Uploading file to Synapse storage
    ##################################################
    
    ---------------------------------------------------------------------------
    SynapseFileCacheError                     Traceback (most recent call last)
    <ipython-input-4-cbd9cbaa63f3> in <module>
    ----> 1 syn.store(synapseclient.File(f, parent = "syn17931318"))
    
    ~/.local/lib/python3.6/site-packages/synapseclient/client.py in store(self, obj, **kwargs)
        969                                                 md5=local_state_fh.get('contentMd5'),
        970                                                 file_size=local_state_fh.get('contentSize'),
    --> 971                                                 mimetype=local_state_fh.get('contentType'))
        972                 properties['dataFileHandleId'] = fileHandle['id']
        973                 local_state['_file_handle'] = fileHandle
    
    ~/.local/lib/python3.6/site-packages/synapseclient/upload_functions.py in upload_file_handle(syn, parent_entity, path, synapseStore, md5, file_size, mimetype)
         65         syn.logger.info('\n' + '#' * 50 + '\n Uploading file to ' + storageString + ' storage \n' + '#' * 50 + '\n')
         66
    ---> 67         return upload_synapse_s3(syn, expanded_upload_path, location['storageLocationId'], mimetype=mimetype)
         68     # external file handle (sftp)
         69     elif upload_destination_type == concrete_types.EXTERNAL_UPLOAD_DESTINATION:
    
    ~/.local/lib/python3.6/site-packages/synapseclient/upload_functions.py in upload_synapse_s3(syn, file_path, storageLocationId, mimetype)
        125 def upload_synapse_s3(syn, file_path, storageLocationId=None, mimetype=None):
        126     file_handle_id = multipart_upload(syn, file_path, contentType=mimetype, storageLocationId=storageLocationId)
    --> 127     syn.cache.add(file_handle_id, file_path)
        128
        129     return syn._getFileHandle(file_handle_id)
    
    ~/.local/lib/python3.6/site-packages/synapseclient/cache.py in add(self, file_handle_id, path)
        218
        219         cache_dir = self.get_cache_dir(file_handle_id)
    --> 220         with Lock(self.cache_map_file_name, dir=cache_dir):
        221             cache_map = self._read_cache_map(cache_dir)
        222
    
    ~/.local/lib/python3.6/site-packages/synapseclient/lock.py in __enter__(self)
         97     # Make the lock object a Context Manager
         98     def __enter__(self):
    ---> 99         self.blocking_acquire()
        100
        101     def __exit__(self, exc_type, exc_value, traceback):
    
    ~/.local/lib/python3.6/site-packages/synapseclient/lock.py in blocking_acquire(self, timeout, break_old_locks)
         83         if not lock_acquired:
         84             raise SynapseFileCacheError("Could not obtain a lock on the file cache within timeout: %s  "
    ---> 85                                         "Please try again later" % str(timeout))
         86
         87     def release(self):
    
    SynapseFileCacheError: Could not obtain a lock on the file cache within timeout: 0:01:10  Please try again later
    
    
    opened by attilagk 5
  • [SYNPY-560] set path if file downloaded

    [SYNPY-560] set path if file downloaded

    This probably requires some more thought. For instance, there could probably be some minor refactor of the _download_file_entity to better support all of this.

    Release 2.8

    opened by thomasyu888 0
  • Endpoint URL not utilized for external S3 resources

    Endpoint URL not utilized for external S3 resources

    Bug Report

    Github issues is reserved for bug report. If you have a question, please don't use this form. Instead, please ask your question on the Synapse Help Forum.

    Operating system

    Linux

    Client version

    Output of:

    $ synapse store --parentId syn27256137 b8165ee8-a444-4e79-b5e8-162da70b1815.tar.gz
    
    ##################################################
    This Synapse Project has transitioned to use storage maintained at the NCI Genomic Data Commons (GDC). GDC credentials are required for accessing files. Please contact the CCG Program Office to request GDC credentials
    Uploading to endpoint: [https://gdc-jamboree-objstore.datacommons.io] bucket: [gdc-alch-jamboree]
    ##################################################
    
    
    S3UploadFailedError: Failed to upload b8165ee8-a444-4e79-b5e8-162da70b1815.tar.gz to gdc-alch-jamboree/ab067ed0-ccc6-4361-9c2e-6544249fe1cb/b8165ee8-a444-4e79-b5e8-162da70b1815.tar.gz: An error occurred (InvalidRequest) when calling the CreateMultipartUpload operation: Invalid canned ACL
    

    Description of the problem

    • Attempted upload to private S3 endpoint, credentials failed
    • Download from the same project/custom endpoint works, so credentials are not the issue

    Expected behavior

    • ability to upload

    Actual behavior

    • ACL failure

    Based on reading of the code, it would appear that the issues is at https://github.com/Sage-Bionetworks/synapsePythonClient/blob/develop/synapseclient/core/upload/upload_functions.py#L198

    The call to create the upload function:

    def upload_fn(credentials):
            return S3ClientWrapper.upload_file(
                bucket_name,
                None,
                remote_file_key,
                local_path,
                credentials=credentials,
                transfer_config_kwargs={'max_concurrency': syn.max_threads}
            )
    

    Has the second argument, the endpoint_url, hard coded to None. This needs to be configured, the same way it is done at https://github.com/Sage-Bionetworks/synapsePythonClient/blob/develop/synapseclient/client.py#L1830 where the S3ClientWrapper.download_file is provided the endpoint_url from the file handle.

    opened by kellrott 1
  • Feature Request: Filter capability for syncFromSynapse

    Feature Request: Filter capability for syncFromSynapse

    Feature Request

    Just started using Synapse for a dataset which contains data for multiple image analysis use-cases. Our team only needs a small subset of available data for the time being. As such, it would be great to have some sort of filtering capability in syncFromSynapse to only specify files that are needed. I will attach a pull request to elaborate. Thanks!

    Expected behavior

    syncFromSynapse allows for filtering capability:

    import synapseutils
    
    match_only = ['instrument_instances.png', 'raw.png']
    synapseutils.syncFromSynapse(syn, entity=project_id, path=local_folder, onlyMatching=match_only)
    
    opened by talkdirty 1
Releases(v2.7.0)
  • v2.7.0(Sep 17, 2022)

    Bug Fixes

    • [SYNPY-226] - isConsistent fails as parameter for table query
    • [SYNPY-562] - Make sure SQL functions, including "year", are quoted correctly
    • [SYNPY-1031] - File version increments with 400 client error
    • [SYNPY-1219] - Update Entity class to be compatible with the new Dataset entity
    • [SYNPY-1224] - Correct SynapseUnmetAccessRestrictions message
    • [SYNPY-1237] - as_table_columns function is mishandling mixed data types

    Stories

    • [SYNPY-63] - py: use metaclass to replace the _entity_type_to_class hack
    • [SYNPY-992] - synapseutils changeFileMetadata missing syn parameter docstring
    • [SYNPY-1175] - Programmatic Support for Download V2 via Py Client
    • [SYNPY-1193] - Support Datasets functionality
    • [SYNPY-1221] - Set up gh-action: black, the python auto formatter on the python client

    Sub-Tasks

    Tasks

    • [SYNPY-566] - Clarify expected list format for sync manifest
    • [SYNPY-1053] - Increase documentation of forceVersion in syncToSynapse
    • [SYNPY-1145] - Link to manifest format in CLI sync command usage help
    • [SYNPY-1226] - Leverage ViewBase for Datasets instead of SchemaBase
    • [SYNPY-1235] - Create codeql scanning workflow

    Contributors

    • @danlu1
    • @thomasyu888
    • @allaway
    • @vpchung

    New Contributors

    • @vpchung made their first contribution in https://github.com/Sage-Bionetworks/synapsePythonClient/pull/914

    Full Changelog: https://github.com/Sage-Bionetworks/synapsePythonClient/compare/v2.6.0...v2.7.0

    Source code(tar.gz)
    Source code(zip)
    synapseclient-2.7.0-py3-none-any.whl(212.72 KB)
    synapseclient-2.7.0.tar.gz(198.24 KB)
  • v2.6.0(Apr 15, 2022)

    Bug Fixes

    Stories

    • [SYNPY-728] - Improve error message when pandas is not available
    • [SYNPY-974] - Documentation for generateManifest
    • [SYNPY-1209] - Support for MaterializedViews in Py Client

    Tasks

    • [SYNPY-1174] - Add function to create Synapse config file
    • [SYNPY-1176] - syncToSynapse aborted + silent failure of file upload
    • [SYNPY-1184] - Add includeTypes to synapseutils.walk()
    • [SYNPY-1189] - Document "maximumListLength" parameter for Column
    • [SYNPY-1196] - Expose forceVersion on changeFileMetadata
    • [SYNPY-1205] - Python 3.6 EOL - Remove support for 3.6
    • [SYNPY-1212] - Include dataset as an entity type to return in getChildren()

    Contributors: @danlu1 , @BrunoGrandePhD , @thomasyu888

    Full Changelog: https://github.com/Sage-Bionetworks/synapsePythonClient/compare/v2.5.1...v2.6.0-rc

    Source code(tar.gz)
    Source code(zip)
    synapseclient-2.6.0-py3-none-any.whl(208.67 KB)
    synapseclient-2.6.0.tar.gz(194.17 KB)
  • v2.6.0-rc(Apr 15, 2022)

    Bug Fixes

    Stories

    • [SYNPY-728] - Improve error message when pandas is not available
    • [SYNPY-974] - Documentation for generateManifest
    • [SYNPY-1209] - Support for MaterializedViews in Py Client

    Tasks

    • [SYNPY-1174] - Add function to create Synapse config file
    • [SYNPY-1176] - syncToSynapse aborted + silent failure of file upload
    • [SYNPY-1184] - Add includeTypes to synapseutils.walk()
    • [SYNPY-1189] - Document "maximumListLength" parameter for Column
    • [SYNPY-1196] - Expose forceVersion on changeFileMetadata
    • [SYNPY-1205] - Python 3.6 EOL - Remove support for 3.6
    • [SYNPY-1212] - Include dataset as an entity type to return in getChildren()

    Contributors: @danlu1 , @BrunoGrandePhD , @thomasyu888

    Full Changelog: https://github.com/Sage-Bionetworks/synapsePythonClient/compare/v2.5.1...v2.6.0-rc

    Source code(tar.gz)
    Source code(zip)
    synapseclient-2.6.0.747-py3-none-any.whl(208.73 KB)
    synapseclient-2.6.0.747.tar.gz(194.17 KB)
  • v2.5.1(Dec 3, 2021)

    Bug Fixes

    • [SYNPY-1197] - Schema is a string and strings don't have columns_to_store attributes

    Stories

    • [SYNPY-772] - update statement that appears on PyPi about Synapse to be consistent
    • [SYNPY-997] - Typos in Views documentation

    Contributors: @thomasyu888, @danlu1

    New Contributors

    • @danlu1 made their first contribution in https://github.com/Sage-Bionetworks/synapsePythonClient/pull/892

    GitHub Changelog: https://github.com/Sage-Bionetworks/synapsePythonClient/compare/v2.5.0...v2.5.1

    Source code(tar.gz)
    Source code(zip)
    synapseclient-2.5.1-py3-none-any.whl(206.69 KB)
    synapseclient-2.5.1.tar.gz(185.22 KB)
  • v2.5.0(Oct 27, 2021)

    Highlights

    • Added ability to generate a manifest file from your local directory structure.

      # from the command line
      # write the manifest to manifest.tsv
      synapse manifest --parent-id syn123 --manifest-file ./manifest.tsv /path/to/local/directory
      # stdout
      synapse manifest --parent-id syn123 /path/to/local/directory
      
    • Added ability to pipe manifest stdout into sync function.

      # from the command line
      synapse manifest --parent-id syn123 ./docs/ | synapse sync -
      
    • Added ability to return summary statistics of csv and tsv files stored in Synapse.

      # from python
      import synapseclient
      import synapseutils
      syn = synapseclient.login()
      statistics = synapseutils.describe(syn=syn, entity="syn12345")
      print(statistics)
      {
          "column1": {
              "dtype": "object",
              "mode": "FOOBAR"
          },
          "column2": {
              "dtype": "int64",
              "mode": 1,
              "min": 1,
              "max": 2,
              "mean": 1.4
          },
          "column3": {
              "dtype": "bool",
              "mode": false,
              "min": false,
              "max": true,
              "mean": 0.5
          }
      }
      
    • Next major release (3.0.0) there will be major cosmetic changes to the cli such as removing all camel case or non-standard single dash long command line interface (cli) parameters. Example: command line arguments like -parent will become --parent. Commands that support camel case like --parentId will be changed to --parent-id.

    Bug Fixes

    • [SYNPY-669] - Signing of Synapse authentication header does not correctly URL encode the URL path
    • [SYNPY-770] - Files failing to upload using syncToSynapse
    • [SYNPY-1123] - All tables erroring when indexing
    • [SYNPY-1146] - Error writing Booleans from Python dataframes into Boolean columns in a Synapse table
    • [SYNPY-1156] - datetimes in a Pandas dataframe are not properly stored to Synapse

    Stories

    • [SYNPY-726] - mirror local folder structure for bulk upload
    • [SYNPY-1163] - Expose synId with syn get -r
    • [SYNPY-1165] - Generate manifest template from local folder structure
    • [SYNPY-1167] - Support for Quick Summary Statistics on CSV and TSV files

    Tasks

    • [SYNPY-1169] - Integration tests failures in develop branch against stack-371
    • [SYNPY-1172] - Passing a pandas dataframe with a column called "read" breaks the type parsing in as_table_columns()
    • [SYNPY-1173] - Support DATE_LIST, ENTITYID_LIST, USERID_LIST table columns
    • [SYNPY-1188] - Support piping of synapse manifest stdout in synapse sync function

    @jkiang13, @linchiahuisage, @esurface, @thomasyu888, @BrunoGrandePhD, @mattfazza

    New Contributors

    • @esurface made their first contribution in https://github.com/Sage-Bionetworks/synapsePythonClient/pull/876
    • @mattfazza made their first contribution in https://github.com/Sage-Bionetworks/synapsePythonClient/pull/877

    Full Changelog: https://github.com/Sage-Bionetworks/synapsePythonClient/compare/v2.4.0...v2.5.0

    Source code(tar.gz)
    Source code(zip)
    synapseclient-2.5.0-py3-none-any.whl(206.61 KB)
    synapseclient-2.5.0.tar.gz(187.79 KB)
  • v2.4.0(Jul 8, 2021)

    Highlights

    • Added ability to authenticate from a SYNAPSE_AUTH_TOKEN environment variable set with a valid personal access token.
    # e.g. set environment variable prior to invoking a Synapse command or running a program that uses synapseclient
    SYNAPSE_AUTH_TOKEN='<my_personal_access_token>' synapse <subcommand options>
    

    The environment variable will take priority over credentials in the user’s .synapseConfig file or any credentials saved in a prior login using the remember me option.

    See here for more details on usage.

    • Added ability to silence all console output.
    # from the command line, use the --silent option with any synapse subcommand, here it will suppress the download progress indicator
    synapse --silent get <synid>
    
    # from code using synapseclient, pass the silent option to the Synapse constructor
    import synapseclient
    
    syn = synapseclient.Synapse(silent=True)
    syn.login()
    syn.get(<synid>)
    
    • Improved robustness during downloads with unstable connections. Specifically the client will automatically recover when encoutering some types of network errors that previously would have caused a download to start over as indicated by a reset progress bar.

    Bug Fixes

    • [SYNPY-198] - get: Unmet access requirement should not raise error if entity not downloadable
    • [SYNPY-959] - FileEntity 'path' property has wrong separator in Windows
    • [SYNPY-1113] - Confusing error when putting the positional FILE at the end of the synapse store command with an optional n-arg
    • [SYNPY-1128] - failures downloading 14G vcf file
    • [SYNPY-1130] - Migration tool trying to move URL-linked data
    • [SYNPY-1134] - 500 error during part copy to AWS presigned url
    • [SYNPY-1135] - Exceeding part limit during AD Migration
    • [SYNPY-1136] - Connection aborted to AWS part copy to presigned url during AD Migration
    • [SYNPY-1141] - synapse get command line nargs usage/error
    • [SYNPY-1150] - Boolean-like string columns being reformatted (TRUE/FALSE to True/False)
    • [SYNPY-1158] - race condition in test_caching.py#test_threaded_access
    • [SYNPY-1159] - logging in with an email address and an authToken gives spurious error
    • [SYNPY-1161] - ChunkEncodingError encountered from external collaborator during a synapseclient download

    Improvements

    • [SYNPY-638] - add after date to cache purge
    • [SYNPY-929] - silent parameter for all functions which default to writing to stdout
    • [SYNPY-1068] - Should show some progress indicator during upload md5 calculation
    • [SYNPY-1125] - Allow login with environment variables

    Stories

    • [SYNPY-1138] - When using boto3 client to upload a file, also include ACL to give bucket owner full access

    Tasks

    • [SYNPY-948] - command line client set-annotations does not return proper error code when there's a problem
    • [SYNPY-1024] - remove reference to deprecated 'status' field from Evaluation
    • [SYNPY-1115] - Setting provenance in store ignored for tables
    • [SYNPY-1143] - indicate in CLI doc's that select statement requires double quotes
    Source code(tar.gz)
    Source code(zip)
    synapseclient-2.4.0-py3-none-any.whl(204.39 KB)
    synapseclient-2.4.0.tar.gz(182.12 KB)
  • v2.3.1(Apr 14, 2021)

    Highlights

    • Entities can be annotated with boolean datatypes, e.g.:

      file = synapseclient.File('/path/to/file', parentId='syn123', synapse_is_great=True)
      syn.store(file)
      
    • synapseclient is additionally packaged as a Python wheel.

    Bug Fixes

    • [SYNPY-829] - syn.store always updates annotations
    • [SYNPY-1033] - If versionComment is left blank, previous version comment populates

    Improvements

    • [SYNPY-1120] - Build wheel distributions
    • [SYNPY-1129] - support boolean annotations in Python client
    Source code(tar.gz)
    Source code(zip)
    synapseclient-2.3.1-py3-none-any.whl(201.09 KB)
    synapseclient-2.3.1.tar.gz(180.36 KB)
  • v2.3.0(Mar 3, 2021)

    Highlights

    • The index_files_for_migration and migrate_indexed_files functions are added to synapseutils to help migrate files in Synapse projects and folders between AWS S3 buckets in the same region. More details on using these utilities can be found here.

    • This version supports login programatically and from the command line using personal access tokens that can be obtained from your synapse.org Settings. Additional documentation on login and be found here.

      # programmatic
      syn = synapseclient.login(authToken=<token>)
      
      # command line
      synapse login -p <token>
      
    • The location where downloaded entities are cached can be customized to a location other than the user’s home directory. This is useful in environments where writing to a home directory is not appropriate (e.g. an AWS lambda).

      syn = synapseclient.Synapse(cache_root_dir=<directory path>)
      
    • A helper method on the Synapse object has been added to enable obtaining the Synapse certification quiz status of a user.

      passed = syn.is_certified(<username or user_id>)
      
    • This version has been tested with Python 3.9.

    Bug Fixes

    • [SYNPY-1039] - tableQuery asDataFrame() results with TYPE_LIST columns should be lists and not literal strings
    • [SYNPY-1109] - unparseable synapse cacheMap raises JSONDecodeError
    • [SYNPY-1110] - Cleanup on Windows console login
    • [SYNPY-1112] - Concurrent migration of entities sharing the same file handle can result in an error
    • [SYNPY-1114] - Mitigate new Rust compiler dependency on Linux via transitive cryptography dependency
    • [SYNPY-1118] - Migration tool erroring when it shouldn’t

    New Features

    • [SYNPY-1058] - Accept oauth access token for authentication to use Synapse REST services
    • [SYNPY-1103] - Multipart copy integration
    • [SYNPY-1111] - Add function to get user certification status

    Improvements

    • [SYNPY-885] - Public interface to customize CACHE_ROOT_DIR
    • [SYNPY-1102] - syncToSynapse adds empty annotation values
    • [SYNPY-1104] - Python 3.9 support
    • [SYNPY-1119] - Add source storage location option to storage migrate functions
    Source code(tar.gz)
    Source code(zip)
    synapseclient-2.3.0.tar.gz(179.78 KB)
  • v2.2.2(Oct 19, 2020)

    Highlights

    • This version addresses an issue with downloads being retried unsuccessfully after encountering certain types of errors.
    • A create_snapshot_version function is added for making table and view snapshots.

    Bugs

    • [SYNPY-1096] - Fix link to Synapse on PyPI
    • [SYNPY-1097] - downloaded files are reset when disk space exhausted

    New Features

    • [SYNPY-1041] - Snapshot feature and programmatic clients

    Improvements

    • [SYNPY-1063] - Consolidate builds to GitHub Actions
    • [SYNPY-1099] - Replace usage of deprecated PUT /entity/{id}/version endpoint
    Source code(tar.gz)
    Source code(zip)
    synapseclient-2.2.2.tar.gz(160.90 KB)
  • v2.2.0(Aug 31, 2020)

    Highlights

    • Files that are part of syncFromSynapse and syncToSynapse operations (synapse get -r and synapse sync in the command line client, respectively) are transferred in in parallel threads rather than serially, substantially improving the performance of these operations.
    • Table metadata from synapse get -q is automatically downloaded to a users working directory instead of to the Synapse cache (a hidden folder).
    • Users can now pass their API key to synapse login in place of a password.

    Bugs

    • [SYNPY-1082] - Downloading entity linked to URL fails: module ‘urllib.parse’ has no attribute ‘urlretrieve’

    Improvements

    • [SYNPY-1072] - Improve throughput of multiple small file transfers
    • [SYNPY-1073] - Parellelize upload syncs
    • [SYNPY-1074] - Parallelize download syncs
    • [SYNPY-1084] - Allow anonymous usage for public APIs like GET /teamMembers/{id}
    • [SYNPY-1088] - Manifest is in cache with synapse get -q
    • [SYNPY-1090] - Command line client does not support apikey

    Tasks

    • [SYNPY-1080] - Remove Versionable from SchemaBase
    • [SYNPY-1085] - Move to pytest testing framework
    • [SYNPY-1087] - Improve synapseclient installation instructions
    Source code(tar.gz)
    Source code(zip)
  • v2.1.1(Jul 10, 2020)

    Highlights

    • This version includes a performance improvement for syncFromSynapse downloads of deep folder hierarchies to local filesystem locations outside of the Synapse cache.

    • Support is added for SubmissionViews that can be used to query and edit a set of submissions through table services.

      from synapseclient import SubmissionViewSchema
      project = syn.get("syn123")
      evaluation_id = '9876543'
      view = syn.store(SubmissionViewSchema(name='My Submission View', parent=project, scopes=[evaluation_id]))
      view_table = syn.tableQuery(f"select * from {view.id}")
      

    Bug

    • [SYNPY-1075] - Error in Python test (submission annotations
    • [SYNPY-1076] - Upgrade/fix Pandas dependency

    Improvement

    • [SYNPY-1070] - Add support for submission views
    • [SYNPY-1078] - Improve syncFromSynapse performance for large folder structures synced to external paths
    Source code(tar.gz)
    Source code(zip)
  • v2.1.0(Jun 17, 2020)

    Highlights:

    • A max_threads property of the Synapse object has been added to customize the number of concurrent threads that will be used during file transfers.

      import synapseclient
      syn = synapseclient.login()
      syn.max_threads = 20
      

      If not customized the default value is (CPU count + 4). Adjusting this value higher may speed up file transfers if the local system resources can take advantage of the higher setting. Currently this value applies only to files whose underlying storage is AWS S3.

      Alternately, a value can be stored in the synapseConfig configuration file that will automatically apply as the default if a value is not explicitly set.

      [transfer]
      max_threads=16
      
    • This release includes support for directly accessing S3 storage locations using AWS Security Token Service credentials. This allows use of external AWS clients and libraries with Synapse storage, and can be used to accelerate file transfers under certain conditions. To create an STS enabled folder and set-up direct access to S3 storage, see here.

    • The getAnnotations and setAnnotations methods of the Synapse object have been deprecated in favor of newer get_annotations and set_annotations methods, respectively. The newer versions are parameterized with a typed Annotations dictionary rather than a plain Python dictionary to prevent existing annotations from being accidentally overwritten. The expected usage for setting annotations is to first retrieve the existing Annotations for an entity before saving changes by passing back a modified value.

      annos = syn.get_annotations('syn123')
      
      # set key 'foo' to have value of 'bar' and 'baz'
      annos['foo'] = ['bar', 'baz']
      # single values will automatically be wrapped in a list once stored
      annos['qwerty'] = 'asdf'
      
      annos = syn.set_annotations(annos)
      

      The deprecated annotations methods may be removed in a future release.

    A full list of issues addressed in this release are below.

    Bug

    • [SYNPY-913] - Travis Build badge for develop branch is pointing to pull request
    • [SYNPY-960] - AppVeyor build badge appears to be failed while the builds are passed
    • [SYNPY-1036] - different users storing same file to same folder results in 403
    • [SYNPY-1056] - syn.getSubmissions fails due to new Annotation class in v2.1.0-rc

    Improvement

    • [SYNPY-1036] - Make upload speeds comparable to those of the AWS S3 CLI
    • [SYNPY-1049] - Expose STS-related APIs

    Task

    • [SYNPY-1059] - Use collections.abc instead of collections
    Source code(tar.gz)
    Source code(zip)
  • v2.0.0(Mar 23, 2020)

    Highlights

    • Multi-threaded download of files from Synapse can be enabled by setting syn.multi_threaded to True on a synapseclient.Synapse object. This will become the default implementation in the future, but to ensure stability for the first release of this feature, it must be intentionally enabled.

      import synapseclient
      syn = synapseclient.login()
      syn.multi_threaded = True
      # syn123 now will be downloaded via the multi-threaded implementation
      syn.get("syn123")
      

      Currently, multi-threaded download only works with files stored in AWS S3, where most files on Synapse reside. This also includes custom storage locations that point to an AWS S3 bucket. Files not stored in S3 will fall back to single-threaded download even if syn.multi_threaded==True.

    • synapseutils.copy() now has limitations on what can be copied

      • A user must have download permissions on the entity they want to copy.
      • Users cannot copy any entities that have access requirements.
    • contentTypes and fileNames are optional parameters in synapseutils.copyFileHandles()

    • Synapse Docker Repository(synapseclient.DockerRepository) objects can now be submitted to Synapse evaluation queues using the entity argument in synapseclient.Synapse.submit(). An optional argument docker_tag="latest" has also been added to synapseclient.Synapse.submit()" to designate which tagged Docker image to submit.

    A full list of issues addressed in this release are below.

    Bug

    • [SYNPY-271] - cache.remove fails to return the file handles we removed
    • [SYNPY-1032] - Support new columnTypes defined in backend

    Task

    • [SYNPY-999] - Remove unsafe copy functions from client
    • [SYNPY-1027] - Copy function should copy things when users are part of a Team that has DOWNLOAD access

    Improvement

    • [SYNPY-389] - submission of Docker repository
    • [SYNPY-537] - synapseutils.copyFileHandles requires fields that does not require at rest
    • [SYNPY-680] - synapseutils.changeFileMetaData() needs description in documentation
    • [SYNPY-682] - improve download speeds to be comparable to AWS
    • [SYNPY-807] - Drop support for Python 2
    • [SYNPY-907] - Replace `from <module> import ...` with `import <module>`
    • [SYNPY-962] - remove 'password' as an option in default synapse config file
    • [SYNPY-972] - Link on Synapse Python Client Documentation points back at itself
    Source code(tar.gz)
    Source code(zip)
  • v1.9.4(Nov 16, 2019)

    Bug

    • [SYNPY-881] - Synu.copy fails when copying a file with READ permissions
    • [SYNPY-888] - Docker repositories cannot be copied
    • [SYNPY-927] - trying to create a project with name that already exists hangs
    • [SYNPY-1005] - cli docs missing sub-commands
    • [SYNPY-1018] - Synu.copy shouldn't copy any files with access restrictions

    New Feature

    • [SYNPY-851] - invite user or list of users to a team

    Improvement

    • [SYNPY-608] - Add how to contribute md to github project
    • [SYNPY-735] - command line for building a table
    • [SYNPY-864] - docstring for the command line client doesn't have complete list of sub-commands available
    • [SYNPY-926] - allow forceVersion false for command line client
    • [SYNPY-1013] - Documentation of "store" command for Synapse command line client
    • [SYNPY-1021] - change email contact for code of conduct
    Source code(tar.gz)
    Source code(zip)
  • v1.9.2(Feb 16, 2019)

    In version 1.9.2, we improved Views' usability by exposing set_entity_types() function to change the entity types that will show up in a View:

        import synapseclient
        from synapseclient.table import EntityViewType
    
        syn = synapseclient.login()
        view = syn.get("syn12345")
        view.set_entity_types([EntityViewType.FILE, EntityViewType.FOLDER])
        view = syn.store(view)
    

    Features

    • [SYNPY-919] - Expose a way to update entity types in a view using EntityViewType

    Bug Fixes

    • [SYNPY-855] - Single thread uploading fails in Lambda python3.6 environment
    • [SYNPY-910] - Store Wiki shows deprecation warning
    • [SYNPY-920] - Project View turned into File View after using syndccutils template

    Tasks

    • [SYNPY-790] - Pin to a fixed version of the request package
    • [SYNPY-866] - Update Synapse logo in Python docs :)

    Improvements

    • [SYNPY-783] - typos in comments and in stdout
    • [SYNPY-916] - Wonky display on parameters
    • [SYNPY-917] - Add instructions on how to login with API key
    • [SYNPY-909] - Missing columnTypes in Column docstring
    Source code(tar.gz)
    Source code(zip)
  • v1.9.1(Jan 21, 2019)

    In version 1.9.1, we fix various bugs and added two new features:

    • Python 3.7 is supported.
    • Deprecation warnings are visible by default.

    Features

    • [SYNPY-802] -Support Python 3.7
    • [SYNPY-849] -Add deprecation warning that isn't filtered by Python

    Bug Fixes

    • [SYNPY-454] -Some integration tests do not clean up after themselves
    • [SYNPY-456] -Problems with updated query system
    • [SYNPY-515] -sphinx documentation not showing for some new classes
    • [SYNPY-526] -deprecate downloadTableFile()
    • [SYNPY-578] -switch away from POST /entity/#/table/deleterows
    • [SYNPY-594] -Getting error from dev branch in integration test against staging
    • [SYNPY-796] -fix or remove PyPI downloads badge in readme
    • [SYNPY-799] -Unstable test: Test PartialRow updates to entity views from rowset queries
    • [SYNPY-846] -error if password stored in config file contains a '%'

    Tasks

    • [SYNPY-491] -Figure out custom release note fitlers
    • [SYNPY-840] -Install not working on latest python
    • [SYNPY-847] -uploadFileHandle should not be deprecated nor removed
    • [SYNPY-852] -Check and update docs.synapse.org to reflect the change in the Python client
    • [SYNPY-860] -vignette for how to upload a new version of a file directly to a Synapse entity
    • [SYNPY-863] -Update public documentation to move away from the query services
    • [SYNPY-866] -Update Synapse logo in Python docs :)
    • [SYNPY-873] -consolidate integration testing to platform dev account

    Improvements

    • [SYNPY-473] -Change syn.list to no longer use deprecated function chunkedQuery
    • [SYNPY-573] -synapse list command line shouldn't list the parent container
    • [SYNPY-581] -<entity>.annotations return object is inconsistent with getAnnotations()
    • [SYNPY-612] -Rename view_type to viewType in EntityViewSchema for consistency
    • [SYNPY-777] -Python client _list still uses chunckedQuery and result seem out of date
    • [SYNPY-804] -Update styling in the python docs to more closely match the Docs site styling
    • [SYNPY-815] -Update the build to use test user instead of migrationAdmin
    • [SYNPY-848] -remove outdated link to confluence for command line query
    • [SYNPY-856] -build_table example in the docs does not look right
    • [SYNPY-858] -Write file view documentation in python client that is similar to Synapser
    • [SYNPY-870] -Submitting to an evaluation queue can't accept team as int
    Source code(tar.gz)
    Source code(zip)
  • v1.9.0(Sep 29, 2018)

    In version 1.9.0, we deprecated and removed query() and chunkedQuery(). These functions used the old query services which does not perform well. To query for entities filter by annotations, please use EntityViewSchema.

    We also deprecated the following functions and will remove them in Synapse Python client version 2.0. In the Activity object:

    • usedEntity()
    • usedURL()

    In the Synapse object:

    • getEntity()
    • loadEntity()
    • createEntity()
    • updateEntity()
    • deleteEntity()
    • downloadEntity()
    • uploadFile()
    • uploadFileHandle()
    • uploadSynapseManagedFileHandle()
    • downloadTableFile()

    Please see our documentation for more details on how to migrate your code away from these functions.

    Features

    • SYNPY-806 - Support Folders and Tables in View

    Bug Fixes

    • SYNPY-195 - Dangerous exception handling
    • SYNPY-261 - error downloading data from synapse (python client)
    • SYNPY-694 - Uninformative error in copyWiki function
    • SYNPY-805 - Uninformative error when getting View that does not exist
    • SYNPY-819 - command-line clients need to be updated to replace the EntityView viewType with viewTypeMask

    Tasks

    • SYNPY-759 - Look for all functions that are documented as “Deprecated” and apply the deprecation syntax
    • SYNPY-812 - Add Github issue template
    • SYNPY-824 - Remove the deprecated function query() and chunkedQuery()

    Improvements

    • SYNPY-583 - Better error message for create Link object
    • SYNPY-810 - simplify docs for deleting rows
    • SYNPY-814 - fix docs links in python client init.py
    • SYNPY-822 - Switch to use news.rst instead of multiple release notes files
    • SYNPY-823 - Pin keyring to version 12.0.2 to use SecretStorage 2.x
    Source code(tar.gz)
    Source code(zip)
  • v1.8.2(Sep 29, 2018)

    Release notes - Synapse Python Client - Version 1.8.2

    Install Instructions: pip install --upgrade synapseclient or see http://docs.synapse.org/python/#installation
    Documentation: http://sage-bionetworks.github.io/synapsePythonClient

    Release Date: 17-August-2018


    In this release, we have been performed some house-keeping on the code base. The two major changes are:

    • making syn.move() available to move an entity to a new parent in Synapse. For example:
    import synapseclient
    from synapseclient import Folder
    
    syn = synapseclient.login()
    
    file = syn.get("syn123")
    folder = Folder("new folder", parent="syn456")
    folder = syn.store(folder)
    
    # moving file to the newly created folder
    syn.move(file, folder)
    
    • exposing the ability to use the Synapse Python client with single threaded. This feature is useful when running Python script in an environment that does not support multi-threading. However, this will negatively impact upload speed. To use single threaded:
    import synapseclient
    
    synapseclient.config.single_threaded = True
    

    Bug

    • [SYNPY-535] - Synapse Table update: Connection Reset
    • [SYNPY-603] - Python client and synapser cannot handle table column type LINK
    • [SYNPY-688] - Recursive get (sync) broken for empty folders.
    • [SYNPY-744] - KeyError when trying to download using Synapse Client 1.8.1
    • [SYNPY-750] - Error in downloadTableColumns for file view
    • [SYNPY-758] - docs in Sphinx don't show for synapseclient.table.RowSet
    • [SYNPY-760] - Keyring related error on Linux
    • [SYNPY-766] - as_table_columns() returns a list of columns out of order for python 3.5 and 2.7
    • [SYNPY-776] - Cannot log in to Synapse - error(54, 'Connection reset by peer')
    • [SYNPY-795] - Not recognizable column in query result

    New Feature

    • [SYNPY-582] - move file or folder in the client
    • [SYNPY-788] - Add option to use syn.store() without exercising multithreads

    Task

    • [SYNPY-729] - Deprecate query() and chunkedQuery()
    • [SYNPY-797] - Check Python client code base on using PLFM object model
    • [SYNPY-798] - Using github.io to host documentation

    Improvement

    • [SYNPY-646] - Error output of synGet is non-informative
    • [SYNPY-743] - lint the entire python client code base
    Source code(tar.gz)
    Source code(zip)
  • v1.8.1(May 8, 2018)

  • v1.8.0(May 7, 2018)

    Release notes - Synapse Python Client - Version 1.8.0

    Install Instructions: pip install --upgrade synapseclient or see http://docs.synapse.org/python/#installation
    Documentation: http://docs.synapse.org/python/

    Release Date: 7-May-2018


    This release has 2 major changes:

    • The client will no longer store your saved credentials in your synapse cache (~/synapseCache/.session). The python client now relies on keyring to handle credential storage of your Synapse credentials.

    • The client also now uses connection pooling, which means that all method calls that connect to Synapse should now be faster.

    The remaining changes are bugfixes and cleanup of test code.

    Below are the full list of issues addressed by this release:

    Bug

    • [SYNPY-654] - syn.getColumns does not terminate
    • [SYNPY-658] - Security vunerability on clusters
    • [SYNPY-689] - Wiki's attachments cannot be None
    • [SYNPY-692] - synapseutils.sync.generateManifest() sets contentType incorrectly
    • [SYNPY-693] - synapseutils.sync.generateManifest() UnicodeEncodingError in python 2

    Task

    • [SYNPY-617] - Remove use of deprecated service to delete table rows
    • [SYNPY-673] - Fix Integration Tests being run on Appveyor
    • [SYNPY-683] - Clean up print()s used in unit/integration tests

    Improvement

    • [SYNPY-408] - Add bettter error messages when /filehandle/batch fails.
    • [SYNPY-647] - Use connection pooling for Python client's requests
    Source code(tar.gz)
    Source code(zip)
  • v1.7.5(Jan 31, 2018)

    Release 1.7.5

    Release Date: 31-January-2018

    v1.7.4 release was broken for new users that installed from pip. v1.7.5 has the same changes as v1.7.4 but fixes the pip installation.

    Source code(tar.gz)
    Source code(zip)
  • v1.7.4(Jan 29, 2018)

    Release v1.7.4

    Release Date: 29-January-2018

    This release mostly includes bugfixes and improvements for various Table classes:

    • Fixed bug where you couldn't store a table converted to a pandas.Dataframe if it had a INTEGER column with some missing values.
    • EntityViewSchema can now automatically add all annotations within your defined scopes as columns. Just set the view's addAnnotationColumns=True before calling syn.store(). This attribute defaults to True for all newly created EntityViewSchemas. Setting addAnnotationColumns=True on existing tables will only add annotation columns that are not already a part of your schema.
    • You can now use synapseutils.notifyMe as a decorator to notify you by email when your function has completed. You will also be notified of any Errors if they are thrown while your function runs.

    We also added some new features:

    • syn.findEntityId() function that allows you to find an Entity by its name and parentId, set parentId to None to search for Projects by name.
    • The bulk upload functionality of synapseutils.syncToSynapse is avaliable from the command line using: synapse sync.

    Below are the full list of issues addressed by this release:

    New Feature

    • [SYNPY-506] - need convenience function for /entity/child
    • [SYNPY-517] - sync command line

    Improvement

    • [SYNPY-267] - Update Synapse tables for integer types
    • [SYNPY-304] - Table objects should implement len()
    • [SYNPY-416] - warning message for recursive get when a non-Project of Folder entity is passed
    • [SYNPY-482] - Create a sample synapseConfig if none is present
    • [SYNPY-489] - Add a boolean paramter in EntityViewSchema that will indicate whether the client should create columns based on annotations in the specified scopes
    • [SYNPY-494] - Link should be able to take an entity object as the parameter and derive its id
    • [SYNPY-511] - improve exception handling
    • [SYNPY-512] - Remove the use of PaginatedResult's totalNumberOfResult
    • [SYNPY-539] - When creating table Schemas, enforce a limit on the number of columns that can be created.

    Bug

    • [SYNPY-235] - can't print Row objects with dates in them
    • [SYNPY-272] - bug syn.storing rowsets containing Python datetime objects
    • [SYNPY-297] - as_table_columns shouldn't give fractional max size
    • [SYNPY-404] - when we get a SynapseMd5MismatchError we should delete the downloaded file
    • [SYNPY-425] - onweb doesn't work for tables
    • [SYNPY-438] - Need to change 'submit' not to use evaluation/id/accessRequirementUnfulfilled
    • [SYNPY-496] - monitor.NotifyMe can not be used as an annotation decorator
    • [SYNPY-521] - inconsistent error message when username/password is wrong on login
    • [SYNPY-536] - presigned upload URL expired warnings using Python client sync function
    • [SYNPY-555] - EntityViewSchema is missing from sphinx documentation
    • [SYNPY-558] - synapseutils.sync.syncFromSynapse throws error when syncing a Table object
    • [SYNPY-595] - Get recursive folders filled with Links fails
    • [SYNPY-605] - Update documentation for getUserProfile to include information about refreshing and memoization

    Task

    • [SYNPY-451] - Add limit and offset for accessApproval and accessRequirement API calls and remove 0x400 flag default when calling GET /entity/{id}/bundle
    • [SYNPY-546] - Change warning message when user does not DOWNLOAD permissions.
    Source code(tar.gz)
    Source code(zip)
  • v1.7.3(Dec 11, 2017)

    Release 1.7.3

    Release Date: 08-December-2017
    Install Instructions: pip install --upgrade synapseclient or see http://docs.synapse.org/python/#installation
    Documentation: http://docs.synapse.org/python/

    Release 1.7.3 introduces fixes and quality of life changes to Tables and synapseutils:

    • Changes to Tables:
      • You no longer have to include the etag column in your SQL query when using a tableQuery() to update File/Project Views. just SELECT the relevant columns and etags will be resolved automatically.
      • The new PartialRowSet class allows you to only have to upload changes to individual cells of a table instead of every row that had a value changed. It is recommended to use the PartialRowSet.from_mapping() classmethod instead of the PartialRowSet constructor.
    • Changes to synapseutils:
      • Improved documentation
      • You can now use ~ to refer to your home directory in your manifest.tsv

    We also added improved debug logging and use Python's bulitin logging module instead of printing directly to sys.stderr

    Below are the full list of issues addressed by this release:

    Bug

    • [SYNPY-419] - support object store from client
    • [SYNPY-499] - metadata manifest file name spelled wrong
    • [SYNPY-504] - downloadTableFile changed return type with no change in documentation or mention in release notes
    • [SYNPY-508] - syncToSynapse does not work if "the file path in "used" or "executed" of the manifest.tsv uses home directory shortcut "~"
    • [SYNPY-516] - synapse sync file does not work if file is a URL
    • [SYNPY-525] - Download CSV file of Synapse Table - 416 error
    • [SYNPY-572] - Users should only be prompted for updates if the first or second part of the version number is changed.

    New Feature

    • [SYNPY-450] - Create convenience functions for synapse project settings
    • [SYNPY-517] - sync command line
    • [SYNPY-519] - Clean up doc string for Sync
    • [SYNPY-545] - no module botocore
    • [SYNPY-577] - Expose new view etags in command line clients

    Task

    • [SYNPY-569] - 'includeEntityEtag' should be True for Async table csv query downloads

    Improvement

    • [SYNPY-304] - Table objects should implement len()
    • [SYNPY-511] - improve exception handling
    • [SYNPY-518] - Clean up sync interface
    • [SYNPY-590] - Need better logging of errors that occur in the Python client.
    • [SYNPY-597] - Add ability to create PartialRowset updates
    Source code(tar.gz)
    Source code(zip)
  • v1.7.1(Jun 17, 2017)

    Release Notes - Synapse Python Client - Version py-1.7

    Release Date: 17-June-2017
    Install Instructions: pip install --upgrade synapseclient or see http://docs.synapse.org/python/#installation
    Documentation: http://docs.synapse.org/python/

    Release 1.7 is a large bugfix release with several new features. The main ones include:

    • We have expanded the syanpaseutils packages to add the abilitity to:
      • Bulk upload files to synapse (synapseutils.syncToSynapse).
      • Notify you via email on the progress of a function (useful for jobs like large file uploads that may take a long time to complete).
      • The syncFromSynapse function now creates a "manifest" which contains the metadata of downloaded files. (These can also be used to update metadata with the bulk upload function.
    • File View tables can now be created from the python client using EntityViewSchema. See fileviews documentation.
    • The python client is now able to upload to user owned S3 Buckets. Click here for instructions on linking your S3 bucket to synapse

    We've also made vairous improvements to existing features:

    • The LARGETEXT type is now supported in Tables allowing for strings up to 2Mb.
    • The --description argument when creating/updating entities from the command line client will now create a Wiki for that entity. You can also use --descriptionFile to write the contents of a markdownfile as the entity's Wiki
    • Two member variables of the File object, file_entity.cacheDir and file_entity.files is being DEPRECATED in favor of file_entity.path for finding the location of a downloaded File
    • pandas dataframes containing datetime values can now be properly converted into csv and uploaded to Synapse. We also added a optional convert_to_datetime parameter to CsvFileTable.asDataFrame() that will automatically convert Synapse DATE columns into datetime objects instead of leaving them as long unix timestamps

    Below are the full list of bugs and issues addressed by this release:

    New Features

    • [SYNPY-53] - support syn.get of external FTP links in py client
    • [SYNPY-179] - Upload to user owned S3 bucket
    • [SYNPY-412] - allow query-based download based on view tables from command line client
    • [SYNPY-487] - Add remote monitoring of long running processes
    • [SYNPY-415] - Add Docker and TableViews into Entity.py
    • [SYNPY-89] - Python client: Bulk upload client/command
    • [SYNPY-413] - Update table views via python client
    • [SYNPY-301] - change actual file name from python client
    • [SYNPY-442] - set config file path on command line

    Improvements

    • [SYNPY-407] - support LARGETEXT in tables
    • [SYNPY-360] - Duplicate file handles are removed from BulkFileDownloadRequest
    • [SYNPY-187] - Move --description in command line client to create wikis
    • [SYNPY-224] - When uploading to a managed external file handle (e.g. SFTP), fill in storageLocationId
    • [SYNPY-315] - Default behavior for files in cache dir should be replace
    • [SYNPY-381] - Remove references to "files" and "cacheDir".
    • [SYNPY-396] - Create filehandle copies in synapseutils.copy instead of downloading
    • [SYNPY-403] - Use single endpoint for all downloads
    • [SYNPY-435] - Convenience function for new service to get entity's children
    • [SYNPY-471] - docs aren't generated for synapseutils
    • [SYNPY-472] - References to wrong doc site
    • [SYNPY-347] - Missing dtypes in table.DTYPE_2_TABLETYPE
    • [SYNPY-463] - When copying filehandles we should add the files to the cache if we already donwloaded them
    • [SYNPY-475] - Store Tables timeout error

    Bug Fixes

    • [SYNPY-190] - syn.login('asdfasdfasdf') should fail
    • [SYNPY-344] - weird cache directories
    • [SYNPY-346] - ValueError: cannot insert ROW_ID, already exists in CsvTableFile constructor
    • [SYNPY-351] - Versioning broken for sftp files
    • [SYNPY-366] - file URLs leads to wrong path
    • [SYNPY-393] - New cacheDir causes cache to be ignored(?)
    • [SYNPY-409] - Python client cannot depend on parsing Amazon pre-signed URLs
    • [SYNPY-418] - Integration test failure against 167
    • [SYNPY-421] - syn.getWikiHeaders has a return limit of 50 (Need to return all headers)
    • [SYNPY-423] - upload rate is off or incorrect
    • [SYNPY-424] - File entities don't handle local_state correctly for setting datafilehandleid
    • [SYNPY-426] - multiple tests failing because of filenameOveride
    • [SYNPY-427] - test dependent on config file
    • [SYNPY-428] - sync function error
    • [SYNPY-431] - download ending early and not restarting from previous spot
    • [SYNPY-443] - tests/integration/integration_test_Entity.py:test_get_with_downloadLocation_and_ifcollision AssertionError
    • [SYNPY-461] - On Windows, command line client login credential prompt fails (python 2.7)
    • [SYNPY-465] - Update tests that set permissions to also include 'DOWNLOAD' permission and tests that test functions using queries
    • [SYNPY-468] - Command line client incompatible with cache changes
    • [SYNPY-470] - default should be read, download for setPermissions
    • [SYNPY-483] - integration test fails for most users
    • [SYNPY-484] - URL expires after retries
    • [SYNPY-486] - Error in integration tests
    • [SYNPY-488] - sync tests for command line client puts file in working directory
    • [SYNPY-142] - PY: Error in login with rememberMe=True
    • [SYNPY-464] - synapse get syn4988808 KeyError: u'preSignedURL'

    Miscellaneous Tasks

    • [SYNPY-422] - reduce default page size for GET /evaluation/{evalId}/submission/bundle/all
    • [SYNPY-437] - Remove tests for access restrictions on evaluations
    • [SYNPY-402] - Add release notes to Github release tag
    Source code(tar.gz)
    Source code(zip)
The bidirectional mapping library for Python.

bidict The bidirectional mapping library for Python. Status bidict: has been used for many years by several teams at Google, Venmo, CERN, Bank of Amer

Joshua Bronson 1.2k Dec 31, 2022
Python-Kite: Simple python code to make kite pattern

Python-Kite Simple python code to make kite pattern. Getting Started These instr

Anoint 0 Mar 22, 2022
A python server markup language

PSML - Python server markup language How to install: python install.py

LMFS 6 May 18, 2022
Plux - A dynamic code loading framework for building plugable Python distributions

Plux plux is the dynamic code loading framework used in LocalStack. Overview The

LocalStack 65 Dec 20, 2022
🐍 This snake helps you reconnect the Web, with RSS feeds!

This snake helps you reconnect the Web, with RSS feeds! RSSerpent is an open-source software that create RSS feeds for websites that do not provide an

211 Dec 08, 2022
Простенький ботик для троллинга с интерфейсом #Yakima_Visus

Bot-Trolling-Vk Простенький ботик для троллинга с интерфейсом #Yakima_Visus Установка pip install vk_api pip install requests если там еще чото будет

Yakima Visus 4 Oct 11, 2022
Refer'd Resume Scanner

Refer'd Resume Scanner I wanted to share a free resource we built to assist applicants with resume building. Our resume scanner identifies potential s

Refer'd 74 Mar 07, 2022
Example code for the book Fluent Python, 1st Edition (O'Reilly, 2015)

Fluent Python, First Edition: example code This repository is archived and will not be updated.

Fluent Python 5.4k Jan 09, 2023
Mines all the moneys and stuff and things.

NFT Miner NFT Miner - Version 1.1.0 - Quick Fix Since the whole NFT thing started booming on Twitter it's been hard not to see one of those ugly ass m

8w8 1 Dec 13, 2021
Its a simple and fun to use application. You can make your own quizes and send the lik of the quiz to your friends.

Quiz Application Its a simple and fun to use application. You can make your own quizes and send the lik of the quiz to your friends. When they would a

Atharva Parkhe 1 Feb 23, 2022
Saturne best tools pour baiser tout le système de discord

Installation | Important | Discord 🌟 Comme Saturne est gratuit, les dons sont vraiment appréciables et maintiennent le développement! Caractéristique

GalackQSM 8 Oct 02, 2022
Retrying library for Python

Tenacity Tenacity is an Apache 2.0 licensed general-purpose retrying library, written in Python, to simplify the task of adding retry behavior to just

Julien Danjou 4.3k Jan 02, 2023
⚙️ Compile, Read and update your .conf file in python

⚙️ Compile, Read and update your .conf file in python

Reece Harris 2 Aug 15, 2022
Python solutions to Codeforces problems

CodeForces This repository is dedicated to my Python solutions for CodeForces problems. Feel free to copy, contribute and/or comment. If you find any

Shukur Sabzaliev 15 Dec 20, 2022
Simple project to assist in tracking/logging my working hours

Fill working hours Basic script to assist in the logging/tracking of my working hours How it works Create a file called projects.json in this director

Robin Kennedy-Reid 2 Oct 31, 2022
Final Fantasy XIV Auto House Clicker

Final Fantasy XIV Auto House Clicker

KanameS 0 Mar 31, 2022
This repository contains a lot of short scripting programs implemented both in Python (Flask) and TypeScript (NodeJS).

fast-scripts This repository contains a lot of short scripting programs implemented both in Python (Flask) and TypeScript (NodeJS). In python These wi

Nahum Maurice 3 Dec 10, 2022
Manjaro CN Repository

Manjaro CN Repository Automatically built packages based on archlinuxcn/repo and manjarocn/docker. Install Add manjarocn to /etc/pacman.conf: Please m

Manjaro CN 28 Jun 26, 2022
Python meta class and abstract method library with restrictions.

abcmeta Python meta class and abstract method library with restrictions. This library provides a restricted way to validate abstract methods. The Pyth

Morteza NourelahiAlamdari 8 Dec 14, 2022
Python interface to IEX and IEX cloud APIs

Python interface to IEX Cloud Referral Please subscribe to IEX Cloud using this referral code. Getting Started Install Install from pip pip install py

IEX Cloud 41 Dec 21, 2022