You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

1.4 KiB

Developer guide

General info

Most of the files in this package are generated. The gen/ directory contains generator config and templates.

How to generate API

  1. Obtain the REST API schema:
python manage.py spectacular --file schema.yml && mkdir -p cvat-sdk/schema/ && mv schema.yml cvat-sdk/schema/
  1. Generate package code (call from the package root directory):
# pip install -r gen/requirements.txt

./gen/generate.sh

How to edit templates

If you want to edit templates, obtain them from the generator first:

docker run --rm -v $PWD:/local \
    openapitools/openapi-generator-cli author template \
        -o /local/generator_templates -g python

Then, you can copy the modified version of the template you need into the gen/templates/openapi-generator/ directory.

Relevant links:

How to test

API client tests are integrated into REST API tests (/tests/python/rest_api) and SDK tests are placed next to them (/tests/python/sdk). To execute, run:

pytest tests/python/rest_api tests/python/sdk

To allow editing of the package, install it with pip install -e cvat-sdk/.