The TeselaGen Python API Client runs on Python 3.
NOTE : All the following commands are supposed to be run on the base
directory, unless specified.
This library contains the TeselaGen Python API Client.
To install it locally,
-
Install it with pip
pip3 install teselagen
To be able to run the examples
, you need to (after installing the library)
-
Clone or download
lib/examples
-
Open any notebook in the
examples
folder with Jupyter Notebook
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
-
After clone/download, go to
docker_environment
and run the build script withsh build.sh
-
Run the container with
sh run.sh
-
Open your browser and set the address:
http://localhost:8888
. From there you can explore all example notebooks
-
Build the docker environment with command
sh build.sh
-
Run the container as a developer with the command
sh run_dev.sh
. With this command theteselagen
library will be installed in editable mode.
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 doens't exist it will generate
the lock file again.
Use this command if you made changes on the dependencies at the toml file:
poetry update
It is the equivalent to make an install after deleting the lock
file.
-
Add your credentials
To run the tests, you must create a
.credentials
file containing the test username and password, in the root folder (teselagenpy/lib
).The content of
.credentials
file should look similar to the following:{ "username" : "ReplaceWithYourUsername", "password" : "ReplaceWithYourPassword" }
- DO NOT COMMIT THIS FILE : .credentials
-
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" }
-
Run the tests (on
/lib
folder)python3 setup.py test
You may use the docker environment for testing. For that, first build the environment with
sh build.sh
at thedocker_environment
folder. Then just run the container withsh run_dev.sh
. Once inside (docker exec -ti tgclient bash
), go tohome/development/lib
and you are ready to run the test command shown above.
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 as pyproject.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