Skip to main content

Python client for the Molgenis EMX2 API

Project description

The Molgenis EMX2 Pyclient is Python package developed to be used for data management on Molgenis EMX2 servers. A detailed overview of the capabilities is presented in the MOLGENIS documentation.

Installation

The releases of the package are hosted at PyPI. The recommended way to install the latest version is through pip.

pip install molgenis-emx2-pyclient

How to use

Within your Python project import the class Client and instantiate it as a context manager. Operations and queries can then be executed from within the context.

from molgenis_emx2_pyclient import Client

username = 'username'
password = '...'

with Client('https://example.molgeniscloud.org') as client:
    client.signin(username, password)

    # Retrieve signin information
    print(client.status)
    """ Output:
    Host: https://example.molgeniscloud.org
    Status: Signed in
    Schemas:
        CatalogueOntologies
        catalogue
        ExampleSchema
        ...
    Version: v10.10.1
    """
    
    # Retrieve data from a table on a schema
    data = client.get(schema='ExampleSchema', table='Cohorts')
    
    # Create a new schema on the server
    client.create_schema(name='New Schema')
    
    # Delete a schema from the server
    client.delete_schema(name='New Schema')

Instead of signing in with a username and password the client can also be used while authorized by a (temporary) token that is generated on the server. See the MOLGENIS documentation for generating tokens

from molgenis_emx2_pyclient import Client

token = '...'

with Client('https://example.molgeniscloud.org', token=token) as client:

    # Retrieve signin information
    print(client.status)
    """ Output:
    Host: https://example.molgeniscloud.org
    User: token
    Status: session-less
    Schemas:
        CatalogueOntologies
        catalogue
        ExampleSchema
        ...
    Version: v10.32.1
    """
    
    ...
    ...

Development

Clone the molgenis-emx2 repository from GitHub

git clone git@github.com:molgenis/molgenis-emx2.git

Change the working directory to .../tools/pyclient

Create a virtual Python environment

On macOS:

python -m venv venv

On Linux:

python3.11 -m venv venv

On Windows:

py -3.11 venv venv

Activate the virtual environment

On macOS and Linux:

source venv/bin/activate

On Windows:

.venv\Scripts\activate.bat

Install the script dependencies

pip install -r requirements.txt

Build

Before building the source, the package build needs to be installed.

(venv) $ pip install build

(venv) $ python -m build

(venv) $ pip install dist/molgenis_emx2_pyclient*.whl

Project details


Release history Release notifications | RSS feed

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

molgenis_emx2_pyclient-10.67.0.tar.gz (14.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

molgenis_emx2_pyclient-10.67.0-py3-none-any.whl (15.3 kB view details)

Uploaded Python 3

File details

Details for the file molgenis_emx2_pyclient-10.67.0.tar.gz.

File metadata

  • Download URL: molgenis_emx2_pyclient-10.67.0.tar.gz
  • Upload date:
  • Size: 14.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.0 CPython/3.11.0rc1

File hashes

Hashes for molgenis_emx2_pyclient-10.67.0.tar.gz
Algorithm Hash digest
SHA256 b578d60f5b9a02628f9145b62dc5ee224da4ee2148875f3aa415a585ff9c6256
MD5 1c38edd8ae15c2e66f66f70f9c916c55
BLAKE2b-256 1828f25bf9b261b8cf91ee7fc847472eef61b9e3255919b38baff9913ec59bd4

See more details on using hashes here.

File details

Details for the file molgenis_emx2_pyclient-10.67.0-py3-none-any.whl.

File metadata

File hashes

Hashes for molgenis_emx2_pyclient-10.67.0-py3-none-any.whl
Algorithm Hash digest
SHA256 00962b496a70d2083081eb71eb8d76531039f7af3ad10b5b6dfc3a0d6bdb1a87
MD5 e170814b6f22083fa9687195d7093f5e
BLAKE2b-256 628e5a3d67c60fd14860aeef9873bb86103185b0a2f3c3aaa248314a128e2ce1

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page