generated from dbt-labs/dbt-oss-template
-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
12 changed files
with
281 additions
and
120 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -143,6 +143,9 @@ venv.bak/ | |
.dmypy.json | ||
dmypy.json | ||
|
||
# ruff | ||
.ruff_cache/ | ||
|
||
# Pyre type checker | ||
.pyre/ | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
version = "0.0.1" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
[project] | ||
name = "dbt-common" | ||
version = "0.0.1" | ||
dynamic = ["version"] | ||
description = "The shared common utilities that dbt-core and adapter implementations use" | ||
readme = "README.md" | ||
requires-python = ">=3.8" | ||
|
@@ -9,8 +9,15 @@ keywords = [] | |
authors = [ | ||
{ name = "dbt Labs", email = "[email protected]" }, | ||
] | ||
maintainers = [ | ||
{ name = "dbt Labs", email = "[email protected]" }, | ||
] | ||
classifiers = [ | ||
"Development Status :: 4 - Beta", | ||
"Development Status :: 2 - Pre-Alpha", | ||
"License :: OSI Approved :: Apache Software License", | ||
"Operating System :: MacOS :: MacOS X", | ||
"Operating System :: Microsoft :: Windows", | ||
"Operating System :: POSIX :: Linux", | ||
"Programming Language :: Python", | ||
"Programming Language :: Python :: 3.8", | ||
"Programming Language :: Python :: 3.9", | ||
|
@@ -32,6 +39,33 @@ dependencies = [ | |
"requests<3.0.0", | ||
"typing-extensions~=4.4", | ||
] | ||
[project.optional-dependencies] | ||
lint = [ | ||
"black~=23.3", | ||
"flake8", | ||
"Flake8-pyproject", | ||
"mypy~=1.3", | ||
"ruff==0.1.11", | ||
"types-Jinja2~=2.11", | ||
"types-jsonschema~=4.17", | ||
"types-protobuf~=4.24.0", | ||
"types-python-dateutil~=2.8", | ||
"types-PyYAML~=6.0", | ||
"types-requests<2.31.0" # types-requests 2.31.0.8 requires urllib3>=2, but we pin urllib3 ~= 1.0 because of openssl requirement for requests | ||
|
||
] | ||
test = [ | ||
"pytest~=7.3", | ||
# "pytest-dotenv", | ||
"pytest-xdist~=3.2", | ||
"hypothesis~=6.87" | ||
] | ||
|
||
[project.urls] | ||
Homepage = "https://github.com/dbt-labs/dbt-common" # TODO: should this be dbt's homepage? | ||
Repository = "https://github.com/dbt-labs/dbt-common.git" | ||
Issues = "https://github.com/dbt-labs/dbt-common/issues" | ||
Changelog = "https://github.com/dbt-labs/dbt-common/blob/main/CHANGELOG.md" | ||
|
||
[build-system] | ||
requires = ["hatchling"] | ||
|
@@ -45,36 +79,40 @@ exclude = [ | |
".gitignore", | ||
".pre-commit-config.yaml", | ||
"CONTRIBUTING.md", | ||
"MAKEFILE", | ||
"MAKEFILE", # TODO: remove once we remove the makefile | ||
"/tests", | ||
] | ||
|
||
[tool.hatch.build.targets.wheel] | ||
packages = ["dbt_common"] | ||
|
||
[tool.hatch.envs.dev-env.scripts] | ||
all = ["pre-commit run --all-files"] | ||
[tool.hatch.version] | ||
path = "dbt_common/__about__.py" | ||
|
||
[tool.hatch.envs.dev-env] | ||
description = "Env for running development commands like pytest / pre-commit" | ||
dependencies = [ | ||
"pytest~=7.3", | ||
"pytest-xdist~=3.2", | ||
"httpx~=0.24", | ||
"hypothesis~=6.87", | ||
"pre-commit~=3.2", | ||
"isort~=5.12", | ||
"black~=23.3", | ||
"ruff==0.1.11", | ||
"mypy~=1.3", | ||
"pytest~=7.3", | ||
"types-Jinja2~=2.11", | ||
"types-jsonschema~=4.17", | ||
"types-protobuf~=4.24.0", | ||
"types-python-dateutil~=2.8", | ||
"types-PyYAML~=6.0", | ||
"types-requests<2.31.0" # types-requests 2.31.0.8 requires urllib3>=2, but we pin urllib3 ~= 1.0 because of openssl requirement for requests | ||
# [tool.hatch.envs.dev.scripts] | ||
# all = ["pre-commit run --all-files"] | ||
|
||
[tool.hatch.envs.default] | ||
description = "Env for running development commands like pytest & linting" | ||
features = ["lint", "test"] | ||
|
||
# these are the commands that you run with `hatch run <cmd>` for local dev & CI | ||
[tool.hatch.envs.default.scripts] | ||
# This edits your local pre-commit hook file to use Hatch when executing. | ||
# TODO: move to it's own env that only installs pre-commit - may need to live here though? | ||
setup-pre-commit = 'sed -i -e "s/exec /exec hatch run /g" .git/hooks/pre-commit' | ||
unit-tests = "- python -m pytest {args:tests/unit}" | ||
lint-all = [ | ||
"- lint-black", | ||
"- lint-flake8", | ||
"- lint-mypy", | ||
] | ||
lint-black = "python -m black ." | ||
lint-flake8 = "python -m flake8 ." | ||
lint-mypy = "python -m mypy ." | ||
proto = "protoc -I=./dbt_common/events --python_out=./dbt_common/events ./dbt_common/events/types.proto" | ||
lint = ["black --check --diff {args:.}", "ruff check {args:.}", "mypy {args:.}"] | ||
format = ["black {args:.}", "ruff --fix --exit-non-zero-on-fix {args:.}"] | ||
|
||
# ruff replaces flake8! | ||
[tool.ruff] | ||
|
@@ -108,13 +146,34 @@ ignore = [ | |
# E501 - Line too long. | ||
# W292 - No newline at end of file. | ||
fixable = ["F401", "E501", "W292"] | ||
exclude = [ | ||
"dbt_common/events/types_pb2.py", | ||
"env*", | ||
"third-party-stubs/*", | ||
] | ||
|
||
[tool.ruff.per-file-ignores] | ||
"types_pb2.py" = ["E501", "E712", "F821"] | ||
|
||
[tool.ruff.pydocstyle] | ||
convention = "google" | ||
|
||
[tool.black] | ||
extend-exclude = "dbt_common/events/types_pb2.py" | ||
line-length = 99 | ||
target-version = ['py38'] | ||
|
||
[tool.flake8] | ||
select = ["E", "W", "F"] | ||
ignore = ["E203", "E501", "E741", "W503", "W504"] | ||
exclude = [ | ||
"dbt_common/events/types_pb2.py", | ||
"tests", | ||
"venv", | ||
"env*" | ||
] | ||
per-file-ignores = ["*/__init__.py: F401"] | ||
|
||
[tool.mypy] | ||
mypy_path = "third-party-stubs/" | ||
namespace_packages = true | ||
|
@@ -123,14 +182,12 @@ show_error_codes = true | |
disable_error_code = "attr-defined" # TODO: revisit once other mypy errors resolved | ||
disallow_untyped_defs = false # TODO: add type annotations everywhere | ||
warn_redundant_casts = true | ||
exclude = [ | ||
"dbt_common/events/types_pb2.py", | ||
"env*", | ||
"third-party-stubs/*", | ||
] | ||
|
||
# Don't run the extensive mypy checks on custom stubs | ||
[[tool.mypy.overrides]] | ||
module = ["logbook.*"] | ||
disallow_untyped_defs = false | ||
|
||
[tool.isort] | ||
profile = "black" | ||
|
||
[tool.black] | ||
line-length = 99 | ||
module = ["dbt_common.events.types_pb2.py"] | ||
follow_imports = "skip" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.