|
| 1 | +# Build Tool |
| 2 | + |
| 3 | + |
| 4 | +## Context |
| 5 | + |
| 6 | +We need to select a build tool for managing dependencies for, building, and distributing `dbt-common`. While tooling can vary, this repo can serve as an OSS template for other OSS at dbt Labs and beyond. |
| 7 | + |
| 8 | + |
| 9 | +## Options |
| 10 | + |
| 11 | +- `setuptools` (`twine`, `build`) |
| 12 | +- `hatch` |
| 13 | +- `poetry` |
| 14 | + |
| 15 | + |
| 16 | +### setuptools |
| 17 | + |
| 18 | +#### Pro's |
| 19 | + |
| 20 | +- most popular option |
| 21 | +- supported by Python Packaging Authority |
| 22 | +- build tool of record for dbt-core & existing internal adapters |
| 23 | + |
| 24 | +#### Con's |
| 25 | + |
| 26 | +- less flexible; forced to support backwards compatibility more so than other options |
| 27 | +- no dependency management (manually add to `pyproject.toml`) |
| 28 | + |
| 29 | + |
| 30 | +### hatch |
| 31 | + |
| 32 | +#### Pro's |
| 33 | + |
| 34 | +- supported by Python Packaging Authority |
| 35 | +- already used by `dbt-semantic-layer` and `internal-actions` |
| 36 | +- supports running tests against multiple versions of python locally (same functionality as `tox`) |
| 37 | +- supports configuring workflows in `pyproject.toml` (same functionality as `make`) |
| 38 | +- incorporates new PEP's quickly |
| 39 | +- Manages python distributions itself without need of pyenv. This allows Windows and non-Windows users to both work locally in the same way. |
| 40 | +- used by black, tox, pipx, Jupyter Notebook, Datadog |
| 41 | + |
| 42 | +#### Con's |
| 43 | + |
| 44 | +- far less popular than other options |
| 45 | +- no dependency management (manually add to `pyproject.toml`) |
| 46 | +- only one maintainer (but is officially part of the larger PyPA working group) |
| 47 | +- Hatch does not allow for the installation of specific patch release versions of itself but rather only uses minor release granularity that tracks the latest patch release |
| 48 | + |
| 49 | + |
| 50 | +### poetry |
| 51 | + |
| 52 | +#### Pro's |
| 53 | + |
| 54 | +- second most popular option, similar in popularity to `setuptools` |
| 55 | +- dependency management (`poetry add "my-dependency"`) |
| 56 | +- provides a lock file |
| 57 | +- more than one maintainer |
| 58 | + |
| 59 | +#### Con's |
| 60 | + |
| 61 | +- incorporates new PEP's slowly |
| 62 | + |
| 63 | + |
| 64 | +## Decision |
| 65 | + |
| 66 | +#### Selected: `hatch` |
| 67 | + |
| 68 | +This option aligns with `dbt-adapter` and `dbt-semantic-layer`, which minimizes confusion |
| 69 | +for anyone working in multiple repositories. |
| 70 | +`hatch` also replaces `tox` and `make`, which consolidates our toolset to make working locally and with CI more consistant. |
| 71 | + |
| 72 | + |
| 73 | +## Consequences |
| 74 | + |
| 75 | +- [+] retire `tox` |
| 76 | +- [+] retire `make` |
| 77 | +- [+] rewriting the release workflows will create a more intuitive release for hatch projects |
| 78 | +- [-] we cannot reuse the existing release workflows |
| 79 | +- [-] write more detailed docs given lower familiarity |
| 80 | +- [-] learning curve |
0 commit comments