Metadata-Version: 2.1
Name: jupysql-plugin
Version: 0.2.4
Summary: Jupyterlab extension for JupySQL
Project-URL: Homepage, https://github.com/ploomber/jupysql-plugin.git
Project-URL: Bug Tracker, https://github.com/ploomber/jupysql-plugin.git/issues
Project-URL: Repository, https://github.com/ploomber/jupysql-plugin.git.git
Author-email: Ploomber <contact@ploomber.io>
License: BSD 3-Clause License
        
        Copyright (c) 2023, Ploomber
        All rights reserved.
        
        Redistribution and use in source and binary forms, with or without
        modification, are permitted provided that the following conditions are met:
        
        1. Redistributions of source code must retain the above copyright notice, this
           list of conditions and the following disclaimer.
        
        2. Redistributions in binary form must reproduce the above copyright notice,
           this list of conditions and the following disclaimer in the documentation
           and/or other materials provided with the distribution.
        
        3. Neither the name of the copyright holder nor the names of its
           contributors may be used to endorse or promote products derived from
           this software without specific prior written permission.
        
        THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
        AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
        IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
        DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
        FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
        DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
        SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
        CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
        OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
        OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
License-File: LICENSE
Classifier: Framework :: Jupyter
Classifier: Framework :: Jupyter :: JupyterLab
Classifier: Framework :: Jupyter :: JupyterLab :: 3
Classifier: Framework :: Jupyter :: JupyterLab :: Extensions
Classifier: Framework :: Jupyter :: JupyterLab :: Extensions :: Prebuilt
Classifier: License :: OSI Approved :: BSD License
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.7
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Requires-Python: >=3.7
Requires-Dist: ploomber-core
Description-Content-Type: text/markdown

# jupysql-plugin
## Install

```bash
pip install jupysql-plugin
```

## Contributing

### Development install

```sh
conda create --name jupysql-plugin python=3.11 --channel conda-forge --yes
conda activate jupysql-plugin
conda install nodejs --channel conda-forge --yes
pip install -r requirements.txt
pip install -r requirements.dev.txt

jlpm install
```
Note: `pkgmt format` can be used to format and lint before committing code. 

```bash
# Note: this command will take some time the first time as it has to install
# and compile the frontend code
pip install -e "."

jupyter labextension develop . --overwrite
jupyter server extension enable jupysql_plugin

# NOTE: the two previous commands will fail if there are missing dependencies

# rebuild extension Typescript
# important: we had to set skipLibCheck: true
# https://discourse.jupyter.org/t/struggling-with-extensions-and-dependencies-versions/19550
jlpm build
```

To watch for changes and reload:

```bash
# in one terminal
jlpm watch

# another terminal
jupyter lab
```

Refresh JupyterLab to load the change in your browser.

By default, the `jlpm build` command generates the source maps for this extension to make it easier to debug using the browser dev tools. To also generate source maps for the JupyterLab core extensions, you can run the following command:

```bash
jupyter lab build --minimize=False
```

### adding dependencies

```bash
jlpm add PACKAGE

# example
jlpm add @jupyter-widgets/base
```

### Development uninstall

```bash
pip uninstall jupysql-plugin
```

In development mode, you will also need to remove the symlink created by `jupyter labextension develop`
command. To find its location, you can run `jupyter labextension list` to figure out where the `labextensions`
folder is located. Then you can remove the symlink named `jupysql-plugin` within that folder.

### Testing the extension

This extension is using [Jest](https://jestjs.io/) for JavaScript code testing.

This extension uses [Playwright](https://playwright.dev/docs/intro/) for the integration tests (aka user level tests).
More precisely, the JupyterLab helper [Galata](https://github.com/jupyterlab/jupyterlab/tree/master/galata) is used to handle testing the extension in JupyterLab. More information are provided within the [ui-tests](./ui-tests/README.md) README.

To run the tests:

```sh
pip install nox pyyaml

# note that this will also create a venv
nox --session test

# to only run the python unit tests
pytest tests
```

### Releasing the extension

See [RELEASE](RELEASE.md)

### Configuration

The `package.json` file contains a `jupyterlab` extension. More information about
this section is [here](https://github.com/jupyterlab/jupyterlab/blob/main/docs/source/extension/extension_dev.rst) (you might need to switch the git branch dependin on which version JupyterLab version you're building for). The schema is [here](https://github.com/jupyterlab/jupyterlab/blob/main/builder/metadata_schema.json).

### Ploomber Cloud API Endpoint

You can set the `PLOOMBER_CLOUD_HOST` variable to switch the API endpoint (by default, it's set to our production API endpoint).

```sh
export PLOOMBER_CLOUD_HOST=https://cloudapi-dev.ploomber.io
```