Skip to content

Commit

Permalink
Merge pull request #6 from sqlitecloud/github-workflow-testing-code-q…
Browse files Browse the repository at this point in the history
…uality

GitHub workflow testing code quality
  • Loading branch information
danielebriggi authored May 24, 2024
2 parents c77b991 + b392c49 commit 2897520
Show file tree
Hide file tree
Showing 29 changed files with 596 additions and 155 deletions.
6 changes: 6 additions & 0 deletions .flake8
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[flake8]
# E203: it's a parse limit of flake8
# W503,E501,E701: https://black.readthedocs.io/en/stable/guides/using_black_with_other_tools.html#w503
ignore = E203, W503, E501, E701
# align to black choice
max-line-length = 88
18 changes: 10 additions & 8 deletions .github/workflows/deploy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,11 @@ name: Test and Release

on:
push:
pull_request:
workflow_dispatch:

jobs:
tests:
runs-on: ubuntu-latest
runs-on: ubuntu-20.04
strategy:
fail-fast: false
matrix:
Expand All @@ -32,16 +31,19 @@ jobs:
isort --diff --check-only src
- name: Tests
env:
SQLITE_CONNECTION_STRING: ${{ secrets.SQLITE_CONNECTION_STRING }}
SQLITE_CONNECTION_STRING: ${{ vars.SQLITE_CONNECTION_STRING }}
SQLITE_USER: ${{ secrets.SQLITE_USER }}
SQLITE_PASSWORD: ${{ secrets.SQLITE_PASSWORD }}
SQLITE_API_KEY: ${{ secrets.SQLITE_API_KEY }}
SQLITE_HOST: ${{ secrets.SQLITE_HOST }}
SQLITE_DB: ${{ secrets.SQLITE_DB }}
SQLITE_PORT: ${{ secrets.SQLITE_PORT }}
SQLITE_HOST: ${{ vars.SQLITE_HOST }}
SQLITE_DB: ${{ vars.SQLITE_DB }}
SQLITE_PORT: ${{ vars.SQLITE_PORT }}
run: |
pytest -v src/tests
pytest --cov -v src/tests
- name: Upload coverage reports to Codecov
uses: codecov/[email protected]
with:
token: ${{ secrets.CODECOV_TOKEN }}
release:
if: ${{ github.ref == 'refs/heads/main' }}
needs: tests
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/pypi-release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,4 @@ jobs:
uses: pypa/gh-action-pypi-publish@release/v1
with:
packages-dir: src/dist/
password: ${{ secrets.PYPI_API_TOKEN }}
password: ${{ secrets.PYPI_API_TOKEN }}
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ main.dSYM/
.env
*.pyc
*.pyo
.coverage

.DS_Store

Expand Down
56 changes: 56 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
#
# Keep these versions requirements.txt versions aligned.
#
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v3.2.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: detect-private-key
- id: check-merge-conflict
# Using this mirror lets us use mypyc-compiled black, which is about 2x faster
- repo: https://github.com/psf/black-pre-commit-mirror
rev: 22.8.0
hooks:
- id: black
# It is recommended to specify the latest version of Python
# supported by your project here, or alternatively use
# pre-commit's default_language_version, see
# https://pre-commit.com/#top_level-default_language_version
language_version: python3.6
- repo: https://github.com/pycqa/isort
rev: 5.10.1
hooks:
- id: isort
name: isort
- repo: https://github.com/PyCQA/autoflake
rev: v1.4
hooks:
- id: autoflake
name: autoflake
args:
- "--in-place"
- "--expand-star-imports"
- "--remove-duplicate-keys"
- "--remove-unused-variables"
- "--remove-unused-variables"
- repo: https://github.com/pycqa/flake8
rev: 5.0.4
hooks:
- id: flake8
name: flake8
# stages: [push]
- repo: https://github.com/PyCQA/bandit
rev: 1.7.1
hooks:
- id: bandit
name: bandit
entry: bandit
args:
- "-b"
- "bandit-baseline.json"
- "--configfile"
- "bandit.yaml"
- "-r"
- "src"
32 changes: 27 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,16 +1,28 @@
# Python SDK for SQLite Cloud

![Build Status](https://github.com/sqlitecloud/python/actions/workflows/deploy.yaml/badge.svg "Build Status") ![Jupyter Notebook](https://img.shields.io/badge/jupyter-%23FA0F00.svg?style=plastic&logo=jupyter&logoColor=white)
<p align="center">
<img src="https://sqlitecloud.io/social/logo.png" height="300" alt="SQLite Cloud logo">
</p>

SQLiteCloud is a powerful Python package that allows you to interact with the SQLite Cloud backend server seamlessly. It provides methods for various database operations. This package is designed to simplify database operations in Python applications, making it easier than ever to work with SQLite Cloud.
![Build Status](https://github.com/sqlitecloud/python/actions/workflows/deploy.yaml/badge.svg "Build Status")
[![codecov](https://codecov.io/github/sqlitecloud/python/graph/badge.svg?token=38G6FGOWKP)](https://codecov.io/github/sqlitecloud/python)
![PyPI - Version](https://img.shields.io/pypi/v/sqlitecloud?link=https%3A%2F%2Fpypi.org%2Fproject%2FSqliteCloud%2F)
![PyPI - Downloads](https://img.shields.io/pypi/dm/sqlitecloud?link=https%3A%2F%2Fpypi.org%2Fproject%2FSqliteCloud%2F)
![PyPI - Python Version](https://img.shields.io/pypi/pyversions/sqlitecloud?link=https%3A%2F%2Fpypi.org%2Fproject%2FSqliteCloud%2F)


[SQLiteCloud](https://sqlitecloud.io) is a powerful Python package that allows you to interact with the SQLite Cloud backend server seamlessly. It provides methods for various database operations. This package is designed to simplify database operations in Python applications, making it easier than ever to work with SQLite Cloud.

- Site: [https://sqlitecloud.io](https://sqlitecloud.io/developers)
- Documentation: https://..._coming!_
- Source: [https://github.com/sqlitecloud/python](https://github.com/sqlitecloud/python)

## Installation

You can install SqliteCloud Package using Python Package Index (PYPI):

```bash
$ pip install SqliteCloud
$ pip install sqlitecloud
```

## Usage
Expand All @@ -34,7 +46,7 @@ conn = client.open_connection()
#### _Using string configuration_

```python
account = SqliteCloudAccount("sqlitecloud://user:[email protected]:port/dbname?timeout=10&key2=value2&key3=value3")
account = SqliteCloudAccount("sqlitecloud://user:[email protected]:port/dbname?apikey=myapikey")
client = SqliteCloudClient(cloud_account=account)
conn = client.open_connection()
```
Expand All @@ -55,8 +67,18 @@ for row in result:
print(row)
```

### _Specific value_
```python
result.get_value(0, 0)
```

### _Column name_
```python
result.get_name(0)
```

### _Close connection_

```python
```python
client.disconnect(conn)
```
Loading

0 comments on commit 2897520

Please sign in to comment.