Skip to content

Commit

Permalink
pin macos-runners to macos-12 (#787)
Browse files Browse the repository at this point in the history
(cherry picked from commit ddfc36c)
  • Loading branch information
mikealfare committed Apr 26, 2024
1 parent 13435ab commit 163895b
Show file tree
Hide file tree
Showing 11 changed files with 72 additions and 109 deletions.
16 changes: 0 additions & 16 deletions .flake8

This file was deleted.

2 changes: 0 additions & 2 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,6 @@ jobs:
python -m pip install -r dev-requirements.txt
python -m pip --version
pre-commit --version
mypy --version
dbt --version
- name: pre-commit hooks
run: pre-commit run --all-files --show-diff-on-failure
Expand Down
105 changes: 46 additions & 59 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,63 +1,50 @@
# For more on configuring pre-commit hooks (see https://pre-commit.com/)

# Force all unspecified python hooks to run python 3.8
default_language_version:
python: python3
python: python3

repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
hooks:
- id: check-yaml
args: [--unsafe]
- id: check-json
- id: end-of-file-fixer
- id: trailing-whitespace
- id: check-case-conflict
- repo: https://github.com/psf/black
rev: 23.1.0
hooks:
- id: black
additional_dependencies: ['click~=8.1']
args:
- "--line-length=99"
- "--target-version=py38"
- id: black
alias: black-check
stages: [manual]
additional_dependencies: ['click~=8.1']
args:
- "--line-length=99"
- "--target-version=py38"
- "--check"
- "--diff"
- repo: https://github.com/pycqa/flake8
rev: 6.0.0
hooks:
- id: flake8
- id: flake8
alias: flake8-check
stages: [manual]
- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.1.1
hooks:
- id: mypy
# N.B.: Mypy is... a bit fragile.
#
# By using `language: system` we run this hook in the local
# environment instead of a pre-commit isolated one. This is needed
# to ensure mypy correctly parses the project.
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.6.0
hooks:
- id: check-yaml
args: [--unsafe]
- id: check-json
- id: end-of-file-fixer
- id: trailing-whitespace
- id: check-case-conflict

- repo: https://github.com/psf/black
rev: 24.4.0
hooks:
- id: black
args:
- --line-length=99
- --target-version=py38
- --target-version=py39
- --target-version=py310
- --target-version=py311

- repo: https://github.com/pycqa/flake8
rev: 7.0.0
hooks:
- id: flake8
exclude: tests/
args:
- --max-line-length=99
- --select=E,F,W
- --ignore=E203,E501,E741,W503,W504
- --per-file-ignores=*/__init__.py:F401
additional_dependencies: [flaky]

# It may cause trouble in that it adds environmental variables out
# of our control to the mix. Unfortunately, there's nothing we can
# do about per pre-commit's author.
# See https://github.com/pre-commit/pre-commit/issues/730 for details.
args: [--show-error-codes, --ignore-missing-imports, --explicit-package-bases]
files: ^dbt/adapters/.*
language: system
- id: mypy
alias: mypy-check
stages: [manual]
args: [--show-error-codes, --pretty, --ignore-missing-imports, --explicit-package-bases]
files: ^dbt/adapters
language: system
- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.9.0
hooks:
- id: mypy
args:
- --show-error-codes
- --pretty
- --ignore-missing-imports
- --explicit-package-bases
files: ^dbt/adapters
additional_dependencies:
- types-pytz
- types-requests
13 changes: 7 additions & 6 deletions dbt/adapters/redshift/connections.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
from redshift_connector.utils.oids import get_datatype_name

from dbt.adapters.sql import SQLConnectionManager
import dbt.clients.agate_helper
from dbt.contracts.connection import AdapterResponse, Connection, Credentials
from dbt.contracts.util import Replaceable
from dbt.dataclass_schema import FieldEncoder, dbtClassMixin, StrEnum, ValidationError
Expand Down Expand Up @@ -64,7 +65,7 @@ class UserSSLMode(StrEnum):
@classmethod
def default(cls) -> "UserSSLMode":
# default for `psycopg2`, which aligns with dbt-redshift 1.4 and provides backwards compatibility
return cls.prefer
return cls("prefer")


class RedshiftSSLMode(StrEnum):
Expand All @@ -74,11 +75,11 @@ class RedshiftSSLMode(StrEnum):

SSL_MODE_TRANSLATION = {
UserSSLMode.disable: None,
UserSSLMode.allow: RedshiftSSLMode.verify_ca,
UserSSLMode.prefer: RedshiftSSLMode.verify_ca,
UserSSLMode.require: RedshiftSSLMode.verify_ca,
UserSSLMode.verify_ca: RedshiftSSLMode.verify_ca,
UserSSLMode.verify_full: RedshiftSSLMode.verify_full,
UserSSLMode.allow: RedshiftSSLMode("verify-ca"),
UserSSLMode.prefer: RedshiftSSLMode("verify-ca"),
UserSSLMode.require: RedshiftSSLMode("verify-ca"),
UserSSLMode.verify_ca: RedshiftSSLMode("verify-ca"),
UserSSLMode.verify_full: RedshiftSSLMode("verify-full"),
}


Expand Down
4 changes: 2 additions & 2 deletions dbt/adapters/redshift/relation_configs/dist.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class RedshiftDistStyle(StrEnum):

@classmethod
def default(cls) -> "RedshiftDistStyle":
return cls.auto
return cls("auto")


@dataclass(frozen=True, eq=True, unsafe_hash=True)
Expand Down Expand Up @@ -102,7 +102,7 @@ def parse_model_node(cls, model_node: ModelNode) -> dict:
config = {"diststyle": diststyle}

else:
config = {"diststyle": RedshiftDistStyle.key.value, "distkey": dist}
config = {"diststyle": RedshiftDistStyle.key.value, "distkey": dist} # type: ignore

return config

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ class RedshiftMaterializedViewConfig(RedshiftRelationConfigBase, RelationConfigV
database_name: str
query: str
backup: bool = True
dist: RedshiftDistConfig = RedshiftDistConfig(diststyle=RedshiftDistStyle.even)
dist: RedshiftDistConfig = RedshiftDistConfig(diststyle=RedshiftDistStyle.even) # type: ignore
sort: RedshiftSortConfig = RedshiftSortConfig()
autorefresh: bool = False

Expand Down
4 changes: 2 additions & 2 deletions dbt/adapters/redshift/relation_configs/sort.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,11 @@ class RedshiftSortStyle(StrEnum):

@classmethod
def default(cls) -> "RedshiftSortStyle":
return cls.auto
return cls("auto")

@classmethod
def default_with_columns(cls) -> "RedshiftSortStyle":
return cls.compound
return cls("compound")


@dataclass(frozen=True, eq=True, unsafe_hash=True)
Expand Down
32 changes: 13 additions & 19 deletions dev-requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,28 +4,22 @@ git+https://github.com/dbt-labs/dbt-core.git@1.6.latest#egg=dbt-core&subdirector
git+https://github.com/dbt-labs/dbt-core.git@1.6.latest#egg=dbt-tests-adapter&subdirectory=tests/adapter
git+https://github.com/dbt-labs/dbt-core.git@1.6.latest#egg=dbt-postgres&subdirectory=plugins/postgres

# if version 1.x or greater -> pin to major version
# if version 0.x -> pin to minor
black~=23.3
bumpversion~=0.6.0
click~=8.1
ddtrace~=1.16
flake8~=6.0
flaky~=3.7
freezegun~=1.2
# dev
ipdb~=0.13.13
mypy==1.4.1 # patch updates have historically introduced breaking changes
pip-tools~=6.14
pre-commit~=3.3
pre-commit-hooks~=4.4
pre-commit==3.7.0;python_version >="3.9"
pre-commit==3.5.0;python_version <"3.9"

# test
ddtrace==2.3.0
freezegun~=1.3
pytest~=7.4
pytest-csv~=3.0
pytest-dotenv~=0.5.2
pytest-logbook~=1.2
pytest-xdist~=3.3
pytz~=2023.3
tox~=4.6
types-pytz~=2023.3
types-requests~=2.31
pytest-xdist~=3.5
tox~=4.11

# build
bumpversion~=0.6.0
twine~=4.0
wheel~=0.40
wheel~=0.42
2 changes: 0 additions & 2 deletions mypy.ini

This file was deleted.

Empty file.
1 change: 1 addition & 0 deletions tests/unit/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
Note that all imports should be inside the functions to avoid import/mocking
issues.
"""

import string
import os
from unittest import mock
Expand Down

0 comments on commit 163895b

Please sign in to comment.