Skip to content

Commit

Permalink
Migrate project to pyproject.toml based package setup
Browse files Browse the repository at this point in the history
Fixes #128
Fixes #135 

* Add pyproject.toml
* Add poetry lock file
* Add dependencies to pyproject.toml
* Add dependabot updater to repository
* Add pyupgrade commit hook to workspace
* Remove deprecated and unused configuration entries
* Add extension points required for sqlalchemy plugin(s)
* Add version sync support for project.toml based version
* Add version check to ci/verifier action
* Update CI workflow to use poetry
* Update base python version to 3.8
* Update changelog
* Remove condaforge reference in README
   - Conda forge won't be maintained anymore.
* Deleted deprecated and unused files
* Use python built in mock library
* Bump version to 3.0.0
  • Loading branch information
Nicoretti authored Jul 14, 2022
1 parent 77b579b commit ccb6983
Show file tree
Hide file tree
Showing 29 changed files with 1,112 additions and 995 deletions.
17 changes: 17 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
version: 2
updates:

# Maintain dependencies for GitHub Actions
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "weekly"
day: "monday"
open-pull-requests-limit: 5

# Maintain dependencies for poetry
- package-ecosystem: "pip"
directory: "/"
schedule:
interval: "daily"
open-pull-requests-limit: 5
69 changes: 33 additions & 36 deletions .github/workflows/CI-CD.yml → .github/workflows/ci-cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,18 @@ jobs:
strategy:
fail-fast: false
matrix:
python: [3.7, 3.8, 3.9]
python:
- "3.8"
- "3.9"
- "3.10"
connector:
- pyodbc
- turbodbc
# TODO: Reenable once the issue(s) below have been fixed.
# Turbodbc can't be supported using poetry until:
# - https://github.com/blue-yonder/turbodbc/issues/358
# - https://github.com/exasol/sqlalchemy-exasol/issues/146
# are fixed.
# - turbodbc
exasol_version:
- 7.1.6
- 7.0.16
Expand All @@ -31,26 +39,24 @@ jobs:
- name: Setup integration-test-docker-environment
uses: actions/setup-python@v2

- name: Install via apt
run: sudo apt-get install unixodbc unixodbc-dev libboost-date-time-dev libboost-locale-dev libboost-system-dev

- name: Setup Python ${{ matrix.python }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python }}

- name: Install via apt
run: sudo apt-get install unixodbc unixodbc-dev libboost-date-time-dev libboost-locale-dev libboost-system-dev

- name: Install pipenv
uses: dschep/install-pipenv-action@v1

- name: Pip install test requirements
uses: BSFishy/pip-action@v1
- name: Install poetry
uses: abatilo/actions-poetry@v2.0.0
with:
requirements: requirements_dev.txt
poetry-version: 1.1.13

- name: Pip install extra requirements
uses: BSFishy/pip-action@v1
with:
requirements: requirements_extras.txt
- name: Install python project dependencies
run: poetry install

- name: Install python project dependencies including trubodbc
run: poetry install --extras "turbodbc"
if: ${{ matrix.connector == 'turbodbc' }}

- name: Checkout test environment
Expand All @@ -60,23 +66,18 @@ jobs:
ITDE_URL: "https://github.com/exasol/integration-test-docker-environment.git"
ITDE_TAG: "0.10.0"

- name: Check documentation links ${{ matrix.python }} using ${{ matrix.connector }}
run: nox -s "check-links"

- name: Run Test for Python ${{ matrix.python }} using ${{ matrix.connector }}
run: nox -s "verify(connector='${{ matrix.connector }}')"
run: poetry run nox -s "verify(connector='${{ matrix.connector }}')"

upload_to_pypi:
runs-on: ubuntu-latest
needs: run_tests
if: startsWith(github.event.ref, 'refs/tags')
strategy:
matrix:
python: [3.7]
connector:
- pyodbc
python: [3.8]

name: Upload to PyPI (Python-${{ matrix.python }}, Connector-${{ matrix.connector }})
name: Build & Upload Package [PYPI]

steps:

Expand All @@ -91,17 +92,13 @@ jobs:
with:
python-version: ${{ matrix.python }}

