Metadata-Version: 2.4
Name: aitoai
Version: 0.5.1
Summary: Aito.ai Python SDK
Home-page: https://github.com/AitoDotAI/aito-python-tools
Author: aito.ai
Author-email: admin@aito.ai
Project-URL: Documentation, https://aito-python-sdk.readthedocs.io/en/latest/
Project-URL: Source, https://github.com/AitoDotAI/aito-python-tools
Project-URL: Tracker, https://github.com/AitoDotAI/aito-python-tools/issues
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: Natural Language :: English
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: MacOS :: MacOS X
Classifier: Operating System :: POSIX
Classifier: Operating System :: POSIX :: BSD
Classifier: Operating System :: POSIX :: Linux
Classifier: Operating System :: Microsoft :: Windows
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.6
Classifier: Programming Language :: Python :: 3.7
Classifier: Programming Language :: Python :: 3.8
Requires-Python: >=3.6
Description-Content-Type: text/x-rst
License-File: LICENSE
Requires-Dist: pandas==0.25.3; python_full_version <= "3.6.0"
Requires-Dist: pandas~=1.0; python_full_version > "3.6.0" and python_full_version < "3.9.0"
Requires-Dist: pandas~=2.0; python_full_version >= "3.9.0"
Requires-Dist: requests<4,>=2.22
Requires-Dist: packaging>=21.0
Requires-Dist: aiohttp<4.0,>=3.6.1; python_version >= "3.8"
Requires-Dist: aiohttp~=3.4; python_version < "3.8"
Requires-Dist: ndjson>=0.2.0
Requires-Dist: langdetect<2.0,>=1.0.7
Requires-Dist: argcomplete<4.0,>=1.11.1
Requires-Dist: xlrd<3.0,>=1.1
Requires-Dist: jsonschema~=3.0
Requires-Dist: openpyxl>=3.0.7
Requires-Dist: fastparquet>=0.8
Dynamic: author
Dynamic: author-email
Dynamic: classifier
Dynamic: description
Dynamic: description-content-type
Dynamic: home-page
Dynamic: license-file
Dynamic: project-url
Dynamic: requires-dist
Dynamic: requires-python
Dynamic: summary

Aito Python SDK
===============

:Info: Check `Github <https://github.com/AitoDotAI/aito-python-tools>`_ for the latest source code and `documentation <https://aito-python-sdk.readthedocs.io/en/latest/>`__ for more information.
:Maintainer: Aito <admin@aito.ai>

|PyPI| |PyPI version|

About
-----

The Aito Python SDK is an open-source library that helps you to integrate your Python application
to `Aito <https://aito.ai/>`_ quicker and more efficiently.

The SDK also includes the `Aito Command Line Interface (CLI) <https://aito-python-sdk.readthedocs.io/en/latest/cli.html>`_ 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.


Support / Feedback
------------------

For issues with, questions about, or feedback, please join our `support channels <https://aito.ai/join-slack/>`__.

Installation
------------

Aito Python SDK can be installed with `pip <http://pypi.python.org/pypi/pip>`_

  .. code-block:: console

    $ pip install aitoai

Check our `installation guide <https://aito-python-sdk.readthedocs.io/en/latest/install.html>`_ for more information

Documentation
-------------

You will need `sphinx <https://www.sphinx-doc.org/en/master/>`_ installed to generate the documentation.

    $ pip install sphinx
    $ pip install sphinx_rtd_theme

Documentation can be generated by:

  .. code-block:: console

    $ 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:

  .. code-block:: console

    $ pip install -r requirements/build.txt
    $ pip install -r requirements/test.txt

You can use our test cli to run tests:

  .. code-block:: console

    $ python -m tests -h

.. note::

  Some tests require some environment variables to be setup. Use the test CLI list command to discover and display the test suites and cases

There are multiple test suites:

1. CLI suite:

  .. code-block:: console

    $ python -m tests -v suite cli

  .. note::

    You need an Aito instance and set up the credentials with ```AITO_INSTANCE_URL``` and ```AITO_API_KEY``` to test some functions.

2. SDK suite:

  .. code-block:: console

    $ python -m tests -v suite sdk

  .. note::

    You need an Aito instance and set up the credentials with ```AITO_INSTANCE_URL``` and ```AITO_API_KEY``` to test some functions

3. SQL functions tests:

  - Test against Postgres:

    .. code-block:: console

        $ python -m tests -v case sql_functions.test_connection.TestPostgresConnection
        $ python -m tests -v case sql_functions.test_cli_sql_functions.TestPostgresFunctions

  - Test against MySQL:

    .. code-block:: console

      $ python -m tests -v case sql_functions.test_connection.TestMySQLConnection
      $ python -m tests -v case sql_functions.test_cli_sql_functions.TestMySQLFunctions

  .. note::

    To test the SQL functions, you need to install `pyodbc <https://pypi.org/project/pyodbc/>`_ and the specific database ODBC driver.

4. Build and test built package:

  - To build the package:

    .. code-block:: console

        $ pip install -r requirements/deploy.txt
        $ ./scripts/deploy test.pypi --no-publish -b dev

    WARNING: This will update the version in 'aito/__init__' file. DO NOT commit this to Git!

  - The built wheel should be at ```dist/```. To install:

    .. code-block:: console

        $ pip install dist/aitoai-<version>.whl

  - To test the built package, create an environment variable ```TEST_BUILT_PACKAGE``` and run the above tests

5. Test the documentation:

  - To test the inline documentation:

    .. code-block:: console

      $ python -m tests -v suite inline_docs

  - To test the code blocks in rst files:

    .. code-block:: console

      $ 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
------------

1. Making changes
2. 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
3. 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)

4. Add inline doc test if applicable (e.g: inline doc test for Aito Client: `tests/inline_docs/test_client_inline_docs.py`)

.. note::

  Remember to update the `autodoc_mock_imports` in conf.py file if there are additional requirements

5. Update the version in aito/__init__ to e.g. '1.2.3rc1' and write release notes in docs/changelog.rst
6. Check CircleCI and issue a PR
7. Deploy to production (scripts/deploy) with the appropriate version after the PR is reviewed


.. |PyPI| image:: https://img.shields.io/pypi/v/aitoai?style=plastic
  :target: https://pypi.org/project/aitoai/
.. |PyPI version| image:: https://img.shields.io/pypi/pyversions/aitoai?style=plastic
  :target: https://github.com/AitoDotAI/aito-python-tools
