Package: taigapy
taigapyPython client for fetching datafiles from and creating/updating datasets inTaiga.Seetaigrfor the R client.Table of ContentsQuickstartPrerequisitesInstallingUsageGet datafile as dataframeDownload fileCreate datasetUpdate datasetGet dataset metadataSupportDevelopmentSetupRunning TestsPublishing TaigapyQuickstartPrerequisitesFirst, you need to get your authorization token so the client library can make requests on your behalf. Go tohttps://cds.team/taiga/token/and click on the "Copy" button to copy your token. Paste your token in a file at~/.taiga/token.mkdir~/.taiga/echoYOUR_TOKEN_HERE>~/.taiga/tokenInstallingUse the package managerpipto install taigapy.pipinstalltaigapyUsageSeedocsfor the complete documentation.Get datafile as dataframeGet a NumericMatrix/HDF5 or TableCSV/Columnar file from Taiga as apandas DataFramefromtaigapyimportTaigaClienttc=TaigaClient()# These two steps could be merged in one with `from taigapy import default_tc as tc`df=tc.get("achilles-v2-4-6.4/data")# df is a pandas DataFrame, with data from the file 'data' in the version 4 of the dataset 'achilles-v2-4-6'Download fileDownload the raw (plaintext of Raw, CSV otherwise) file from Taigafromtaigapyimportdefault_tcastcpath=tc.download_to_cache("achilles-v2-4-6.4/data")# path is the local path to the downloaded CSVCreate datasetCreate a new dataset in folder with idfolder_id, with local filesupload_filesand virtual filesadd_taiga_ids.fromtaigapyimportdefault_tcastcnew_dataset_id=tc.create_dataset("dataset_name",dataset_description="description",# optional (but recommended)upload_files=[{"path":"path/to/file","name":"name of file in dataset",# optional, will use file name if not provided"format":"Raw",# or "NumericMatrixCSV" or "TableCSV""encoding":"utf-8"# optional (but recommended), will use iso-8859-1 if not provided}],add_taiga_ids=[{"taiga_id":"achilles-v2-4-6.4/data","name":"name in new dataset"# optional, will use name in referenced dataset if not provided (required if there is a name collision)}],add_gcs_files=[{"gcs_path":"gs://bucket_name/file_name.extension","name":"name of file in dataset",}],folder_id="folder_id",# optional, will default to your home folder if not provided)Update datasetCreate a new dataset in folder with idfolder_id, with local filesupload_filesand virtual filesadd_taiga_ids.fromtaigapyimportdefault_tcastcnew_dataset_id=tc.update_dataset("dataset_permaname",changes_description="description",upload_files=[{"path":"path/to/file","name":"name of file in dataset",# optional, will use file name if not provided"format":"Raw",# or "NumericMatrixCSV" or "TableCSV""encoding":"utf-8"# optional (but recommended), will use iso-8859-1 if not provided}],add_taiga_ids=[{"taiga_id":"achilles-v2-4-6.4/data","name":"name in new dataset"# optional, will use name in referenced dataset if not provided (required if there is a name collision)}],add_gcs_files=[{"gcs_path":"gs://bucket_name/file_name.extension","name":"name of file in dataset",}],add_all_existing_files=True,# If True, will add all files from the base dataset version, except files with the same names as those in upload_files or add_taiga_ids)Get dataset metadataGet metadata about a dataset or dataset version. See fields returned inTaigaClient APIfromtaigapyimportdefault_tcastcmetadata=tc.get_dataset_metadata("achilles-v2-4-6.4")SupportPleaseopen an issueif you find a bug, or emailyejia@broadinstitute.orgfor general assistance.DevelopmentSetupIn an environment with Python 3.6, runsh setup.shto set up requirements and git hooks.Runpython setup.py develop.Running TestsThe fetch (i.e.get,download_to_cache,get_dataset_metadata, etc.) will run against the production Taiga server. The create and update dataset tests will run against your locally hosted Taiga.To run the fetch tests, runpytest.To run all the tests,set up Taiga locally, then runpytest --runlocal.Publishing TaigapyTo create a new version, please update the version number intaigapy/__init__.pyandgit tagthe commit with that version number. Push the tags to GitHub and create a new release with the tag. Update thechangelogwith the changes.Publish a new version of taigapy to pypi by executingpublish_new_taigapy_pypi.sh, which will do the following:rm -r dist/python setup.py bdist_wheel --universaltwine upload dist/*