Skip to content

Commit

Permalink
refactor!: port the driver to Python 3
Browse files Browse the repository at this point in the history
This commit brings a major refactoring that affects every piece of the
driver, mostly, in a backward-incompatible way.

For the extensive list of changes, please refer to the CHANGELOG.rst.

Co-authored-by: lsabi <[email protected]>
Signed-off-by: Gabor Boros <[email protected]>
  • Loading branch information
gabor-boros and lsabi committed Jun 21, 2022
1 parent bc1a75a commit 4154f76
Show file tree
Hide file tree
Showing 108 changed files with 10,730 additions and 11,890 deletions.
2 changes: 0 additions & 2 deletions .bandit

This file was deleted.

20 changes: 9 additions & 11 deletions .coveragerc
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
[run]
include = rethinkdb/*
source = rethinkdb
branch = True
omit = *tests*
*__init__*
rethinkdb/ql2_pb2.py

[report]
exclude_lines =
pragma: no cover

def __unicode__
def __repr__

omit =
rethinkdb/version.py

show_missing = True
sort = cover
fail_under = 72
exclude_lines = pragma: no cover
if __name__ == .__main__.:
1 change: 1 addition & 0 deletions .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
---
# These are supported funding model platforms

github: # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2]
Expand Down
7 changes: 7 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,21 @@
**Reason for the change**

If applicable, link the related issue/bug report or write down in few sentences the motivation.

**Description**

A clear and concise description of what did you changed and why.

**Code examples**

If applicable, add code examples to help explain your changes.

**Checklist**

- [ ] Unit tests created/updated
- [ ] Documentation extended/updated
- [ ] I have read and agreed to the [RethinkDB Contributor License Agreement](http://rethinkdb.com/community/cla/)

**References**

Anything else related to the change e.g. documentations, RFCs, etc.
7 changes: 7 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
version: 2
updates:
- package-ecosystem: pip
directory: /
schedule:
interval: daily
59 changes: 59 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
---
name: Build

on: [push, release]

jobs:
build:
name: Test Python ${{ matrix.python-version }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: ['3.8']

steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v3
with:
python-version: ${{ matrix.python-version }}

- name: Install requirements
run: |
pip install poetry pre-commit
poetry install
- name: Install RethinkDB and compile proto file
run: |
./scripts/install-db.sh
make ql2.proto
- name: Run linters
run: |
pre-commit run --all-files
poetry run make lint
- name: Run tests
run: |
# Download and install test reporter
make download-test-reporter
make test-reporter-before
# Start DB and run tests
rethinkdb&
poetry run make test
killall rethinkdb
- name: Upload coverage report
if: ${{ matrix.python-version == '3.8' }}
env:
CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }}
run: |
make upload-coverage
- name: Deploy to PyPi
env:
POETRY_HTTP_BASIC_PYPI_USERNAME: ${{ secrets.POETRY_HTTP_BASIC_PYPI_USERNAME }}
POETRY_HTTP_BASIC_PYPI_PASSWORD: ${{ secrets.POETRY_HTTP_BASIC_PYPI_PASSWORD }}
if: ${{ github.event_name == 'release' && matrix.python-version == '3.8' }}
run: poetry publish --build
73 changes: 73 additions & 0 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
---
# For most projects, this workflow file will not need changing; you simply need
# to commit it to your repository.
#
# You may wish to alter this file to override the set of languages analyzed,
# or to provide custom queries or build logic.
#
# ******** NOTE ********
# We have attempted to detect the languages in your repository. Please check
# the `language` matrix defined below to confirm you have the correct set of
# supported CodeQL languages.
#
name: CodeQL

on:
push:
branches: [master]
pull_request:
# The branches below must be a subset of the branches above
branches: [master]
schedule:
- cron: 28 8 * * 0

jobs:
analyze:
name: Analyze
runs-on: ubuntu-latest
permissions:
actions: read
contents: read
security-events: write

strategy:
fail-fast: false
matrix:
language: [python]
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ]
# Learn more about CodeQL language support at https://aka.ms/codeql-docs/language-support

steps:
- name: Checkout repository
uses: actions/checkout@v3

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v2
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
# By default, queries listed here will override any specified in a config file.
# Prefix the list here with "+" to use these queries and those in the config file.

# Details on CodeQL's query packs refer to : https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs
# queries: security-extended,security-and-quality


# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
uses: github/codeql-action/autobuild@v2

# ℹ️ Command-line programs to run using the OS shell.
# 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun

# If the Autobuild fails above, remove it and uncomment the following three lines.
# modify them (or add more) to build your code if your project, please refer to the EXAMPLE below for guidance.

# - run: |
# echo "Run, Build Application using script"
# ./location_of_script_within_repo/buildscript.sh

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2
49 changes: 34 additions & 15 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ __pycache__/

# Distribution / packaging
.Python
env/
build/
develop-eggs/
dist/
Expand All @@ -23,7 +24,6 @@ wheels/
*.egg-info/
.installed.cfg
*.egg
MANIFEST

# PyInstaller
# Usually these files are written by a python script from a template
Expand All @@ -47,30 +47,49 @@ coverage.xml
.hypothesis/
.pytest_cache/

# Translations
*.mo
*.pot
# Sphinx documentation
docs/_build/

# PyBuilder
target/

# Jupyter Notebook
.ipynb_checkpoints

# pyenv
.python-version

# Environments
*.pid
# dotenv
.env

# virtualenv
.venv
env/
venv/
ENV/
env.bak/
venv.bak/
virtualenv/
ENV/

# RethinkDB
rethinkdb/ql2_pb2.py
rethinkdb/*.proto
rethinkdb_data/
rebirthdb_data/
# Rope project settings
.ropeproject

# mkdocs documentation
/site

# mypy
.mypy_cache/

# Editors
.vscode/
.idea/

# Misc
.DS_Store
TODO

# rethinkdb
examples/
rethinkdb_data/
rethinkdb/ql2_pb2.py
ql2.proto

# test reporter
cc-test-reporter
22 changes: 22 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
---
# See https://pre-commit.com for more information
# See https://pre-commit.com/hooks.html for more hooks

default_stages: [commit, push]
fail_fast: false
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.2.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-toml
- id: check-json
- id: pretty-format-json
- id: check-merge-conflict
- id: check-added-large-files

- repo: https://github.com/jumanjihouse/pre-commit-hook-yamlfmt.git
rev: 0.2.1
hooks:
- id: yamlfmt
38 changes: 0 additions & 38 deletions .travis.yml

This file was deleted.

10 changes: 10 additions & 0 deletions AUTHORS.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
=======
Credits
=======

Contributors
------------

Check the whole list of contributors here_.

.. _here: https://github.com/rethinkdb/rethinkdb-python/graphs/contributors
Loading

0 comments on commit 4154f76

Please sign in to comment.