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
examplesfolder with Jupyter Notebook
Development
Poetry virtual environment
For development you can just use the virtual environment created by poetry. To install the project within a virtual environment, use at the project's root folder:
poetry install
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
.credentialsfile containing the test username and password, in the root folder.The content of
.credentialsfile should look similar to the following:{ "username" : "ReplaceWithYourUsername", "password" : "ReplaceWithYourPassword" }
- NOTE 1: It should be a valid
JSONfile.JSON with Comments(JSONC) format is not supported. - NOTE 2: You may also add a
hostfield. It's value will be used as default host name.
- DO NOT COMMIT THIS FILE : .credentials - NOTE 1: It should be a valid
-
Modify configuration
You may modify some test configuration parameters by creating a
.test_configurationfile. This is aJSONformatted file, where you can edit the server name used for tests. This file must be stored next to.credentialsfile. Here is an example{ "host_url" : "https://platform.teselagen.com" }
- NOTE: It should be a valid
JSONfile.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 buildfrom 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
Metadata
Release files for teselagen 0.5.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| teselagen-0.5.0.tar.gz | 124.9 kB | Without provenance | Details for teselagen-0.5.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| teselagen-0.5.0-py3-none-any.whl | Python 3 | none | any | Details for teselagen-0.5.0-py3-none-any.whl |
Total release size: 263.3 kB
Release files / teselagen-0.5.0.tar.gz
| Download URL | teselagen-0.5.0.tar.gz |
|---|---|
| Size | 124.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
bf989aa2cd3eaa34bc1f760c22f9a0cca6fbf40eaecfa3173acf78e2a50d6436
|
|
BLAKE2b-256 checksum How to use checksums |
333231e720c9d95edbdcc53f675a60e0dff59dff62ea483a8f9f18cf8dac1087
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.8.3 CPython/3.11.6 Darwin/23.5.0
|
Release files / teselagen-0.5.0-py3-none-any.whl
| Download URL | teselagen-0.5.0-py3-none-any.whl |
|---|---|
| Size | 138.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
a8ab3ed919f3f646a626f693a1a7783e5ac09c72875a7a90ff07ffb0ba4800ce
|
|
BLAKE2b-256 checksum How to use checksums |
7fe3919ac379cc8fdc91ad2afc315cf454cfeccfe921dc1d974e58df33926727
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.8.3 CPython/3.11.6 Darwin/23.5.0
|
Security for teselagen 0.5.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.