- name: Install pipenv
uses: dschep/install-pipenv-action@v1

- name: Install Wheel
run: pip install wheel

- name: Build sdist and wheel packages
run: python setup.py sdist bdist_wheel

- name: Push package to Pypi
uses: pypa/gh-action-pypi-publish@release/v1
- name: Install poetry
uses: abatilo/actions-poetry@v2.0.0
with:
user: __token__
password: ${{ secrets.pypi_token }}
poetry-version: 1.1.13

- name: Build and push package to PYPI
env:
POETRY_HTTP_BASIC_TEST_USERNAME: "__token__"
POETRY_HTTP_BASIC_TEST_PASSWORD: "${{ secrets.pypi_token }}"
run: poetry run nox -s release
63 changes: 30 additions & 33 deletions .github/workflows/CI.yml → .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,18 @@ jobs:
strategy:
fail-fast: false
matrix:
python: [3.7, 3.8, 3.9]
python:
- "3.8"
- "3.9"
- "3.10"
connector:
- pyodbc
- turbodbc
# TODO: Reenable once the issue(s) below have been fixed.
# Turbodbc can't be supported using poetry until:
# - https://github.com/blue-yonder/turbodbc/issues/358
# - https://github.com/exasol/sqlalchemy-exasol/issues/146
# are fixed.
# - turbodbc
exasol_version:
- 7.1.6
- 7.0.16
Expand All @@ -32,29 +40,24 @@ jobs:
- name: Fetch sqlalchemy_exasol code from repository
uses: actions/checkout@v2

- name: Setup integration-test-docker-environment
uses: actions/setup-python@v2
- name: Install via apt
run: sudo apt-get install unixodbc unixodbc-dev libboost-date-time-dev libboost-locale-dev libboost-system-dev

- name: Setup Python ${{ matrix.python }}
uses: actions/setup-python@v2
uses: actions/setup-python@v3
with:
python-version: ${{ matrix.python }}

- name: Install via apt
run: sudo apt-get install unixodbc unixodbc-dev libboost-date-time-dev libboost-locale-dev libboost-system-dev

- name: Install pipenv
uses: dschep/install-pipenv-action@v1

- name: Pip install requirements
uses: BSFishy/pip-action@v1
- name: Install poetry
uses: abatilo/actions-poetry@v2.0.0
with:
requirements: requirements_dev.txt
poetry-version: 1.1.13

- name: Pip install extra requirements
uses: BSFishy/pip-action@v1
with:
requirements: requirements_extras.txt
- name: Install python project dependencies
run: poetry install

- name: Install python project dependencies including trubodbc
run: poetry install --extras "turbodbc"
if: ${{ matrix.connector == 'turbodbc' }}

- name: Checkout test environment
Expand All @@ -64,22 +67,17 @@ jobs:
ITDE_URL: "https://github.com/exasol/integration-test-docker-environment.git"
ITDE_TAG: "0.10.0"

- name: Check documentation links ${{ matrix.python }} using ${{ matrix.connector }}
run: nox -s "check-links"

- name: Run Test for Python ${{ matrix.python }} using ${{ matrix.connector }}
run: nox -s "verify(connector='${{ matrix.connector }}')"
run: poetry run nox -s "verify(connector='${{ matrix.connector }}')"

build_package:
runs-on: ubuntu-latest
needs: run_tests
strategy:
matrix:
python: [3.7]
connector:
- pyodbc
python: [3.8]

name: Build Package (Python-${{ matrix.python }}, Connector-${{ matrix.connector }})
name: Build Package

steps:

