Cogment python SDK
Project description
cogment-py-sdk
Cogment is an innovative open source AI platform designed to leverage the advent of AI to benefit humankind through human-AI collaboration developed by AI Redefined. Cogment enables AI researchers and engineers to build, train and operate AI agents in simulated or real environments shared with humans. For the full user documentation visit https://docs.cogment.ai
This module, cogment-py-sdk, is the Python SDK for making use of Cogment when working with Python. It's full documentation can be consulted at https://docs.cogment.ai/cogment/cogment-api-reference/python/.
Developers
Local setup
Make sure you have the following installed:
Install the dependencies, including downloading and building the cogment protobuf API, by navigating to the python SDK directory and run the following
poetry install
Define used Cogment protobuf API
The version of the used cogment protobuf API is defined in the .cogment-api.yaml file at the root of the repository. The following can be defined:
cogment_api_version: "latest", is the default, it retrieves the latest build of the cogment-apidevelop,cogment_api_version: "vMAJOR.MINOR.PATCH[-PRERELEASE]", retrieves an official release of cogment-api.cogment_api_path: "../path/to/cogment-api", retrieves a local version of cogment-api found at the given path ; if set, this overridescogment_api_version.
⚠️ when building a docker image,
cogment_api_pathneeds to exists in the docker file system. In practice it means it should be a subdirectory of the current directory.
Tests
To run them the first step is to configure the way to launch the orchestrator and the cli in a .env file.
You can copy .env.template for an example of what's expected.
Module tests
These tests only rely on the sdk, no connection to an orchestrator is done.
To execute the module tests, simply run
poetry run task test
Integration tests
These tests launch and use an orchestrator they are slower but more in depth.
Run in a docker image
This is the easiest way to run the tests.
./scripts/run_integration_test.sh
By default it will use the latest public version cogment/orchestrator released on DockerHub. To use specific versions define COGMENT_ORCHESTRATOR_IMAGE.
./scripts/run_integration_test.sh
Run locally
poetry run task test --launch-orchestrator
You'll need to define:
- Either
COGMENT_ORCHESTRATOR_IMAGE(as above) orCOGMENT_ORCHESTRATORas the path to a locally built Cogment orchestrator executable.
Lint
Run the linter using
poetry run task lint
Check conflicting dependencies with "popular" Python packages
./scripts/check_dependencies_conflicts.sh
This script will check for conflicts required by the cogment-py-sdk and the popular Python packages in the AI/ML/Data ecosystem.
Build the source package
Build the source package (this step will only be succesfull if poetry install succeeded)
poetry build -f sdist
Release process
People having mainteners rights of the repository can follow these steps to release a version MAJOR.MINOR.PATCH. The versioning scheme follows Semantic Versioning.
- Run
./scripts/create_release_branch.sh MAJOR.MINOR.PATCHto create the release branch and update the version of the package, - On the release branch, check and update the changelog if needed,
- Update
./.cogment-api.yamlto use the public release of the API, - Update
./.gitlab-ci.yml,integration_test, andCOGMENT_ORCHESTRATOR_IMAGEto match the latest public releases of the orchestrator and cli - Make sure everything's fine on CI,
- Run
./scripts/tag_release.sh MAJOR.MINOR.PATCHto create the specific version section in the changelog, merge the release branch inmain, create the release tag and update thedevelopbranch with those.
The rest, publishing the package to PyPI and updating the mirror repositories, is handled directly by the CI.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
File details
Details for the file cogment-2.0.0rc1.tar.gz.
File metadata
- Download URL: cogment-2.0.0rc1.tar.gz
- Upload date:
- Size: 82.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.1.12 CPython/3.7.12 Linux/5.4.109+
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fbde897eebf34e65e5dc852acd0d48100ebe72e03205679da5b8b297a3a92c98
|
|
| MD5 |
6c3a3b2adf1d935786d51785b8d0bcdf
|
|
| BLAKE2b-256 |
27bc72bdf530c348559a4a0d2fbd2524e3b482e470b44640a4f88de019647bd7
|