Skip to content

Commit

Permalink
perf: sync configurations with gotrue-py (#66)
Browse files Browse the repository at this point in the history
* fix: interpolations errors and other things reported by sourcery-ai

* perf: sync configurations with gotrue-py

* fix: warning of precommits rules
  • Loading branch information
leynier committed Jan 4, 2022
1 parent 031cb5f commit d5a97da
Show file tree
Hide file tree
Showing 27 changed files with 1,331 additions and 285 deletions.
21 changes: 21 additions & 0 deletions .devcontainer/Dockerfile
@@ -0,0 +1,21 @@
# See here for image contents: https://github.com/microsoft/vscode-dev-containers/tree/v0.203.0/containers/python-3/.devcontainer/base.Dockerfile

# [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
ARG VARIANT="3.10-bullseye"
FROM mcr.microsoft.com/vscode/devcontainers/python:0-${VARIANT}

# [Choice] Node.js version: none, lts/*, 16, 14, 12, 10
ARG NODE_VERSION="none"
RUN if [ "${NODE_VERSION}" != "none" ]; then su vscode -c "umask 0002 && . /usr/local/share/nvm/nvm.sh && nvm install ${NODE_VERSION} 2>&1"; fi

# [Optional] If your pip requirements rarely change, uncomment this section to add them to the image.
# COPY requirements.txt /tmp/pip-tmp/
# RUN pip3 --disable-pip-version-check --no-cache-dir install -r /tmp/pip-tmp/requirements.txt \
# && rm -rf /tmp/pip-tmp

# [Optional] Uncomment this section to install additional OS packages.
# RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \
# && apt-get -y install --no-install-recommends <your-package-list-here>

# [Optional] Uncomment this line to install global node packages.
# RUN su vscode -c "source /usr/local/share/nvm/nvm.sh && npm install -g <your-package-here>" 2>&1
81 changes: 81 additions & 0 deletions .devcontainer/devcontainer.json
@@ -0,0 +1,81 @@
// For format details, see https://aka.ms/devcontainer.json. For config options, see the README at:
// https://github.com/microsoft/vscode-dev-containers/tree/v0.203.0/containers/python-3
{
"name": "Python 3",
"runArgs": [
"--init"
],
"build": {
"dockerfile": "Dockerfile",
"context": "..",
"args": {
// Update 'VARIANT' to pick a Python version: 3, 3.10, 3.9, 3.8, 3.7, 3.6
// Append -bullseye or -buster to pin to an OS version.
// Use -bullseye variants on local on arm64/Apple Silicon.
"VARIANT": "3.10-bullseye",
// Options
"NODE_VERSION": "lts/*"
}
},
// Set *default* container specific settings.json values on container create.
"settings": {
"python.pythonPath": "/usr/local/bin/python",
"python.languageServer": "Pylance",
"python.linting.enabled": true,
"python.linting.flake8Enabled": true,
"python.formatting.autopep8Path": "/usr/local/py-utils/bin/autopep8",
"python.formatting.blackPath": "/usr/local/py-utils/bin/black",
"python.formatting.yapfPath": "/usr/local/py-utils/bin/yapf",
"python.linting.banditPath": "/usr/local/py-utils/bin/bandit",
"python.linting.flake8Path": "/usr/local/py-utils/bin/flake8",
"python.linting.mypyPath": "/usr/local/py-utils/bin/mypy",
"python.linting.pycodestylePath": "/usr/local/py-utils/bin/pycodestyle",
"python.linting.pydocstylePath": "/usr/local/py-utils/bin/pydocstyle",
"python.linting.pylintPath": "/usr/local/py-utils/bin/pylint",
"python.analysis.diagnosticMode": "workspace",
"files.exclude": {
"**/.ipynb_checkpoints": true,
"**/.pytest_cache": true,
"**/*pycache*": true
},
"python.formatting.provider": "black",
"python.linting.flake8Args": [
"--max-line-length=88",
"--extend-ignore=E203"
],
"editor.formatOnSave": true,
"editor.codeActionsOnSave": {
"source.organizeImports": true
},
"python.sortImports.args": [
"--multi-line=3",
"--trailing-comma",
"--force-grid-wrap=0",
"--use-parentheses",
"--line-width=88",
]
},
// Add the IDs of extensions you want installed when the container is created.
"extensions": [
"ms-python.python",
"ms-python.vscode-pylance",
"ms-azuretools.vscode-docker",
"donjayamanne.githistory",
"felipecaputo.git-project-manager",
"github.copilot-nightly",
"eamodio.gitlens",
"davidanson.vscode-markdownlint"
],
// Use 'forwardPorts' to make a list of ports inside the container available locally.
// "forwardPorts": [],
// Use 'postCreateCommand' to run commands after the container is created.
// "postCreateCommand": "pip3 install --user -r requirements.txt",
// Comment out connect as root instead. More info: https://aka.ms/vscode-remote/containers/non-root.
"remoteUser": "vscode",
"features": {
"docker-in-docker": "latest",
"git": "latest",
"git-lfs": "latest",
"github-cli": "latest"
}
}
12 changes: 4 additions & 8 deletions .github/dependabot.yml
@@ -1,11 +1,7 @@
# To get started with Dependabot version updates, you'll need to specify which
# package ecosystems to update and where the package manifests are located.
# Please see the documentation for all configuration options:
# https://help.github.com/github/administering-a-repository/configuration-options-for-dependency-updates

version: 2
updates:
- package-ecosystem: "pip" # See documentation for possible values
directory: "/" # Location of package manifests
- package-ecosystem: "pip"
directory: "/"
schedule:
interval: "monthly"
interval: "daily"
target-branch: "master"
43 changes: 0 additions & 43 deletions .github/workflows/ci-python.yml

This file was deleted.

45 changes: 45 additions & 0 deletions .github/workflows/ci.yml
@@ -0,0 +1,45 @@
name: CI/CD

on: [pull_request, push, workflow_dispatch]

jobs:
test:
name: Test / OS ${{ matrix.os }} / Python ${{ matrix.python-version }}
strategy:
matrix:
os: [ubuntu-latest]
python-version: [3.7, 3.8, 3.9, '3.10']
runs-on: ${{ matrix.os }}
steps:
- name: Clone Repository
uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Set up Poetry
uses: abatilo/actions-poetry@v2.1.4
with:
poetry-version: 1.1.12
- name: Run Tests
run: make run_tests
- name: Upload Coverage
uses: codecov/codecov-action@v1

publish:
needs: test
if: ${{ !startsWith(github.event.head_commit.message, 'bump') && !startsWith(github.event.head_commit.message, 'chore') && github.ref == 'refs/heads/master' && github.event_name == 'push' }}
runs-on: ubuntu-latest
name: "Bump version, create changelog and publish"
steps:
- name: Clone Repository
uses: actions/checkout@v2
with:
ref: ${{ github.ref }}
fetch-depth: 0
- name: Python Semantic Release
uses: relekang/python-semantic-release@master
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
repository_username: __token__
repository_password: ${{ secrets.PYPI_TOKEN }}
2 changes: 2 additions & 0 deletions CHANGELOG.md
@@ -1,5 +1,7 @@
# CHANGELOG

<!--next-version-placeholder-->

### v0.5.0

#### Features
Expand Down
24 changes: 12 additions & 12 deletions CODE_OF_CONDUCT.md
Expand Up @@ -14,21 +14,21 @@ appearance, race, religion, or sexual identity and orientation.
Examples of behavior that contributes to creating a positive environment
include:

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

Examples of unacceptable behavior by participants include:

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

## Our Responsibilities
Expand Down Expand Up @@ -68,9 +68,9 @@ members of the project's leadership.
## Attribution

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

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

For answers to common questions about this code of conduct, see
https://www.contributor-covenant.org/faq
<https://www.contributor-covenant.org/faq>
6 changes: 3 additions & 3 deletions CONTRIBUTING.md
Expand Up @@ -10,7 +10,7 @@ In the interest of fostering an open and welcoming environment, please review an

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

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

- 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.
- In your PR's description, link to any related issues or pull requests to give reviewers the full context of your change.
- For commit messages, follow the [Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0/) format.
- For commit messages, follow the [Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0) format.
- For example, if you update documentation for a specific extension, your commit message might be: `docs(extension-name) updated installation documentation`.
diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md
diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md
25 changes: 18 additions & 7 deletions Makefile
@@ -1,17 +1,28 @@
install: install_poetry
install:
poetry install

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

precommit: install
tests: install tests_only tests_pre_commit

tests_pre_commit:
poetry run pre-commit run --all-files

tests: install
tests_only:
poetry run pytest --cov=./ --cov-report=xml -vv

build: install
poetry run unasync postgrest_py tests
run_infra:
cd infra &&\
docker-compose down &&\
docker-compose up -d

clean_infra:
cd infra &&\
docker-compose down --remove-orphans &&\
docker system prune -a --volumes -f

clean:
sudo rm -r .venv
run_tests: tests

build_sync:
poetry run unasync postgrest_py tests
32 changes: 20 additions & 12 deletions README.md
@@ -1,9 +1,17 @@
[![](https://img.shields.io/github/license/supabase/postgrest-py)](https://github.com/supabase/postgrest-py)
[![](https://img.shields.io/pypi/pyversions/postgrest-py)](https://pypi.org/project/postgrest-py)
[![](https://img.shields.io/pypi/v/postgrest-py)](https://pypi.org/project/postgrest-py)

# postgrest-py

[![License: MIT](https://img.shields.io/badge/License-MIT-green.svg?label=license)](https://opensource.org/licenses/MIT)
[![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)
[![Python](https://img.shields.io/pypi/pyversions/postgrest-py)](https://pypi.org/project/postgrest-py)
[![Version](https://img.shields.io/pypi/v/postgrest-py?color=%2334D058)](https://pypi.org/project/postgrest-py)
[![Codecov](https://codecov.io/gh/supabase-community/postgrest-py/branch/main/graph/badge.svg)](https://codecov.io/gh/supabase-community/postgrest-py)
[![Last commit](https://img.shields.io/github/last-commit/supabase-community/postgrest-py.svg?style=flat)](https://github.com/supabase-community/postgrest-py/commits)
[![GitHub commit activity](https://img.shields.io/github/commit-activity/m/supabase-community/postgrest-py)](https://github.com/supabase-community/postgrest-py/commits)
[![Github Stars](https://img.shields.io/github/stars/supabase-community/postgrest-py?style=flat&logo=github)](https://github.com/supabase-community/postgrest-py/stargazers)
[![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)
[![Github Watchers](https://img.shields.io/github/watchers/supabase-community/postgrest-py?style=flat&logo=github)](https://github.com/supabase-community/postgrest-py)
[![GitHub contributors](https://img.shields.io/github/contributors/supabase-community/postgrest-py)](https://github.com/supabase-community/postgrest-py/graphs/contributors)

PostgREST client for Python. This library provides an ORM interface to PostgREST.

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

Once Docker Compose started, PostgREST is accessible at http://localhost:3000.
Once Docker Compose started, PostgREST is accessible at <http://localhost:3000>.

### Instructions

#### With Poetry (recommended)

```sh
$ poetry add postgrest-py
poetry add postgrest-py
```

#### With Pip

```sh
$ pip install postgrest-py
pip install postgrest-py
```

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

```sh
$ git clone https://github.com/supabase/postgrest-py.git
$ cd postgrest-py
$ poetry install
$ poetry run pre-commit install
git clone https://github.com/supabase/postgrest-py.git
cd postgrest-py
poetry install
poetry run pre-commit install
```

### Testing

```sh
$ poetry run pytest
poetry run pytest
```

## CHANGELOG
Expand Down
File renamed without changes.

0 comments on commit d5a97da

Please sign in to comment.