Teselagen Biotechnology API client
Project description
TeselaGen Python API Client
The TeselaGen Python API Client runs on Python 3.9+
NOTE : All the following commands are supposed to be run on the base directory, unless specified.
Library Installation
This library contains the TeselaGen Python API Client.
To install it locally with pip:
pip3 install teselagen
Use and login
Import the teselagen
library:
from teselagen.api import TeselaGenClient
Create an instance of the client:
client = TeselaGenClient(host_url="https://<INSTANCE NAME>.teselagen.com/")
Then, login by using your user email and One Time Password (OTP). You can get one from Settings
-> API Password
within the application. Alternatively ,you can use your application password.
client.login(username="my@email.com", password="<OTP OR PASSWORD>")
Once you have logged in, you don't need to do it everytime. By default login token lasts for 1 week, but you can change the duration on creation by specifying an expiration time:
client.login(username="my@email.com", password="<OTP OR PASSWORD>", expiration_time="1d")
Examples
Check out the provided examples. To be able to run them:
-
Clone or download
teselagen/examples
-
Open any notebook in the
examples
folder with Jupyter Notebook
Use the provided environment
You can use the provided docker environment that contains a ready to use installation of all required packages to run the notebooks. Here are the instructions according to your OS
Linux/MacOS
-
After clone/download, run the build script with
bash build.sh
-
Run the container with
bash run.sh
-
Open your browser and set the address:
http://localhost:8888
. From there you can explore all example notebooks
Development (Linux/MacOS)
Docker environment
-
Build the docker environment with command
bash build.sh
-
Run the container as a developer with the command
bash run_dev.sh
. With this command theteselagen
library will be installed in editable mode.
Dependencies
Install dependencies
If lock file exists (the lock file contains fixed versions of dependencies), the poetry install
command will install
all dependencies according to the lock file (lock file must be added to the repo). If the file does not exist, it
will generate the lock file again.
Update dependencies
Use this command if you made changes on the dependencies at the pyproject.toml
file:
poetry update
It is the equivalent to make an install after deleting the lock
file.
Tests
-
Add your credentials
To run the tests, you must create a
.credentials
file containing the test username and password, in the root folder.The content of
.credentials
file should look similar to the following:{ "username" : "ReplaceWithYourUsername", "password" : "ReplaceWithYourPassword" }
- NOTE: It should be a valid
JSON
file.JSON with Comments
(JSONC
) format is not supported.
- DO NOT COMMIT THIS FILE : .credentials
- NOTE: It should be a valid
-
Modify configuration
You may modify some test configuration parameters by creating a
.test_configuration
file. This is aJSON
formatted file, where you can edit the server name used for tests. This file must be stored next to.credentials
file. Here is an example{ "host_url" : "https://platform.teselagen.com" }
- NOTE: It should be a valid
JSON
file.JSON with Comments
(JSONC
) format is not supported.
- NOTE: It should be a valid
-
Run the tests
cd /home && python3 setup.py test
You may use the docker environment for testing. For that, first build the environment with
bash build.sh
. Then just run the container withbash run_dev.sh
. Once inside (docker exec -ti tgclient bash
), go tohome/
and you are ready to run the test command shown above.
Publishing
Publishing is limited to administrators. PyPi publishing is made by using poetry.
To publish:
-
Run
poetry build
from the project's root folder (same directory aspyproject.toml
) -
Be sure you have set the credentials with the api token:
poetry config pypi-token.pypi <TOKEN>
Ask for a token to administrators if needed
- Publish (check you have set a new version tag in
pyproject.toml
):
poetry publish
Notes
Default shell in Ubuntu
is dash
, to which /bin/sh
is symlinked. But dash
doesn't have the pipefail
option.
That's why some of our shell scripts have the following line:
# pipefail is necessary to propagate exit codes (but it may not be supported by your shell)
bash | set -o pipefail > /dev/null 2>&1
For example, the following commands will list all options supported by set
in each of the respective shells:
sh -c 'set -o'
dash -c 'set -o'
bash -c 'set -o'
zsh -c 'set -o'
So, in Ubuntu
it may be recommended to use bash
instead of sh
.
bash some_shell_script.sh
Or, as follows:
. some_shell_script.sh
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
Built Distribution
File details
Details for the file teselagen-0.4.9.tar.gz
.
File metadata
- Download URL: teselagen-0.4.9.tar.gz
- Upload date:
- Size: 128.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.1.10 CPython/3.9.13 Linux/5.10.104-linuxkit
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 523ff440d87f1fdf6b583013979e2ed01faa52a725e4b24bf95a74e14d4ebf14 |
|
MD5 | 36fa0e3c8a122759dd16116c8aaee90f |
|
BLAKE2b-256 | e9b9150f1eb2f366d378a7987403dcc293c755e61b99ffba28614c3703c5c6ae |
File details
Details for the file teselagen-0.4.9-py3-none-any.whl
.
File metadata
- Download URL: teselagen-0.4.9-py3-none-any.whl
- Upload date:
- Size: 140.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.1.10 CPython/3.9.13 Linux/5.10.104-linuxkit
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 677082162abde0964af0bcf328bfc5cee597329fa9f1fd9deb4479cda5c75127 |
|
MD5 | 87a75b8c124307880ab5e3e7f51fb963 |
|
BLAKE2b-256 | 7b7741892c8f525356c088a4afccd3c40488df57f420a6659392e6e983da9fd7 |