Metadata-Version: 2.1
Name: squirrels
Version: 0.3.2
Summary: Squirrels - API Framework for Data Analytics
Home-page: https://squirrels-analytics.github.io
License: Apache-2.0
Author: Tim Huang
Author-email: tim.yuting@hotmail.com
Requires-Python: >=3.9,<4.0
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: Apache Software License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Topic :: Software Development :: Libraries :: Application Frameworks
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Classifier: Typing :: Typed
Provides-Extra: duckdb
Requires-Dist: cachetools (>=5.3.2,<6.0.0)
Requires-Dist: duckdb-engine (>=0.13.0,<1.0.0) ; extra == "duckdb"
Requires-Dist: fastapi (>=0.110.1,<1.0.0)
Requires-Dist: gitpython (>=3.1.41,<4.0.0)
Requires-Dist: inquirer (>=3.2.1,<4.0.0)
Requires-Dist: jinja2 (>=3.1.3,<4.0.0)
Requires-Dist: matplotlib (>=3.8.3,<4.0.0)
Requires-Dist: networkx (>=3.2.1,<4.0.0)
Requires-Dist: pandas (>=2.1.4,<3.0.0)
Requires-Dist: pyjwt (>=2.8.0,<3.0.0)
Requires-Dist: pyyaml (>=6.0.1,<7.0.0)
Requires-Dist: sqlalchemy (>=2.0.25,<3.0.0)
Requires-Dist: uvicorn (>=0.29.0,<1.0.0)
Project-URL: Documentation, https://squirrels-analytics.github.io
Project-URL: Repository, https://github.com/squirrels-analytics/squirrels
Description-Content-Type: text/markdown

# Squirrels

Squirrels is an API framework that lets you create REST APIs for dynamic data analytics!

**Documentation**: <a href="https://squirrels-analytics.github.io/" target="_blank">https://squirrels-analytics.github.io/</a>

**Source Code**: <a href="https://github.com/squirrels-analytics/squirrels" target="_blank">https://github.com/squirrels-analytics/squirrels</a>

## Table of Contents

- [Main Features](#main-features)
- [License](#license)
- [Contributing to squirrels](#contributing-to-squirrels)
    - [Setup](#setup)
    - [Testing](#testing)
    - [Project Structure](#project-structure)

## Main Features

Here are a few of the things that squirrels can do:

- Connect to any database by specifying its SQLAlchemy url (in `squirrels.yml`) or by using its native connector library in python (in `connections.py`).
- Configure API routes for datasets (in `squirrels.yml`) without writing code.
- Configure parameter widgets (types include single-select, multi-select, date, number, etc.) for your datasets (in `parameters.py`).
- Use Jinja SQL templates (just like dbt!) or python functions (that return a pandas dataframe) to define dynamic query logic based on parameter selections.
- Query multiple databases and join the results together in a final view in one API endpoint/dataset!
- Test your API endpoints with an interactive UI or by a command line that generates rendered sql queries and results (for a given set of parameter selections).
- Define authentication logic (in `auth.py`) and authorize privacy scope per dataset (in `squirrels.yml`). The user's attributes can even be used in your query logic!

## License

Squirrels is released under the Apache 2.0 license.

See the file LICENSE for more details.

## Contributing to squirrels

The sections below describe how to set up your local environment for squirrels development and run unit tests. A high level overview of the project structure is also provided.

### Setup

This project requires python version 3.9 or above to be installed. It also uses the python build tool `poetry` which can be installed as follows.

**Linux, MacOS, Windows (WSL):**

```bash
curl -sSL https://install.python-poetry.org | python3 -
```

**Windows (Powershell):**

```bash
(Invoke-WebRequest -Uri https://install.python-poetry.org -UseBasicParsing).Content | py -
```

Then, to install all dependencies, run:

```
poetry install
```

And activate the virtual environment created by poetry with:

```
poetry shell
```

To confirm that the setup worked, run the following to show the help page for all squirrels CLI commands:

```bash
squirrels -h
```

You can enter `exit` to exit the virtual environment shell. You can also run `poetry run squirrels -h` to run squirrels commands without activating the virtual environment.

### Testing

In poetry's virtual environment, run `pytest`.

### Project Structure

From the root of the git repo, the source code can be found in the `squirrels` folder and unit tests can be found in the `tests` folder.

To understand what a specific squirrels command is doing, start from the `_command_line.py` file as your entry point.

The library version is maintained in both the `pyproject.toml` and the `squirrels/__init__.py` files.

When a user initializes a squirrels project using `squirrels init`, the files are copied from the `squirrels/package_data/base_project` folder. The contents in the `database` subfolder were constructed from the scripts in the `database_elt` folder.

For the Squirrels UI activated by `squirrels run`, the HTML, CSS, and Javascript files can be found in the `static` and `templates` subfolders of `squirrels/package_data`.

