Skip to content

Commit 2897520

Browse files
Merge pull request #6 from sqlitecloud/github-workflow-testing-code-quality
GitHub workflow testing code quality
2 parents c77b991 + b392c49 commit 2897520

29 files changed

+596
-155
lines changed

.flake8

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
[flake8]
2+
# E203: it's a parse limit of flake8
3+
# W503,E501,E701: https://black.readthedocs.io/en/stable/guides/using_black_with_other_tools.html#w503
4+
ignore = E203, W503, E501, E701
5+
# align to black choice
6+
max-line-length = 88

.github/workflows/deploy.yaml

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,11 @@ name: Test and Release
55

66
on:
77
push:
8-
pull_request:
98
workflow_dispatch:
109

1110
jobs:
1211
tests:
13-
runs-on: ubuntu-latest
12+
runs-on: ubuntu-20.04
1413
strategy:
1514
fail-fast: false
1615
matrix:
@@ -32,16 +31,19 @@ jobs:
3231
isort --diff --check-only src
3332
- name: Tests
3433
env:
35-
SQLITE_CONNECTION_STRING: ${{ secrets.SQLITE_CONNECTION_STRING }}
34+
SQLITE_CONNECTION_STRING: ${{ vars.SQLITE_CONNECTION_STRING }}
3635
SQLITE_USER: ${{ secrets.SQLITE_USER }}
3736
SQLITE_PASSWORD: ${{ secrets.SQLITE_PASSWORD }}
3837
SQLITE_API_KEY: ${{ secrets.SQLITE_API_KEY }}
39-
SQLITE_HOST: ${{ secrets.SQLITE_HOST }}
40-
SQLITE_DB: ${{ secrets.SQLITE_DB }}
41-
SQLITE_PORT: ${{ secrets.SQLITE_PORT }}
38+
SQLITE_HOST: ${{ vars.SQLITE_HOST }}
39+
SQLITE_DB: ${{ vars.SQLITE_DB }}
40+
SQLITE_PORT: ${{ vars.SQLITE_PORT }}
4241
run: |
43-
pytest -v src/tests
44-
42+
pytest --cov -v src/tests
43+
- name: Upload coverage reports to Codecov
44+
uses: codecov/[email protected]
45+
with:
46+
token: ${{ secrets.CODECOV_TOKEN }}
4547
release:
4648
if: ${{ github.ref == 'refs/heads/main' }}
4749
needs: tests

.github/workflows/pypi-release.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,4 +38,4 @@ jobs:
3838
uses: pypa/gh-action-pypi-publish@release/v1
3939
with:
4040
packages-dir: src/dist/
41-
password: ${{ secrets.PYPI_API_TOKEN }}
41+
password: ${{ secrets.PYPI_API_TOKEN }}

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ main.dSYM/
77
.env
88
*.pyc
99
*.pyo
10+
.coverage
1011

1112
.DS_Store
1213

.pre-commit-config.yaml

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
#
2+
# Keep these versions requirements.txt versions aligned.
3+
#
4+
repos:
5+
- repo: https://github.com/pre-commit/pre-commit-hooks
6+
rev: v3.2.0
7+
hooks:
8+
- id: trailing-whitespace
9+
- id: end-of-file-fixer
10+
- id: detect-private-key
11+
- id: check-merge-conflict
12+
# Using this mirror lets us use mypyc-compiled black, which is about 2x faster
13+
- repo: https://github.com/psf/black-pre-commit-mirror
14+
rev: 22.8.0
15+
hooks:
16+
- id: black
17+
# It is recommended to specify the latest version of Python
18+
# supported by your project here, or alternatively use
19+
# pre-commit's default_language_version, see
20+
# https://pre-commit.com/#top_level-default_language_version
21+
language_version: python3.6
22+
- repo: https://github.com/pycqa/isort
23+
rev: 5.10.1
24+
hooks:
25+
- id: isort
26+
name: isort
27+
- repo: https://github.com/PyCQA/autoflake
28+
rev: v1.4
29+
hooks:
30+
- id: autoflake
31+
name: autoflake
32+
args:
33+
- "--in-place"
34+
- "--expand-star-imports"
35+
- "--remove-duplicate-keys"
36+
- "--remove-unused-variables"
37+
- "--remove-unused-variables"
38+
- repo: https://github.com/pycqa/flake8
39+
rev: 5.0.4
40+
hooks:
41+
- id: flake8
42+
name: flake8
43+
# stages: [push]
44+
- repo: https://github.com/PyCQA/bandit
45+
rev: 1.7.1
46+
hooks:
47+
- id: bandit
48+
name: bandit
49+
entry: bandit
50+
args:
51+
- "-b"
52+
- "bandit-baseline.json"
53+
- "--configfile"
54+
- "bandit.yaml"
55+
- "-r"
56+
- "src"

README.md

Lines changed: 27 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,28 @@
11
# Python SDK for SQLite Cloud
22

3-
![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)
3+
<p align="center">
4+
<img src="https://sqlitecloud.io/social/logo.png" height="300" alt="SQLite Cloud logo">
5+
</p>
46

5-
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.
7+
![Build Status](https://github.com/sqlitecloud/python/actions/workflows/deploy.yaml/badge.svg "Build Status")
8+
[![codecov](https://codecov.io/github/sqlitecloud/python/graph/badge.svg?token=38G6FGOWKP)](https://codecov.io/github/sqlitecloud/python)
9+
![PyPI - Version](https://img.shields.io/pypi/v/sqlitecloud?link=https%3A%2F%2Fpypi.org%2Fproject%2FSqliteCloud%2F)
10+
![PyPI - Downloads](https://img.shields.io/pypi/dm/sqlitecloud?link=https%3A%2F%2Fpypi.org%2Fproject%2FSqliteCloud%2F)
11+
![PyPI - Python Version](https://img.shields.io/pypi/pyversions/sqlitecloud?link=https%3A%2F%2Fpypi.org%2Fproject%2FSqliteCloud%2F)
612

713

14+
[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.
15+
16+
- Site: [https://sqlitecloud.io](https://sqlitecloud.io/developers)
17+
- Documentation: https://..._coming!_
18+
- Source: [https://github.com/sqlitecloud/python](https://github.com/sqlitecloud/python)
19+
820
## Installation
921

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

1224
```bash
13-
$ pip install SqliteCloud
25+
$ pip install sqlitecloud
1426
```
1527

1628
## Usage
@@ -34,7 +46,7 @@ conn = client.open_connection()
3446
#### _Using string configuration_
3547

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

70+
### _Specific value_
71+
```python
72+
result.get_value(0, 0)
73+
```
74+
75+
### _Column name_
76+
```python
77+
result.get_name(0)
78+
```
79+
5880
### _Close connection_
5981

60-
```python
82+
```python
6183
client.disconnect(conn)
6284
```

0 commit comments

Comments
 (0)