Metadata-Version: 2.1
Name: civis-jupyter-extensions
Version: 1.2.0
Summary: Tools for using Civis Platform with Jupyter notebooks
Author-email: Civis Analytics <opensource@civisanalytics.com>
License: BSD-3-Clause
Project-URL: Homepage, https://www.civisanalytics.com
Project-URL: Source, https://github.com/civisanalytics/civis-jupyter-extensions
Classifier: Development Status :: 5 - Production/Stable
Classifier: License :: OSI Approved :: BSD License
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3 :: Only
Requires-Python: >=3.9
Description-Content-Type: text/x-rst
License-File: LICENSE.txt
Requires-Dist: civis
Requires-Dist: ipython>=5.4
Requires-Dist: pandas
Provides-Extra: dev
Requires-Dist: bandit; extra == "dev"
Requires-Dist: black==24.4.2; extra == "dev"
Requires-Dist: build==1.2.1; extra == "dev"
Requires-Dist: flake8==7.0.0; extra == "dev"
Requires-Dist: pip-audit; extra == "dev"
Requires-Dist: pytest==8.2.2; extra == "dev"
Requires-Dist: twine==5.1.0; extra == "dev"

civis-jupyter-extensions
========================

.. image:: https://circleci.com/gh/civisanalytics/civis-jupyter-extensions.svg?style=shield
   :target: https://circleci.com/gh/civisanalytics/civis-jupyter-extensions
   :alt: CircleCI build status

.. image:: https://img.shields.io/pypi/v/civis-jupyter-extensions.svg
   :target: https://pypi.org/project/civis-jupyter-extensions/
   :alt: Latest version on PyPI

Tools for using the Civis Platform with Jupyter notebooks

Installation and Setup
----------------------

Run the following commands in a shell::

    pip install civis-jupyter-extensions
    jupyter nbextension install --py civis_jupyter_ext
    jupyter nbextension enable --py civis_jupyter_ext

In order to use the extensions, make sure to have your Civis Platform API key in
your local environment as `CIVIS_API_KEY`.

Magic Commands
--------------

To load the magic commands, use the following in ipython or a
Jupyter notebook::

    %load_ext civis_jupyter_ext

You can also autoload the magic commands every time a notebook is opened by
adding::

    c.InteractiveShellApp.extensions = ['civis_jupyter_ext']

to your ``~/.ipython/profile_default/ipython_config.py``.

SQL Queries
~~~~~~~~~~~

To get a table preview, use the cell magic like this::

    %%civisquery my-database
    select * from dummy.table limit 10;

To return a DataFrame for further processing, use the line magic like this::

    df = %civisquery my-database; select * from dummy.table;
