- Info:
Check Github for the latest source code and documentation for more information.
- Maintainer:
Aito <admin@aito.ai>
About
The Aito Python SDK is an open-source library that helps you to integrate your Python application to Aito quicker and more efficiently.
The SDK also includes the Aito Command Line Interface (CLI) that enables you to interact with Aito using commands in your command-line shell, e.g: infer a table schema from a file or upload a file to Aito.
The Aito v2 API
AitoClient speaks the v1 API. For the v2 API, use AitoClientV2:
from aito.client.v2 import AitoClientV2 client = AitoClientV2(instance_url, api_key) prediction = client.predict( from_table='invoices', where={'vendor': 'Elenia Oy'}, predict='gl_code') print(prediction.first.value, prediction.first.probability)
v2 is a separate client class rather than a flag on the v1 one, because the two APIs return genuinely different response shapes. The reasoning is written up in docs/v2-client-design.md, and examples/v2_quickstart.py is a runnable end-to-end example that creates a collection, loads it, predicts, explains, evaluates and drops it again.
Support / Feedback
For issues with, questions about, or feedback, please join our support channels.
Installation
Aito Python SDK can be installed with pip
$ pip install aitoai
Check our installation guide for more information
Documentation
You will need sphinx installed to generate the documentation.
$ pip install sphinx $ pip install sphinx_rtd_theme
Documentation can be generated by:
$ cd docs $ make clean html
Generated documentation can be found in the docs/build/html/* directory.
Dependencies:
The Python SDK SQL integration and the tests depend on the ODBC db drivers and the postgres and mysql functionality.
The main drivers can be installed in Debian based Linuxes with:
` sudo apt install unixodbc-dev odbc-postgresql postgresql-client default-mysql-client pip install pyodbc `
You can find more information about installing the MySQL ODBC drivers [here](https://dev.mysql.com/doc/connector-odbc/en/connector-odbc-installation.html)
Also note: that the database integration tests require local postgres / mySQL servers.
Environment:
To run the test, you need to have the following environment variables defined:
AITO_GROCERY_DEMO_INSTANCE_URL
AITO_GROCERY_DEMO_API_KEY
AITO_INSTANCE_URL
AITO_API_KEY
Testing
Install the required packages:
$ pip install -r requirements/build.txt $ pip install -r requirements/test.txt
You can use our test cli to run tests:
$ python -m tests -h
There are multiple test suites:
CLI suite:
$ python -m tests -v suite cli
SDK suite:
$ python -m tests -v suite sdk
SQL functions tests:
Test against Postgres:
$ python -m tests -v case sql_functions.test_connection.TestPostgresConnection $ python -m tests -v case sql_functions.test_cli_sql_functions.TestPostgresFunctionsTest against MySQL:
$ python -m tests -v case sql_functions.test_connection.TestMySQLConnection $ python -m tests -v case sql_functions.test_cli_sql_functions.TestMySQLFunctions
Build and test built package:
To build the package:
$ pip install -r requirements/deploy.txt $ ./scripts/deploy test.pypi --no-publish -b devWARNING: This will update the version in ‘aito/__init__’ file. DO NOT commit this to Git!
The built wheel should be at `dist/`. To install:
$ pip install dist/aitoai-<version>.whlTo test the built package, create an environment variable `TEST_BUILT_PACKAGE` and run the above tests
Test the documentation:
To test the inline documentation:
$ python -m tests -v suite inline_docsTo test the code blocks in rst files:
$ cd docs $ curl -o reddit_sample.csv https://raw.githubusercontent.com/AitoDotAI/kickstart/master/reddit_sample.csv $ export SPHINX_DISABLE_MOCK_REQUIREMENTS=TRUE $ make doctest
Contributing
Making changes
Add unittest to the appropriate test suite (e.g: test case for Aito Schema: tests/sdk/test_aito_schema.py) or create a new test suite inside the tests folder
Add documentation:
Inline documentation if applicable
Update .rst file in docs/source folder (e.g: Add a new Client function to docs/source/sdk.rst)
Add inline doc test if applicable (e.g: inline doc test for Aito Client: tests/inline_docs/test_client_inline_docs.py)
Update the version in aito/__init__ to e.g. ‘1.2.3rc1’ and write release notes in docs/changelog.rst
Check CircleCI and issue a PR
Deploy to production (scripts/deploy) with the appropriate version after the PR is reviewed
Release files for aitoai 0.6.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| aitoai-0.6.1.tar.gz | 71.8 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| aitoai-0.6.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 154.8 kB
Release files / aitoai-0.6.1.tar.gz
| Download URL | aitoai-0.6.1.tar.gz |
|---|---|
| Size | 71.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
d9f42c65a784e1b7597dd3ac86c144859cd0fdc2a89bf14e8cbf07e98decad62
|
|
BLAKE2b-256 checksum How to use checksums |
5a0d83c9e2b0b533897e05e1dfafe2c4070721b4bf27e8db4d4152857d666504
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.11.16
|
Release files / aitoai-0.6.1-py3-none-any.whl
| Download URL | aitoai-0.6.1-py3-none-any.whl |
|---|---|
| Size | 83.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
de0ec20dcfb138b68e3aa32236e82e0d5be00bef2ac3645c06217d50c68ed077
|
|
BLAKE2b-256 checksum How to use checksums |
d16862240df48e7877dfa8fa90dc8c3ab85b8dc9b3a9316c09a63c2c4e8de497
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.11.16
|