
Security News
Crates.io Implements Trusted Publishing Support
Crates.io adds Trusted Publishing support, enabling secure GitHub Actions-based crate releases without long-lived API tokens.
The Cortex Python module provides an API client library to easily integrate with the Cortex Cognitive Platform. Refer to the Cortex documentation for details on how to use the library:
There are several installation options available:
poetry add cortex-python
poetry add cortex-python[model_development]
poetry add cortex-python[model_runtime]
poetry config http-basic.sensa <USER> <TOKEN>
poetry add cortex-python[model_development,certifai]
git clone git@github.com:CognitiveScale/cortex-python.git
cd cortex-python
# Needed for certifai components
poetry config http-basic.sensa <USER> <TOKEN>
poetry install
When developing, it's a best practice to work in a virtual environment. Create and activate a virtual environment:
poetry install
poetry shell
Install developer dependencies:
git clone git@github.com:CognitiveScale/cortex-python.git
cd cortex-python
make dev.install
Run Developer test and linting tasks: Three types of checks are configured for this:
tox.ini
There's a convenience Makefile
that has commands to common tasks, such as build, test, etc. Use it!
Follow above setup instructions (making sure to be in the virtual environment and having the necessary dependencies)
make test
to run test suiteTo run an individual file or class method, use pytest. Example tests shown below:
pytest test/unit/agent_test.py
pytest test/unit/agent_test.py::TestAgent::test_get_agent
Note: this repository using git tag for versionning
git tag -a 6.5.0a<N> -m 'alpha tag'
git push --tags
make dev.push
This will build an alpha-tagged package.
2. Merge develop
to staging
branch:
make stage
staging
to master
.git tag -a 6.5.0 -m 'rlease tag'
git push --tags
After contributing to the library, and before you submit changes as a PR, please do the following
make test
setup.py
version and update the CHANGELOG.md
Activate your virtual environment:
poetry shell
Set up your environment, if you have not done so:
make dev.install
The package documentation is built with Sphinx and generates versioned documentation for all tag matching the release/X.Y.Z
pattern and for the master
branch. To build the documentation:
make docs.multi
The documentation will be rendered in HTML format under the docs/_build/${VERSION}
directory.
There are four mechanisms for configuring a client connection.
Use $HOME/.cortex/config
file setup via cortex configure
.
from cortex.client import Cortex
client=Cortex.client(verify_ssl_cert=True|False)
Use environment variables CORTEX_URL, CORTEX_TOKEN, and CORTEX_PROJECT
from cortex.client import Cortex
client=Cortex.client(verify_ssl_cert=True|False)
This is a table of supported environment variables.
These ENV vars are injected by the Sensa RUNTIME for use during skill startup.
Environment variables | Description |
---|---|
CORTEX_PERSONAL_ACCESS_CONFIG | JSON string containing a Pesonal Access Token obtained from the console UI |
CORTEX_CONFIG_DIR | A folder containing the config created by the cortex configure command |
CORTEX_TOKEN | A JWT token generate by cortex configure token or provided during skill invokes |
CORTEX_PROJECT | Project used during api requests |
CORTEX_URL | URL for Sensa apis |
Use method kwargs with Cortex.client()
from cortex.client import Cortex
client=Cortex.client(api_endpoint="<URL>", token="<token>", project="<project>", verify_ssl_cert=True|False)
Using the skills invoke message, this allows for authentication using the caller's identity.
from cortex.client import Cortex
client=Cortex.from_message({})
FAQs
Python module for the Tecnotree Sensa Platform
We found that cortex-python demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Crates.io adds Trusted Publishing support, enabling secure GitHub Actions-based crate releases without long-lived API tokens.
Research
/Security News
Undocumented protestware found in 28 npm packages disrupts UI for Russian-language users visiting Russian and Belarusian domains.
Research
/Security News
North Korean threat actors deploy 67 malicious npm packages using the newly discovered XORIndex malware loader.