Skip to content

Commit

Permalink
Standardize dev requirements (dbt-labs#339)
Browse files Browse the repository at this point in the history
* pinned dev requirements to major version, synced across adapters
* hard pinned mypy
* pinned wheel due to vulnerability in version 0.30
* added py37-specific pins where needed
* updated requirements and pre-commit-config to standard for adapters
* update flake8 config
* black
  • Loading branch information
mikealfare authored Mar 1, 2023
1 parent 48c0b5a commit 6029336
Show file tree
Hide file tree
Showing 5 changed files with 46 additions and 32 deletions.
12 changes: 7 additions & 5 deletions .flake8
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,11 @@ select =
W
F
ignore =
W503 # makes Flake8 work like black
W504
E203 # makes Flake8 work like black
E741
E501
# makes Flake8 work like black
W503,
W504,
# makes Flake8 work like black
E203,
E741,
E501,
exclude = test
18 changes: 9 additions & 9 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ exclude: '^tests/.*'

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

repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v3.2.0
rev: v4.4.0
hooks:
- id: check-yaml
args: [--unsafe]
Expand All @@ -18,31 +18,31 @@ repos:
- id: trailing-whitespace
- id: check-case-conflict
- repo: https://github.com/psf/black
rev: 21.12b0
rev: 23.1.0
hooks:
- id: black
additional_dependencies: ['click==8.0.4']
additional_dependencies: ['click~=8.1']
args:
- "--line-length=99"
- "--target-version=py38"
- id: black
alias: black-check
stages: [manual]
additional_dependencies: ['click==8.0.4']
additional_dependencies: ['click~=8.1']
args:
- "--line-length=99"
- "--target-version=py38"
- "--check"
- "--diff"
- repo: https://github.com/pycqa/flake8
rev: 4.0.1
rev: 6.0.0
hooks:
- id: flake8
- id: flake8
alias: flake8-check
stages: [manual]
- repo: https://github.com/pre-commit/mirrors-mypy
rev: v0.942
rev: v1.0.1
hooks:
- id: mypy
# N.B.: Mypy is... a bit fragile.
Expand All @@ -55,12 +55,12 @@ repos:
# 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]
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]
args: [--show-error-codes, --pretty, --ignore-missing-imports, --explicit-package-bases]
files: ^dbt/adapters
language: system
5 changes: 5 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@ dev: ## Installs adapter in develop mode along with development dependencies
@\
pip install -e . -r dev-requirements.txt && pre-commit install

.PHONY: dev-uninstall
dev-uninstall: ## Uninstalls all packages while maintaining the virtual environment
## Useful when updating versions, or if you accidentally installed into the system interpreter
pip freeze | grep -v "^-e" | cut -d "@" -f1 | xargs pip uninstall -y

.PHONY: mypy
mypy: ## Runs mypy against staged changes for static type checking.
@\
Expand Down
1 change: 0 additions & 1 deletion dbt/adapters/redshift/connections.py
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,6 @@ def execute(
return response, table

def add_query(self, sql, auto_begin=True, bindings=None, abridge_sql_log=False):

connection = None
cursor = None

Expand Down
42 changes: 25 additions & 17 deletions dev-requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,30 @@ git+https://github.com/dbt-labs/dbt-core.git#egg=dbt-core&subdirectory=core
git+https://github.com/dbt-labs/dbt-core.git#egg=dbt-tests-adapter&subdirectory=tests/adapter
git+https://github.com/dbt-labs/dbt-core.git#egg=dbt-postgres&subdirectory=plugins/postgres

black~=22.8.0
click~=8.1.3
# if version 1.x or greater -> pin to major version
# if version 0.x -> pin to minor
black~=23.1
bumpversion~=0.6.0
flake8
flaky~=3.7.0
freezegun~=0.3.12
ipdb~=0.13.9
mypy~=0.971.0
pip-tools~=6.11.0
pre-commit~=2.20.0
pytest~=7.2.0
click~=8.1
flake8~=5.0;python_version=="3.7"
flake8~=6.0;python_version>="3.8"
flaky~=3.7
freezegun~=1.2
ipdb~=0.13.11
mypy==1.0.1 # patch updates have historically introduced breaking changes
pip-tools~=6.12
pre-commit~=2.21;python_version=="3.7"
pre-commit~=3.1;python_version>="3.8"
pre-commit-hooks~=4.4
pytest~=7.2
pytest-csv~=3.0
pytest-dotenv~=0.5.2
pytest-logbook~=1.2.0
pytest-csv~=3.0.0
pytest-xdist~=3.1.0
pytz~=2022.6.0
tox~=4.0.0
twine~=4.0.2
wheel~=0.37.1
pytest-logbook~=1.2
pytest-xdist~=3.2
pytz~=2022.7
tox~=3.0;python_version=="3.7"
tox~=4.4;python_version>="3.8"
types-pytz~=2022.7
types-requests~=2.28
twine~=4.0
wheel~=0.38

0 comments on commit 6029336

Please sign in to comment.