Expand All @@ -90,15 +88,14 @@ jobs:
run: git fetch origin +refs/tags/*:refs/tags/*

- name: Setup Python ${{ matrix.python }}
uses: actions/setup-python@v2
uses: actions/setup-python@v3
with:
python-version: ${{ matrix.python }}

- name: Install pipenv
uses: dschep/install-pipenv-action@v1

- name: Install Wheel
run: pip install wheel
- name: Install poetry
uses: abatilo/actions-poetry@v2.0.0
with:
poetry-version: 1.1.13

- name: Build sdist and wheel packages
run: python setup.py sdist bdist_wheel
run: poetry build
40 changes: 40 additions & 0 deletions .github/workflows/link-check.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: Check Links

on:
push:
branches-ignore:
- 'master'
pull_request:
branches-ignore:
- 'master'

jobs:
run_tests:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python: [3.8]

name: Check Links (Python-${{ matrix.python }})

steps:

- name: Fetch sqlalchemy_exasol code from repository
uses: actions/checkout@v2

- name: Setup Python ${{ matrix.python }}
uses: actions/setup-python@v3
with:
python-version: ${{ matrix.python }}

- name: Install poetry
uses: abatilo/actions-poetry@v2.0.0
with:
poetry-version: 1.1.13

- name: Install python project dependencies
run: poetry install --no-root

- name: Check documentation links ${{ matrix.python }} using ${{ matrix.connector }}
run: poetry run nox -s "check-links"
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
odbcconfig/odbcinst.ini

*.py[cod]

.build_output
Expand All @@ -24,7 +26,6 @@ develop-eggs
.installed.cfg
lib
lib64
sqlalchemy_exasol/_version.py

# Installer logs
pip-log.txt
Expand Down
17 changes: 17 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
default_stages: [commit]
repos:
- repo: local
hooks:

- id: version-check
name: Check if version(s) are in sync
always_run: true
language: system
entry: python scripts/version_check.py --fix sqlalchemy_exasol/version.py

- repo: https://github.com/asottile/pyupgrade
rev: v2.34.0
hooks:
- id: pyupgrade
args: ['--py38-plus']
types: [python]
13 changes: 13 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,16 @@
# 3.0.0
⚠️ ATTENTION ⚠️
* The support of the turbodbc feature have been suspended, until the following issues have been addressed
* https://github.com/blue-yonder/turbodbc/issues/358
* https://github.com/exasol/sqlalchemy-exasol/issues/146

Note: If you depend on turbodbc we suggest you to use the latest version supporting it (2.4.0)

* Dropped python 3.7 support
* If you still depend on python 3.7 use the 2.x version line
* Update project setup/structure to pyproject.toml based project setup (poetry)
* Removed conda forge support

# 2.4.0
* Fixed bug when accessing underlying odbc connection while using NullPool based engine
(Note: this addresses the superset [issue-20105](https://github.com/apache/superset/issues/20105))
Expand Down
3 changes: 0 additions & 3 deletions MANIFEST.in

This file was deleted.

7 changes: 2 additions & 5 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,10 @@ SQLAlchemy Dialect for EXASOL DB


.. image:: https://github.com/exasol/sqlalchemy_exasol/workflows/CI-CD/badge.svg?branch=master
:target: https://github.com/exasol/sqlalchemy_exasol/actions?query=workflow%3ACI-CD
:target: https://github.com/exasol/sqlalchemy_exasol/actions?query=workflow%3ACI
.. image:: https://img.shields.io/pypi/v/sqlalchemy_exasol
:target: https://pypi.org/project/sqlalchemy-exasol/
:alt: PyPI Version
.. image:: https://img.shields.io/conda/vn/conda-forge/sqlalchemy_exasol.svg
:target: https://anaconda.org/conda-forge/sqlalchemy_exasol
:alt: Conda Version

This is an SQLAlchemy dialect for the EXASOL database.

Expand Down Expand Up @@ -40,7 +37,7 @@ On Linux/Unix like systems you need:
Turbodbc support
````````````````

- You can use Turbodbc with sqlalchemy_exasol if you use a python version >= 3.7.
- You can use Turbodbc with sqlalchemy_exasol if you use a python version >= 3.8.
- Multi row update is not supported, see
`test/test_update.py <test/test_update.py>`_ for an example

Expand Down
7 changes: 7 additions & 0 deletions TODOs.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
FINAL TASKS:
------------
* ATTENTION: Update turbodbc driver to latest including installation fix!
* make sure automated publish via GH action still works with poetry
* CLOSE: https://github.com/exasol/sqlalchemy-exasol/issues/135
* CLOSE: https://github.com/exasol/sqlalchemy-exasol/issues/146
* CLOSE: https://github.com/exasol/sqlalchemy-exasol/issues/128
Loading

0 comments on commit ccb6983

Please sign in to comment.