diff --git a/Makefile b/Makefile new file mode 100644 index 00000000..6ca5597e --- /dev/null +++ b/Makefile @@ -0,0 +1,23 @@ +.DEFAULT_GOAL:=help + +.PHONY: dev_req +dev_req: ## Installs dbt-* packages in develop mode along with only development dependencies. + @\ + pip install -r dev-requirements.txt + +.PHONY: dev +dev: dev_req ## Installs dbt-* packages in develop mode along with development dependencies and pre-commit. + @\ + pre-commit install + +.PHONY: proto_types +proto_types: ## generates google protobuf python file from types.proto + protoc -I=./dbt/common/events --python_out=./dbt/common/events ./dbt/common/events/types.proto + +.PHONY: help +help: ## Show this help message. + @echo 'usage: make [target]' + @echo + @echo 'targets:' + @grep -E '^[8+a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}' + diff --git a/dbt/__init__.py b/dbt/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 00000000..818bc1e9 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,109 @@ +[project] +name = "dbt-common" +version = "0.0.1" +description = "The shared common utilities that dbt-core and adapter implementations use" +readme = "README.md" +requires-python = ">=3.8" +license = "Apache-2.0" +keywords = [] +authors = [ + { name = "dbt Labs", email = "info@dbtlabs.com" }, +] +classifiers = [ + "Development Status :: 4 - Beta", + "Programming Language :: Python", + "Programming Language :: Python :: 3.8", + "Programming Language :: Python :: 3.9", + "Programming Language :: Python :: 3.10", + "Programming Language :: Python :: 3.11", + "Programming Language :: Python :: Implementation :: CPython", + "Programming Language :: Python :: Implementation :: PyPy", +] +dependencies = [ + "agate~=1.7.0", + "jsonschema~=4.0", + "Jinja2~=3.0", + "mashumaro[msgpack]~=3.9", + "python-dateutil~=2.0", + "typing-extensions~=4.4", +] + +[build-system] +requires = ["hatchling"] +build-backend = "hatchling.build" + +[tool.hatch.build.targets.sdist] +exclude = [ + "/.github", + "/.changes", + ".changie.yaml", + ".gitignore", + ".pre-commit-config.yaml", + "CONTRIBUTING.md", + "MAKEFILE", + "/tests", +] + +[tool.hatch.build.targets.wheel] +packages = ["dbt"] + +[tool.hatch.envs.dev-env.scripts] +all = ["pre-commit run --all-files"] + +[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.0.260", + "mypy~=1.3", + "pytest~=7.3", + "types-Jinja2~=2.11", + "types-jsonschema~=4.17", + "types-python-dateutil~=2.8", + "types-PyYAML~=6.0", +] + +[tool.ruff] +line-length = 120 +select = [ + "E", # Pycodestyle + "F", # Pyflakes + "W", # Whitespace + "D", # Pydocs +] +ignore = [ + # Missing docstring in public module -- often docs handled within classes + "D100", + # Missing docstring in public package -- often docs handled within files not __init__.py + "D104" +] +# Let ruff autofix these errors. +# F401 - Unused imports. +fixable = ["F401"] + +[tool.ruff.pydocstyle] +convention = "google" + +[tool.mypy] +mypy_path = "third-party-stubs/" +namespace_packages = true +warn_unused_configs = true +disallow_untyped_defs = true +warn_redundant_casts = true + +# 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 = 120 \ No newline at end of file