Skip to content

Commit

Permalink
ci: Fix pip constraints path (#113)
Browse files Browse the repository at this point in the history
* ci: Fix pip constraints path

* Stop using pendulum

* Stop testing with Python 3.8

* Do not fail fast

* Update Ruff config

* Use consistent Python version
  • Loading branch information
edgarrmondragon authored Jan 28, 2025
1 parent debccd3 commit 3e05853
Show file tree
Hide file tree
Showing 10 changed files with 936 additions and 878 deletions.
10 changes: 6 additions & 4 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,11 @@ jobs:
tests:
runs-on: ubuntu-latest
env:
PIP_CONSTRAINT: .github/workflows/constraints.txt
PIP_CONSTRAINT: ${{ github.workspace }}/.github/workflows/constraints.txt
strategy:
fail-fast: false
matrix:
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
python-version: ["3.9", "3.10", "3.11", "3.12"]

steps:
- name: Checkout code
Expand All @@ -43,6 +44,7 @@ jobs:
- uses: isbang/[email protected]

- name: Set up Python ${{ matrix.python-version }}
id: setup-python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
Expand All @@ -53,11 +55,11 @@ jobs:
pip --version
- name: Install Poetry
run: |
pipx install poetry
pipx install --python ${{ steps.setup-python.outputs.python-path }} poetry
poetry --version
- name: Install Tox
run: |
pipx install tox
pipx install --python ${{ steps.setup-python.outputs.python-path }} tox
tox --version
- name: Install dependencies
run: |
Expand Down
4 changes: 2 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@ ci:

repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.5.0
rev: v5.0.0
hooks:
- id: check-json
- id: check-toml
- id: end-of-file-fixer
- id: trailing-whitespace

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.2.2
rev: v0.9.3
hooks:
- id: ruff
args: [--fix]
Expand Down
1,768 changes: 911 additions & 857 deletions poetry.lock

Large diffs are not rendered by default.

8 changes: 2 additions & 6 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ classifiers = [
"Intended Audience :: Developers",
"License :: OSI Approved :: MIT License",
"Operating System :: OS Independent",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
Expand All @@ -36,7 +35,7 @@ packages = [
python = ">=3.9"
fs-s3fs = { version = "==1.1.1", optional = true }
singer-sdk = { version="~=0.43.1" }
pymysql = "==1.1.0"
pymysql = "==1.1.1"
sqlalchemy = "<2"
sshtunnel = "0.4.0"

Expand Down Expand Up @@ -65,7 +64,7 @@ plugins = "sqlalchemy.ext.mypy.plugin" # TODO: Remove this when SQLAlchemy 2.0

[tool.ruff]
src = ["tap_mysql"]
target-version = "py38"
target-version = "py39"

[[tool.mypy.overrides]]
ignore_missing_imports = true
Expand All @@ -75,11 +74,8 @@ module = [

[tool.ruff.lint]
ignore = [
"ANN101", # missing-type-self
"ANN102", # missing-type-cls
# Conflict with Ruff's formatter
"COM812",
"ISC001",
]
select = ["ALL"]

Expand Down
7 changes: 5 additions & 2 deletions tap_mysql/client.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
"""SQL client handling."""

from __future__ import annotations

import datetime
from typing import TYPE_CHECKING, Any, Iterable
from typing import TYPE_CHECKING, Any

import singer_sdk.helpers._typing
import sqlalchemy
Expand All @@ -12,6 +13,8 @@
from singer_sdk.helpers._typing import TypeConformanceLevel

if TYPE_CHECKING:
from collections.abc import Iterable

from sqlalchemy.engine import Engine
from sqlalchemy.engine.reflection import Inspector

Expand Down Expand Up @@ -211,7 +214,7 @@ def get_schema_names(self, engine: Engine, inspected: Inspector) -> list[str]:
return self.config["filter_schemas"]
return super().get_schema_names(engine, inspected)

def discover_catalog_entry( # noqa: PLR0913
def discover_catalog_entry(
self,
engine: Engine,
inspected: Inspector,
Expand Down
6 changes: 5 additions & 1 deletion tap_mysql/tap.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
"""mysql tap class."""

from __future__ import annotations

import atexit
import io
import signal
import sys
from functools import cached_property
from typing import Any, Mapping, cast
from typing import TYPE_CHECKING, Any, cast

import paramiko
from singer_sdk import SQLTap, Stream
Expand All @@ -17,6 +18,9 @@

from tap_mysql.client import MySQLConnector, MySQLStream

if TYPE_CHECKING:
from collections.abc import Mapping


class TapMySQL(SQLTap):
"""Singer tap for MySQL."""
Expand Down
5 changes: 2 additions & 3 deletions tests/test_core.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
import decimal
import json

import pendulum
import pytest
import sqlalchemy
from faker import Faker
Expand All @@ -19,14 +18,14 @@
from .test_replication_key import TABLE_NAME, TapTestReplicationKey

SAMPLE_CONFIG = {
"start_date": pendulum.datetime(2022, 11, 1).to_iso8601_string(),
"start_date": datetime.datetime(2022, 11, 1).isoformat(),
# Using 127.0.0.1 instead of localhost because of mysqlclient dialect.
# See: https://stackoverflow.com/questions/72294279/how-to-connect-to-mysql-databas-using-github-actions
"sqlalchemy_url": "mysql+pymysql://root:[email protected]:3306/melty",
}

NO_SQLALCHEMY_CONFIG = {
"start_date": pendulum.datetime(2022, 11, 1).to_iso8601_string(),
"start_date": datetime.datetime(2022, 11, 1).isoformat(),
# Using 127.0.0.1 instead of localhost because of mysqlclient dialect.
# See: https://stackoverflow.com/questions/72294279/how-to-connect-to-mysql-databas-using-github-actions
"host": "127.0.0.1",
Expand Down
4 changes: 2 additions & 2 deletions tests/test_replication_key.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@

import json

import pendulum
import datetime
from singer_sdk.testing.templates import TapTestTemplate

from tap_mysql.tap import TapMySQL

TABLE_NAME = "test_replication_key"
SAMPLE_CONFIG = {
"start_date": pendulum.datetime(2022, 11, 1).to_iso8601_string(),
"start_date": datetime.datetime(2022, 11, 1).isoformat(),
# Using 127.0.0.1 instead of localhost because of mysqlclient dialect.
# See: https://stackoverflow.com/questions/72294279/how-to-connect-to-mysql-databas-using-github-actions
"sqlalchemy_url": f"mysql+pymysql://root:[email protected]:3306/melty",
Expand Down
1 change: 1 addition & 0 deletions tests/test_selected_columns_only.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Tests selected columns only from stream."""

# flake8: noqa
import json

Expand Down
1 change: 0 additions & 1 deletion tests/test_ssh_tunnel.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
"""Tests standard tap features using the built-in SDK tests library."""


from tap_mysql.tap import TapMySQL

TABLE_NAME = "test_replication_key"
Expand Down

0 comments on commit 3e05853

Please sign in to comment.