Managing Dependencies
Qwak supports a variety of Python frameworks to manage model dependencies.
Poetry
Qwak system uses Poetry version 1.2.2.
Poetry Lock Support
Qwak supports poetry.lock
files as long as they're under the same scope as the pyproject.toml
file.
Given the following model structure:
qwak_based_model/
āāā main/
āāāāā pyproject.toml
āāāāā poetry.lock
āāā tests/
Both files pyproject.toml
and poetry.lock
will be used by Poetry while executing poetry install
cmd.
Poetry Project Starter
Example of quick project starter
[tool.poetry]
name = "Qwak-environment"
version = "0.1.0"
description = "Qwak virtual environment"
authors = ["no-reply@localhost>"]
[tool.poetry.dependencies]
python = "~3.9"
qwak-sdk = "^0.9.138"
[[tool.poetry.source]]
name = "qwak"
url = "https://qwak:[email protected]/artifactory/api/pypi/qwak-pypi/simple"
default = false
secondary = true
[build-system]
requires = ["poetry-core>=1.0.0"]
build-backend = "poetry.core.masonry.api"
As of now, Qwak utilizes Poetry version 1.5.1 to construct the model environment, following the specifications outlined in your project.toml
file
.qwakignore file
Occasionally, we may want to exclude a file from the Qwak build but keep it in the repository with the model code. In such cases, we should add the .qwakignore
file to the root directory of our project.
In the file, we define the patterns to match files to exclude from the model build.
For example, suppose we have the following file structure:
.qwakignore
main/
__init__.py
model.py
README.md
tests/
test_model.py
research/
paper_a.pdf
paper_b.pdf
if we want to exclude the entire research
directory and the README.md
file from the build, our .qwakignore
file may contain:
research
README.md
Hidden files
By default, Qwak disregards hidden files. Hidden files are files or directories whose names start with a dot (.) in Unix-like operating systems, or they may have the "Hidden" attribute set in Windows. These files are typically used to store configuration data or hold temporary information.
Suppose you have a directory with files and subdirectories, including a hidden file named
.config_file
. Qwak, following its default behavior, will exclude this file from processing when triggering a remote build.
Using OpenCV to build a model
If you add the opencv-python
library to your dependencies and import the cv2
module, you will see the following error Exception: Error in importing module libGL.so.1: cannot open shared object file: No such file or directory
.
To fix the problem, we need to modify the base Docker image and use qwakai/qwak:0.0.13-opencv-cpu-py39
as the base image. If you use the GPU instance, you should set qwakai/opencv-gpu-py39
as the base image.
We can do it in two ways
We can add the --base-image qwakai/qwak:0.0.13-opencv-cpu-py39
parameter to the qwak models build
, or we can use the yaml configuration file. The usage of yaml configuration is described in details in our Build Configurations page.
build_env:
docker:
base_image: qwakai/qwak:0.0.13-opencv-cpu-py39
Updated 3 days ago