https://github.com/broadinstitute/gumbo_client

python client for DepMap Gumbo database

https://github.com/broadinstitute/gumbo_client

Science Score: 26.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
  • Academic publication links
  • Academic email domains
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (12.7%) to scientific vocabulary
Last synced: 10 months ago · JSON representation

Repository

python client for DepMap Gumbo database

Basic Info
  • Host: GitHub
  • Owner: broadinstitute
  • Language: Python
  • Default Branch: main
  • Size: 341 KB
Statistics
  • Stars: 5
  • Watchers: 11
  • Forks: 0
  • Open Issues: 1
  • Releases: 0
Created about 4 years ago · Last pushed 12 months ago
Metadata Files
Readme

README.md

Gumbo Python Client

A python package for reading/writing to the gumbo database

Installations

Note: the client has been switched to the v2 of the client which works very differently. The installation instructions below have changed

If using poetry, run:

poetry source add --priority=supplemental public-python https://us-central1-python.pkg.dev/cds-artifacts/public-python/simple/ poetry add --source public-python gumbo-rest-client

Otherwise, if you don't use poetry, install via pip

pip install --extra-index-url=https://us-central1-python.pkg.dev/cds-artifacts/public-python/simple/ gumbo-rest-client

This repo now only contains the new version of the gumbo client which no longer makes direct connections to the database but instead uses a hosted service. From the users perspective this just means:

  1. Simpler setup (no need to download the proxy, and debug differing versions)
  2. No need for the client to launch a separate task in the background
  3. Fewer connection errors

To use the new client, first run gcloud auth application-default login to set up your google credentials which will be used as the default app credientials.

Afterwards, you should be able to import Client from gumbo_rest_client and then use it as you normally would to read tables such as in the below:

``` from gumborestclient import Client

client = Client() df = client.get("depmapmodeltype") ```

If you're writing a script which should use a service account instead of your user credentials, make sure the service account is set up to be the default app credentials (setting GOOGLE_APPLICATION_CREDENTIALS if necessary) and then use the following code to create the client:

``` from gumborestclient import Client, createauthorizedsession

client = Client(username="myscriptname", authedsession=createauthorizedsession(usedefaultserviceaccount=True)) df = client.get("depmapmodeltype") ```

If you want to test against the staging version, provide a different base_url ``` from gumborestclient import Client, staging_url

client = Client(baseurl=stagingurl) df = client.get("depmapmodeltype") ```

Usage

Read or write from the following tables: - model - modelcondition - omicsprofile - omicssequencing - screen - screensequence

The client will autocommit changes after insertions or updates.

``` from gumborestclient import Client

client = Client()

to read

df = client.get("table_name")

to only update existing rows:

client.updateonly("tablename", df) # throws an exception if a given row doesn't already exist

to only insert new rows:

client.insertonly("tablename", newrowsdf) # throws an exception if a given row already exists

finally, close the database connection

client.close() ```

Debugging Connection Issues

If you get a "Bad Request" error while trying to create the client (client = Client()): 1. Make sure you are logged in with Broad Google account, not a service account. You can check by running gcloud auth list 2. It's possible you have previously set application-default credentials set which are overriding your main user credentials. You can try resetting the application default credentials by running cloud auth application-default login and logging in with your Broad Google account.

If you get an error about "Unable to acquire impersonated credentials ... PERMISSION_DENIED ... iam.serviceAccounts.getAccessToken" you are probably missing a required permission. Make sure your account has been granted "Service Account Token Creator" access on the service account gumbo-client-iap-auth@depmap-gumbo.iam.gserviceaccount.com. An admin can make this change in the Google Console's Service Account page (under the depmap-gumbo project).

Using the client with a service account

If you are writing your script to run from a non-interactive process, you will need a service account for it to run under and initialize the client. This service account will need to be granted access to the API via IAP permissions. To grant, go to https://console.cloud.google.com/security/iap?referrer=search&project=depmap-gumbo and grant the "IAP Secured Web App User" role to the service account on the resource "rest-api-v2" (for the production instance) and "rest-api-v2-staging" (for the staging instance).

