Skip to content

Latest commit

 

History

History
105 lines (66 loc) · 3.44 KB

File metadata and controls

105 lines (66 loc) · 3.44 KB

Contributing to Fingerprint Server API SDK

Structure

Most files in the project are autogenerated by openapi-generator with urllib3 library for python.

Commit messages

This project follows the Conventional Commits standard. Each commit message should be structured as:

<type>: <description>

[optional body]

Code generation

You need Docker to run code generation with openapi-generator.

You can just run ./generate.sh script and it will do all the work.

To download fresh OpenAPI schema run ./sync.sh

Linting and Formatting

This project uses Ruff for linting and formatting, and MyPy for type checking.

Running locally

# Format code
uv run ruff format .

# Run linter
uv run ruff check --fix .

# Run type checker
uv run mypy fingerprint_server_sdk

Updating templates

When modifying templates in the template/ directory, try to generate code that minimizes formatter changes. This includes:

  • Using single quotes instead of double quotes
  • Sorting imports (standard library -> third-party -> local)
  • Using modern type annotations (list, dict, tuple instead of List, Dict, Tuple)
  • Removing # coding: utf-8 headers (we are already aiming Python 3.9+)

However, some formatting issues are difficult or impossible to fix in Mustache templates due to:

  • Vendor extensions injecting imports that may duplicate template imports
  • Conditional blocks creating extra whitespaces
  • Mustache's limited control over output formatting

In these cases, it's acceptable to let the formatter handle the adjustments. The goal is to minimize unnecessary changes, not eliminate them entirely.

Configuration

Project configuration is described in config.json file. To read about available parameters run the command below:

docker run --rm openapitools/openapi-generator-cli:v7.19.0 config-help -g python

Testing the local source code of the SDK

To make requests using the local source code of the SDK:

  1. Define your Secret API key, Visitor ID, Request ID and Region by creating a .env file at the root of the repository. (See example))
  2. Run the following commands:
uv sync
uv run python run_checks.py

Test environment

You need to install uv. Then you can run:

uv sync

Running tests

uv run pytest

How to publish

We use changesets for handling release notes. If there are relevant changes, please add them to changeset via pnpm exec changeset. You need to run pnpm install before doing so.

Pre-release flow

Pre-release will be created after merging pr to the dev branch and running the release workflow.

Python uses PEP 440 for versions format, so we convert a pre-release version from semver to PEP 440 in the ./generate.sh.