Skip to content

Commit d5a97da

Browse files
authored
perf: sync configurations with gotrue-py (#66)
* fix: interpolations errors and other things reported by sourcery-ai * perf: sync configurations with gotrue-py * fix: warning of precommits rules
1 parent 031cb5f commit d5a97da

27 files changed

+1331
-285
lines changed

.devcontainer/Dockerfile

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# See here for image contents: https://github.com/microsoft/vscode-dev-containers/tree/v0.203.0/containers/python-3/.devcontainer/base.Dockerfile
2+
3+
# [Choice] Python version (use -bullseye variants on local arm64/Apple Silicon): 3, 3.10, 3.9, 3.8, 3.7, 3.6, 3-bullseye, 3.10-bullseye, 3.9-bullseye, 3.8-bullseye, 3.7-bullseye, 3.6-bullseye, 3-buster, 3.10-buster, 3.9-buster, 3.8-buster, 3.7-buster, 3.6-buster
4+
ARG VARIANT="3.10-bullseye"
5+
FROM mcr.microsoft.com/vscode/devcontainers/python:0-${VARIANT}
6+
7+
# [Choice] Node.js version: none, lts/*, 16, 14, 12, 10
8+
ARG NODE_VERSION="none"
9+
RUN if [ "${NODE_VERSION}" != "none" ]; then su vscode -c "umask 0002 && . /usr/local/share/nvm/nvm.sh && nvm install ${NODE_VERSION} 2>&1"; fi
10+
11+
# [Optional] If your pip requirements rarely change, uncomment this section to add them to the image.
12+
# COPY requirements.txt /tmp/pip-tmp/
13+
# RUN pip3 --disable-pip-version-check --no-cache-dir install -r /tmp/pip-tmp/requirements.txt \
14+
# && rm -rf /tmp/pip-tmp
15+
16+
# [Optional] Uncomment this section to install additional OS packages.
17+
# RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \
18+
# && apt-get -y install --no-install-recommends <your-package-list-here>
19+
20+
# [Optional] Uncomment this line to install global node packages.
21+
# RUN su vscode -c "source /usr/local/share/nvm/nvm.sh && npm install -g <your-package-here>" 2>&1

.devcontainer/devcontainer.json

+81
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
// For format details, see https://aka.ms/devcontainer.json. For config options, see the README at:
2+
// https://github.com/microsoft/vscode-dev-containers/tree/v0.203.0/containers/python-3
3+
{
4+
"name": "Python 3",
5+
"runArgs": [
6+
"--init"
7+
],
8+
"build": {
9+
"dockerfile": "Dockerfile",
10+
"context": "..",
11+
"args": {
12+
// Update 'VARIANT' to pick a Python version: 3, 3.10, 3.9, 3.8, 3.7, 3.6
13+
// Append -bullseye or -buster to pin to an OS version.
14+
// Use -bullseye variants on local on arm64/Apple Silicon.
15+
"VARIANT": "3.10-bullseye",
16+
// Options
17+
"NODE_VERSION": "lts/*"
18+
}
19+
},
20+
// Set *default* container specific settings.json values on container create.
21+
"settings": {
22+
"python.pythonPath": "/usr/local/bin/python",
23+
"python.languageServer": "Pylance",
24+
"python.linting.enabled": true,
25+
"python.linting.flake8Enabled": true,
26+
"python.formatting.autopep8Path": "/usr/local/py-utils/bin/autopep8",
27+
"python.formatting.blackPath": "/usr/local/py-utils/bin/black",
28+
"python.formatting.yapfPath": "/usr/local/py-utils/bin/yapf",
29+
"python.linting.banditPath": "/usr/local/py-utils/bin/bandit",
30+
"python.linting.flake8Path": "/usr/local/py-utils/bin/flake8",
31+
"python.linting.mypyPath": "/usr/local/py-utils/bin/mypy",
32+
"python.linting.pycodestylePath": "/usr/local/py-utils/bin/pycodestyle",
33+
"python.linting.pydocstylePath": "/usr/local/py-utils/bin/pydocstyle",
34+
"python.linting.pylintPath": "/usr/local/py-utils/bin/pylint",
35+
"python.analysis.diagnosticMode": "workspace",
36+
"files.exclude": {
37+
"**/.ipynb_checkpoints": true,
38+
"**/.pytest_cache": true,
39+
"**/*pycache*": true
40+
},
41+
"python.formatting.provider": "black",
42+
"python.linting.flake8Args": [
43+
"--max-line-length=88",
44+
"--extend-ignore=E203"
45+
],
46+
"editor.formatOnSave": true,
47+
"editor.codeActionsOnSave": {
48+
"source.organizeImports": true
49+
},
50+
"python.sortImports.args": [
51+
"--multi-line=3",
52+
"--trailing-comma",
53+
"--force-grid-wrap=0",
54+
"--use-parentheses",
55+
"--line-width=88",
56+
]
57+
},
58+
// Add the IDs of extensions you want installed when the container is created.
59+
"extensions": [
60+
"ms-python.python",
61+
"ms-python.vscode-pylance",
62+
"ms-azuretools.vscode-docker",
63+
"donjayamanne.githistory",
64+
"felipecaputo.git-project-manager",
65+
"github.copilot-nightly",
66+
"eamodio.gitlens",
67+
"davidanson.vscode-markdownlint"
68+
],
69+
// Use 'forwardPorts' to make a list of ports inside the container available locally.
70+
// "forwardPorts": [],
71+
// Use 'postCreateCommand' to run commands after the container is created.
72+
// "postCreateCommand": "pip3 install --user -r requirements.txt",
73+
// Comment out connect as root instead. More info: https://aka.ms/vscode-remote/containers/non-root.
74+
"remoteUser": "vscode",
75+
"features": {
76+
"docker-in-docker": "latest",
77+
"git": "latest",
78+
"git-lfs": "latest",
79+
"github-cli": "latest"
80+
}
81+
}

.github/dependabot.yml

+4-8
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,7 @@
1-
# To get started with Dependabot version updates, you'll need to specify which
2-
# package ecosystems to update and where the package manifests are located.
3-
# Please see the documentation for all configuration options:
4-
# https://help.github.com/github/administering-a-repository/configuration-options-for-dependency-updates
5-
61
version: 2
72
updates:
8-
- package-ecosystem: "pip" # See documentation for possible values
9-
directory: "/" # Location of package manifests
3+
- package-ecosystem: "pip"
4+
directory: "/"
105
schedule:
11-
interval: "monthly"
6+
interval: "daily"
7+
target-branch: "master"

.github/workflows/ci-python.yml

-43
This file was deleted.

.github/workflows/ci.yml

+45
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
name: CI/CD
2+
3+
on: [pull_request, push, workflow_dispatch]
4+
5+
jobs:
6+
test:
7+
name: Test / OS ${{ matrix.os }} / Python ${{ matrix.python-version }}
8+
strategy:
9+
matrix:
10+
os: [ubuntu-latest]
11+
python-version: [3.7, 3.8, 3.9, '3.10']
12+
runs-on: ${{ matrix.os }}
13+
steps:
14+
- name: Clone Repository
15+
uses: actions/checkout@v2
16+
- name: Set up Python ${{ matrix.python-version }}
17+
uses: actions/setup-python@v2
18+
with:
19+
python-version: ${{ matrix.python-version }}
20+
- name: Set up Poetry
21+
uses: abatilo/[email protected]
22+
with:
23+
poetry-version: 1.1.12
24+
- name: Run Tests
25+
run: make run_tests
26+
- name: Upload Coverage
27+
uses: codecov/codecov-action@v1
28+
29+
publish:
30+
needs: test
31+
if: ${{ !startsWith(github.event.head_commit.message, 'bump') && !startsWith(github.event.head_commit.message, 'chore') && github.ref == 'refs/heads/master' && github.event_name == 'push' }}
32+
runs-on: ubuntu-latest
33+
name: "Bump version, create changelog and publish"
34+
steps:
35+
- name: Clone Repository
36+
uses: actions/checkout@v2
37+
with:
38+
ref: ${{ github.ref }}
39+
fetch-depth: 0
40+
- name: Python Semantic Release
41+
uses: relekang/python-semantic-release@master
42+
with:
43+
github_token: ${{ secrets.GITHUB_TOKEN }}
44+
repository_username: __token__
45+
repository_password: ${{ secrets.PYPI_TOKEN }}

CHANGELOG.md

+2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
# CHANGELOG
22

3+
<!--next-version-placeholder-->
4+
35
### v0.5.0
46

57
#### Features

CODE_OF_CONDUCT.md

+12-12
Original file line numberDiff line numberDiff line change
@@ -14,21 +14,21 @@ appearance, race, religion, or sexual identity and orientation.
1414
Examples of behavior that contributes to creating a positive environment
1515
include:
1616

17-
- Using welcoming and inclusive language
18-
- Being respectful of differing viewpoints and experiences
19-
- Gracefully accepting constructive criticism
20-
- Focusing on what is best for the community
21-
- Showing empathy towards other community members
17+
* Using welcoming and inclusive language
18+
* Being respectful of differing viewpoints and experiences
19+
* Gracefully accepting constructive criticism
20+
* Focusing on what is best for the community
21+
* Showing empathy towards other community members
2222

2323
Examples of unacceptable behavior by participants include:
2424

25-
- The use of sexualized language or imagery and unwelcome sexual attention or
25+
* The use of sexualized language or imagery and unwelcome sexual attention or
2626
advances
27-
- Trolling, insulting/derogatory comments, and personal or political attacks
28-
- Public or private harassment
29-
- Publishing others' private information, such as a physical or electronic
27+
* Trolling, insulting/derogatory comments, and personal or political attacks
28+
* Public or private harassment
29+
* Publishing others' private information, such as a physical or electronic
3030
address, without explicit permission
31-
- Other conduct which could reasonably be considered inappropriate in a
31+
* Other conduct which could reasonably be considered inappropriate in a
3232
professional setting
3333

3434
## Our Responsibilities
@@ -68,9 +68,9 @@ members of the project's leadership.
6868
## Attribution
6969

7070
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
71-
available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html
71+
available at <https://www.contributor-covenant.org/version/1/4/code-of-conduct.html>
7272

7373
[homepage]: https://www.contributor-covenant.org
7474

7575
For answers to common questions about this code of conduct, see
76-
https://www.contributor-covenant.org/faq
76+
<https://www.contributor-covenant.org/faq>

CONTRIBUTING.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ In the interest of fostering an open and welcoming environment, please review an
1010

1111
All submissions, including submissions by project members, require review. We
1212
use GitHub pull requests for this purpose. Consult
13-
[GitHub Help](https://help.github.com/articles/about-pull-requests/) for more
13+
[GitHub Help](https://help.github.com/articles/about-pull-requests) for more
1414
information on using pull requests.
1515

1616
## Report an issue
@@ -27,6 +27,6 @@ When making pull requests to the repository, make sure to follow these guideline
2727

2828
- Before creating a pull request, file a GitHub Issue so that maintainers and the community can discuss the problem and potential solutions before you spend time on an implementation.
2929
- In your PR's description, link to any related issues or pull requests to give reviewers the full context of your change.
30-
- For commit messages, follow the [Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0/) format.
30+
- For commit messages, follow the [Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0) format.
3131
- For example, if you update documentation for a specific extension, your commit message might be: `docs(extension-name) updated installation documentation`.
32-
diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md
32+
diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md

Makefile

+18-7
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,28 @@
1-
install: install_poetry
1+
install:
22
poetry install
33

44
install_poetry:
55
curl -sSL https://install.python-poetry.org | python -
66

7-
precommit: install
7+
tests: install tests_only tests_pre_commit
8+
9+
tests_pre_commit:
810
poetry run pre-commit run --all-files
911

10-
tests: install
12+
tests_only:
1113
poetry run pytest --cov=./ --cov-report=xml -vv
1214

13-
build: install
14-
poetry run unasync postgrest_py tests
15+
run_infra:
16+
cd infra &&\
17+
docker-compose down &&\
18+
docker-compose up -d
19+
20+
clean_infra:
21+
cd infra &&\
22+
docker-compose down --remove-orphans &&\
23+
docker system prune -a --volumes -f
1524

16-
clean:
17-
sudo rm -r .venv
25+
run_tests: tests
26+
27+
build_sync:
28+
poetry run unasync postgrest_py tests

README.md

+20-12
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,17 @@
1-
[![](https://img.shields.io/github/license/supabase/postgrest-py)](https://github.com/supabase/postgrest-py)
2-
[![](https://img.shields.io/pypi/pyversions/postgrest-py)](https://pypi.org/project/postgrest-py)
3-
[![](https://img.shields.io/pypi/v/postgrest-py)](https://pypi.org/project/postgrest-py)
4-
51
# postgrest-py
62

3+
[![License: MIT](https://img.shields.io/badge/License-MIT-green.svg?label=license)](https://opensource.org/licenses/MIT)
4+
[![CI](https://github.com/supabase-community/postgrest-py/actions/workflows/ci.yml/badge.svg)](https://github.com/supabase-community/postgrest-py/actions/workflows/ci.yml)
5+
[![Python](https://img.shields.io/pypi/pyversions/postgrest-py)](https://pypi.org/project/postgrest-py)
6+
[![Version](https://img.shields.io/pypi/v/postgrest-py?color=%2334D058)](https://pypi.org/project/postgrest-py)
7+
[![Codecov](https://codecov.io/gh/supabase-community/postgrest-py/branch/main/graph/badge.svg)](https://codecov.io/gh/supabase-community/postgrest-py)
8+
[![Last commit](https://img.shields.io/github/last-commit/supabase-community/postgrest-py.svg?style=flat)](https://github.com/supabase-community/postgrest-py/commits)
9+
[![GitHub commit activity](https://img.shields.io/github/commit-activity/m/supabase-community/postgrest-py)](https://github.com/supabase-community/postgrest-py/commits)
10+
[![Github Stars](https://img.shields.io/github/stars/supabase-community/postgrest-py?style=flat&logo=github)](https://github.com/supabase-community/postgrest-py/stargazers)
11+
[![Github Forks](https://img.shields.io/github/forks/supabase-community/postgrest-py?style=flat&logo=github)](https://github.com/supabase-community/postgrest-py/network/members)
12+
[![Github Watchers](https://img.shields.io/github/watchers/supabase-community/postgrest-py?style=flat&logo=github)](https://github.com/supabase-community/postgrest-py)
13+
[![GitHub contributors](https://img.shields.io/github/contributors/supabase-community/postgrest-py)](https://github.com/supabase-community/postgrest-py/graphs/contributors)
14+
715
PostgREST client for Python. This library provides an ORM interface to PostgREST.
816

917
Status: **Unstable**
@@ -24,20 +32,20 @@ If you want to use a local PostgREST server for development, you can use our pre
2432
docker-compose up
2533
```
2634

27-
Once Docker Compose started, PostgREST is accessible at http://localhost:3000.
35+
Once Docker Compose started, PostgREST is accessible at <http://localhost:3000>.
2836

2937
### Instructions
3038

3139
#### With Poetry (recommended)
3240

3341
```sh
34-
$ poetry add postgrest-py
42+
poetry add postgrest-py
3543
```
3644

3745
#### With Pip
3846

3947
```sh
40-
$ pip install postgrest-py
48+
pip install postgrest-py
4149
```
4250

4351
## USAGE
@@ -88,16 +96,16 @@ await client.from_("countries").eq("name", "Việt Nam").delete().execute()
8896
## DEVELOPMENT
8997

9098
```sh
91-
$ git clone https://github.com/supabase/postgrest-py.git
92-
$ cd postgrest-py
93-
$ poetry install
94-
$ poetry run pre-commit install
99+
git clone https://github.com/supabase/postgrest-py.git
100+
cd postgrest-py
101+
poetry install
102+
poetry run pre-commit install
95103
```
96104

97105
### Testing
98106

99107
```sh
100-
$ poetry run pytest
108+
poetry run pytest
101109
```
102110

103111
## CHANGELOG
File renamed without changes.

0 commit comments

Comments
 (0)