Also, you should pass in a useful label for username so we know the source of the updates when they are recorded to the audit log.

Running tests

The codebase is organized into a few different python modules, some of which have dependencies on one another.

After checking out repo, make sure to run ./all_install.sh to create a poetry environment for each one.

In the parent run ./all_tests.sh to run all tests. Alternatively you can cd to a particular module and run the tests for that module via poetry run pytest.

Publishing new versions of the gumbo client python package

There's nothing in this repo that is private or secret, however, this is an internal tool, so it doesn't seem like it should be published on Pypi. Instead we can publish to an internal package index.

To setup for publishing (Based on https://medium.com/google-cloud/python-packages-via-gcps-artifact-registry-ce1714f8e7c1 )

``` poetry self add keyrings.google-artifactregistry-auth poetry config repositories.public-python https://us-central1-python.pkg.dev/cds-artifacts/public-python/

also make sure you've authentication via "gcloud auth login" if you haven't already

```

Then you can navigate into the package directory and bump the version: cd gumbo-rest-client/ poetry version patch

And then publish via: poetry publish --build --repository public-python

Owner

  • Name: Broad Institute
  • Login: broadinstitute
  • Kind: organization
  • Location: Cambridge, MA

Broad Institute of MIT and Harvard

GitHub Events

Total
  • Push event: 6
Last Year
  • Push event: 6

Issues and Pull Requests

Last synced: over 1 year ago

All Time
  • Total issues: 1
  • Total pull requests: 13
  • Average time to close issues: N/A
  • Average time to close pull requests: 5 days
  • Total issue authors: 1
  • Total pull request authors: 3
  • Average comments per issue: 0.0
  • Average comments per pull request: 0.15
  • Merged pull requests: 13
  • Bot issues: 0
  • Bot pull requests: 0
Past Year
  • Issues: 0
  • Pull requests: 5
  • Average time to close issues: N/A
  • Average time to close pull requests: 7 days
  • Issue authors: 0
  • Pull request authors: 3
  • Average comments per issue: 0
  • Average comments per pull request: 0.0
  • Merged pull requests: 5
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
  • joshdempster (1)
Pull Request Authors
  • snwessel (6)
  • dpmccabe (6)
  • pgm (5)
Top Labels
Issue Labels
Pull Request Labels

Dependencies

.github/workflows/run_checks.yaml actions
  • actions/checkout v3 composite
  • actions/setup-python v3 composite
  • snok/install-poetry v1 composite
dataframe-json-packing/poetry.lock pypi
  • colorama 0.4.6
  • exceptiongroup 1.2.0
  • iniconfig 2.0.0
  • nodeenv 1.8.0
  • numpy 1.24.4
  • numpy 1.26.3
  • packaging 23.2
  • pandas 1.5.3
  • pluggy 1.3.0
  • pyright 1.1.347
  • pytest 7.4.4
  • python-dateutil 2.8.2
  • pytz 2023.3.post1
  • setuptools 69.0.3
  • six 1.16.0
  • tomli 2.0.1
dataframe-json-packing/pyproject.toml pypi
  • pyright ^1.1.347 develop
  • pytest ^7.4.4 develop
  • pandas ^1.4.3
  • python ^3.8
gumbo-client-example/poetry.lock pypi
  • cachetools 5.3.2
  • certifi 2023.11.17
  • charset-normalizer 3.3.2
  • colorama 0.4.6
  • dataframe-json-packing 0.2.0
  • exceptiongroup 1.2.0
  • google-auth 2.26.2
  • gumbo-rest-client 0.1.0
  • idna 3.6
  • iniconfig 2.0.0
  • numpy 1.26.3
  • packaging 23.2
  • pandas 1.5.3
  • pluggy 1.3.0
  • pyasn1 0.5.1
  • pyasn1-modules 0.3.0
  • pytest 7.4.4
  • python-dateutil 2.8.2
  • pytz 2023.3.post1
  • requests 2.31.0
  • rsa 4.9
  • six 1.16.0
  • tomli 2.0.1
  • urllib3 2.1.0
gumbo-client-example/pyproject.toml pypi
  • gumbo-rest-client *
  • python ^3.9
gumbo-dao/poetry.lock pypi
  • colorama 0.4.6
  • exceptiongroup 1.2.0
  • iniconfig 2.0.0
  • nodeenv 1.8.0
  • numpy 1.24.4
  • numpy 1.26.3
  • packaging 23.2
  • pandas 1.5.3
  • pluggy 1.3.0
  • psycopg2-binary 2.9.9
  • pyright 1.1.347
  • pytest 7.4.4
  • python-dateutil 2.8.2
  • pytz 2023.3.post1
  • setuptools 69.0.3
  • six 1.16.0
  • tomli 2.0.1
gumbo-dao/pyproject.toml pypi
  • pyright ^1.1.347 develop
  • pytest ^7.4.4 develop
  • pandas ^1.1.0
  • psycopg2-binary ^2.9.9
  • python ^3.8
gumbo-rest-client/poetry.lock pypi
  • annotated-types 0.6.0
  • anyio 4.2.0
  • cachetools 5.3.2
  • certifi 2023.11.17
  • charset-normalizer 3.3.2
  • colorama 0.4.6
  • dataframe-json-packing 0.1.0
  • exceptiongroup 1.2.0
  • fastapi 0.109.0
  • google-auth 2.26.2
  • gumbo-dao 0.1.0
  • gumbo-rest-service 0.1.0
  • h11 0.14.0
  • httpcore 1.0.2
  • httpx 0.26.0
  • idna 3.6
  • iniconfig 2.0.0
  • nodeenv 1.8.0
  • numpy 1.24.4
  • numpy 1.26.3
  • packaging 23.2
  • pandas 1.5.3
  • pluggy 1.3.0
  • psycopg2-binary 2.9.9
  • pyasn1 0.5.1
  • pyasn1-modules 0.3.0
  • pydantic 2.5.3
  • pydantic-core 2.14.6
  • pyright 1.1.347
  • pytest 7.4.4
  • python-dateutil 2.8.2
  • python-dotenv 1.0.0
  • pytz 2023.3.post1
  • requests 2.31.0
  • rsa 4.9
  • setuptools 69.0.3
  • six 1.16.0
  • sniffio 1.3.0
  • starlette 0.35.1
  • tomli 2.0.1
  • typing-extensions 4.9.0
  • urllib3 2.1.0
gumbo-rest-client/pyproject.toml pypi
gumbo-rest-service/poetry.lock pypi
  • annotated-types 0.6.0
  • anyio 4.2.0
  • certifi 2023.11.17
  • click 8.1.7
  • colorama 0.4.6
  • dataframe-json-packing 0.1.0
  • exceptiongroup 1.2.0
  • fastapi 0.109.0
  • gumbo-dao 0.1.0
  • gunicorn 21.2.0
  • h11 0.14.0
  • httpcore 1.0.2
  • httpx 0.26.0
  • idna 3.6
  • iniconfig 2.0.0
  • nodeenv 1.8.0
  • numpy 1.26.3
  • packaging 23.2
  • pandas 1.5.3
  • pluggy 1.3.0
  • psycopg2-binary 2.9.9
  • pydantic 2.5.3
  • pydantic-core 2.14.6
  • pyright 1.1.347
  • pytest 7.4.4
  • python-dateutil 2.8.2
  • python-dotenv 1.0.0
  • pytz 2023.3.post1
  • setuptools 69.0.3
  • six 1.16.0
  • sniffio 1.3.0
  • starlette 0.35.1
  • tomli 2.0.1
  • typing-extensions 4.9.0
  • uvicorn 0.26.0
gumbo-rest-service/pyproject.toml pypi
  • httpx ^0.26.0 develop
  • pyright ^1.1.347 develop
  • pytest ^7.4.4 develop
  • dataframe-json-packing *
  • fastapi ^0.109.0
  • gumbo-dao *
  • gunicorn ^21.2.0
  • pandas ^1.1.0
  • psycopg2-binary ^2.9.9
  • python ^3.9
  • python-dotenv ^1.0.0
  • uvicorn ^0.26.0