diff --git a/.github/workflows/publish_dbtenv_dbt_alias_release_to_pypi.yml b/.github/workflows/publish_dbtenv_dbt_alias_release_to_pypi.yml deleted file mode 100644 index 19c0f67..0000000 --- a/.github/workflows/publish_dbtenv_dbt_alias_release_to_pypi.yml +++ /dev/null @@ -1,34 +0,0 @@ -name: Publish dbtenv-dbt-alias release to PyPI - -on: - workflow_dispatch: - -jobs: - publish_package: - defaults: - run: - working-directory: dbtenv-dbt-alias - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - - uses: actions/setup-python@v2 - with: - python-version: '3.9' - - - name: Install dependencies - run: | - python -m pip install --upgrade pip - pip install poetry - - - name: Build package - run: python -m poetry build - - - name: ls - run: ls - - - name: Publish package - uses: pypa/gh-action-pypi-publish@v1.4.2 - with: - password: ${{ secrets.PYPI_API_TOKEN }} - packages_dir: dbtenv-dbt-alias/dist diff --git a/.github/workflows/publish_dbtenv_release_to_pypi.yml b/.github/workflows/publish_dbtenv_release_to_pypi.yml deleted file mode 100644 index d0f18ef..0000000 --- a/.github/workflows/publish_dbtenv_release_to_pypi.yml +++ /dev/null @@ -1,34 +0,0 @@ -name: Publish dbtenv release to PyPI - -on: - release: - types: - - published - workflow_dispatch: - -jobs: - publish_package: - defaults: - run: - working-directory: dbtenv - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - - uses: actions/setup-python@v2 - with: - python-version: '3.9' - - - name: Install dependencies - run: | - python -m pip install --upgrade pip - pip install poetry - - - name: Build package - run: python -m poetry build - - - name: Publish package - uses: pypa/gh-action-pypi-publish@v1.4.2 - with: - password: ${{ secrets.PYPI_API_TOKEN }} - packages_dir: dbtenv/dist diff --git a/.github/workflows/publish_releases_to_pypi.yml b/.github/workflows/publish_releases_to_pypi.yml new file mode 100644 index 0000000..5487e47 --- /dev/null +++ b/.github/workflows/publish_releases_to_pypi.yml @@ -0,0 +1,63 @@ +name: Publish dbtenv and dbtenv-dbt-alias releases to PyPI + +on: + release: + types: + - published + workflow_dispatch: + +jobs: + publish_dbtenv_package: + defaults: + run: + working-directory: dbtenv + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + + - uses: actions/setup-python@v2 + with: + python-version: '3.9' + + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install poetry + + - name: Build package + run: python -m poetry build + + - name: Publish package + uses: pypa/gh-action-pypi-publish@v1.4.2 + with: + password: ${{ secrets.PYPI_API_TOKEN }} + packages_dir: dbtenv/dist + publish_dbtenv_dbt_alias_package: + defaults: + run: + working-directory: dbtenv-dbt-alias + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + + - uses: actions/setup-python@v2 + with: + python-version: '3.9' + + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install poetry + + - name: Build package + run: python -m poetry build + + - name: ls + run: ls + + - name: Publish package + uses: pypa/gh-action-pypi-publish@v1.4.2 + with: + password: ${{ secrets.PYPI_API_TOKEN }} + packages_dir: dbtenv-dbt-alias/dist + diff --git a/CHANGELOG.md b/CHANGELOG.md index 3402b6c..0c5c460 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,7 +5,7 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). -## [Unreleased](https://github.com/brooklyn-data/dbtenv/compare/v2.1.0...HEAD) +## [Unreleased](https://github.com/brooklyn-data/dbtenv/compare/v2.2.0...HEAD) ### Added @@ -13,6 +13,16 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Fixed +## [2.2.0](https://github.com/brooklyn-data/dbtenv/compare/v2.1.0...v2.2.0) + +### Added + +### Changed +- Removed `dbtenv[dbt-alias]` extra. Instead, install `dbtenv-dbt-alias` directly. `dbtenv-dbt-alias` is identical to `dbtenv`, with the exception of adding a `dbt` entry point. The `dbt` command then acts as a direct shortcut to `dbtenv execute --`, and means that dbtenv can used as a drop-in replacement to installing dbt normally. +- `dbtenv-dbt-alias` package is now versioned identically to `dbtenv`. + +### Fixed + ## [2.1.0](https://github.com/brooklyn-data/dbtenv/compare/v2.0.0...v2.1.0) ### Added diff --git a/README.md b/README.md index 8072161..94e77b2 100644 --- a/README.md +++ b/README.md @@ -6,24 +6,31 @@ dbtenv is a version manager for dbt, automatically installing and switching to t ### Installation 1. Install [pipx](https://pypa.github.io/pipx/) ([What is pipx?](https://www.google.com/search?q=pipx&rlz=1C5GCEM_enGB953GB953&oq=Pipx&aqs=chrome.0.69i59i512j0i512l2j69i59j0i512l2j69i60l2.1010j0j7&sourceid=chrome&ie=UTF-8)). -2. Run `pipx install dbtenv[dbt-alias]`. +2. Run `pipx install dbtenv-dbt-alias` ### Usage -If the `dbt-alias` extra is used (`dbtenv[dbt-alias]`), dbt commands can be used as normal and will be routed through dbtenv. dbtenv will automatically determine, install and use the required dbt adapter and version. +If `dbtenv-dbt-alias` is installed per the above, dbt commands can be used as normal and will be routed through dbtenv. dbtenv will automatically determine, install and use the required dbt adapter and version. Illustrative example ``` -dbt --version +➜ dev/dbt_project ✗ dbt compile dbtenv info: Using dbt-bigquery==1.0.0 (set by dbt_project.yml). -installed version: 1.0.4 - latest version: 1.0.4 +10:48:43 Running with dbt=1.0.4 -Up to date! - -Plugins: - - bigquery: 1.0.0 - Up to date! +10:48:45 Found 73 models, 142 tests, 2 snapshots, 0 analyses, 383 macros, 0 operations, 0 seed files, 44 sources, 0 exposures, 0 metrics +10:48:45 +10:49:14 Concurrency: 1 threads (target='dev') +10:49:14 +10:49:20 Done. ``` +## Installation Options + +There are two packages available for installation: +- `dbtenv` +- `dbtenv-dbt-alias` + +`dbtenv-dbt-alias` is identical to `dbtenv`, with the exception of adding a `dbt` entry point. The `dbt` command then acts as a direct shortcut to `dbtenv execute --`, and means that dbtenv can used as a drop-in replacement to installing dbt normally. ## Available Commands @@ -35,6 +42,10 @@ Plugins: - `dbtenv which` - Print the full path to the executable of the dbt version dbtenv determines automatically for the current environment. - `dbtenv execute` - Execute a dbt command. +If `dbtenv-dbt-alias` is installed: +- All the above plus: +- `dbt ` - The dbt CLI. + ## dbt Version Management dbtenv will automatically install the required version of dbt for the current project by default. To disable this behaviour, set the environment variable `DBTENV_AUTO_INSTALL` to `false`. @@ -69,9 +80,9 @@ You can: ## Running dbt through dbtenv -### dbt-alias +### If dbtenv-dbt-alias installed -The `dbtenv-dbt-alias` package creates an entrypoint for the `dbt` command to route through dbtenv. The package is installable using the `[dbt-alias]` extra when installing dbtenv. The `dbt` command then acts as a direct shortcut to `dbtenv execute --`, and means that dbtenv can used as a drop-in replacement to installing dbt normally. +The `dbt` command then acts as a direct shortcut to `dbtenv execute --`, and means that dbtenv can used as a drop-in replacement to installing dbt normally. dbtenv will automatically identify which package and version of dbt to use. If you need to manually specify a dbt package version to run with, use the `dbtenv execute` command. ### dbtenv execute @@ -81,7 +92,7 @@ For example: - `dbtenv execute -- run` will execute `dbt run` using the version determined automatically from the current environment. - `dbtenv execute --dbt 1.0.0 -- run` will execute `dbt run` using dbt 1.0.0, automatically detecting the required adapter from the default target in `profiles.yml`. - `dbtenv execute --dbt 1.0.0 -- run --target prod` will execute `dbt run` using dbt 1.0.0, using the required adapter for the 'prod' target in `profiles.yml`. -- `dbtenv execute --dbt 1.0.0==dbt-bigquery -- run` will execute `dbt run` using dbt-bigquery==1.0.0. +- `dbtenv execute --dbt dbt-bigquery==1.0.0 -- run` will execute `dbt run` using dbt-bigquery==1.0.0. ## Development diff --git a/dbtenv-dbt-alias/README.md b/dbtenv-dbt-alias/README.md index 66a557e..da4a467 100644 --- a/dbtenv-dbt-alias/README.md +++ b/dbtenv-dbt-alias/README.md @@ -1,3 +1,3 @@ # dbtenv-dbt-alias -Installs a 'dbt' executable that is functionally equivalent to aliasing the dbt command to `dbtenv execute --`. +dbtenv, but additionally installs a 'dbt' executable that is functionally equivalent to aliasing the dbt command to 'dbtenv execute --'. diff --git a/dbtenv-dbt-alias/pyproject.toml b/dbtenv-dbt-alias/pyproject.toml index 7f2676c..bb99190 100644 --- a/dbtenv-dbt-alias/pyproject.toml +++ b/dbtenv-dbt-alias/pyproject.toml @@ -1,7 +1,7 @@ [tool.poetry] name = "dbtenv-dbt-alias" -version = "1.0.0" -description = "Routes dbt commands through dbtenv." +version = "2.2.0" +description = "dbtenv, but additionally installs a 'dbt' executable that is functionally equivalent to aliasing the dbt command to 'dbtenv execute --'." authors = ["Brooklyn Data Co. "] keywords = ["dbt"] license = "Apache 2.0" @@ -19,7 +19,7 @@ classifiers = [ [tool.poetry.dependencies] python = ">=3.8" -dbtenv = ">=2.1.0" +dbtenv = "==2.1.0" [tool.poetry.dev-dependencies] @@ -29,4 +29,5 @@ build-backend = "poetry.core.masonry.api" [tool.poetry.scripts] # CLI declaration +dbtenv = "dbtenv.main:main" dbt = "dbtenv.main:main" diff --git a/dbtenv/README.md b/dbtenv/README.md index 8072161..94e77b2 100644 --- a/dbtenv/README.md +++ b/dbtenv/README.md @@ -6,24 +6,31 @@ dbtenv is a version manager for dbt, automatically installing and switching to t ### Installation 1. Install [pipx](https://pypa.github.io/pipx/) ([What is pipx?](https://www.google.com/search?q=pipx&rlz=1C5GCEM_enGB953GB953&oq=Pipx&aqs=chrome.0.69i59i512j0i512l2j69i59j0i512l2j69i60l2.1010j0j7&sourceid=chrome&ie=UTF-8)). -2. Run `pipx install dbtenv[dbt-alias]`. +2. Run `pipx install dbtenv-dbt-alias` ### Usage -If the `dbt-alias` extra is used (`dbtenv[dbt-alias]`), dbt commands can be used as normal and will be routed through dbtenv. dbtenv will automatically determine, install and use the required dbt adapter and version. +If `dbtenv-dbt-alias` is installed per the above, dbt commands can be used as normal and will be routed through dbtenv. dbtenv will automatically determine, install and use the required dbt adapter and version. Illustrative example ``` -dbt --version +➜ dev/dbt_project ✗ dbt compile dbtenv info: Using dbt-bigquery==1.0.0 (set by dbt_project.yml). -installed version: 1.0.4 - latest version: 1.0.4 +10:48:43 Running with dbt=1.0.4 -Up to date! - -Plugins: - - bigquery: 1.0.0 - Up to date! +10:48:45 Found 73 models, 142 tests, 2 snapshots, 0 analyses, 383 macros, 0 operations, 0 seed files, 44 sources, 0 exposures, 0 metrics +10:48:45 +10:49:14 Concurrency: 1 threads (target='dev') +10:49:14 +10:49:20 Done. ``` +## Installation Options + +There are two packages available for installation: +- `dbtenv` +- `dbtenv-dbt-alias` + +`dbtenv-dbt-alias` is identical to `dbtenv`, with the exception of adding a `dbt` entry point. The `dbt` command then acts as a direct shortcut to `dbtenv execute --`, and means that dbtenv can used as a drop-in replacement to installing dbt normally. ## Available Commands @@ -35,6 +42,10 @@ Plugins: - `dbtenv which` - Print the full path to the executable of the dbt version dbtenv determines automatically for the current environment. - `dbtenv execute` - Execute a dbt command. +If `dbtenv-dbt-alias` is installed: +- All the above plus: +- `dbt ` - The dbt CLI. + ## dbt Version Management dbtenv will automatically install the required version of dbt for the current project by default. To disable this behaviour, set the environment variable `DBTENV_AUTO_INSTALL` to `false`. @@ -69,9 +80,9 @@ You can: ## Running dbt through dbtenv -### dbt-alias +### If dbtenv-dbt-alias installed -The `dbtenv-dbt-alias` package creates an entrypoint for the `dbt` command to route through dbtenv. The package is installable using the `[dbt-alias]` extra when installing dbtenv. The `dbt` command then acts as a direct shortcut to `dbtenv execute --`, and means that dbtenv can used as a drop-in replacement to installing dbt normally. +The `dbt` command then acts as a direct shortcut to `dbtenv execute --`, and means that dbtenv can used as a drop-in replacement to installing dbt normally. dbtenv will automatically identify which package and version of dbt to use. If you need to manually specify a dbt package version to run with, use the `dbtenv execute` command. ### dbtenv execute @@ -81,7 +92,7 @@ For example: - `dbtenv execute -- run` will execute `dbt run` using the version determined automatically from the current environment. - `dbtenv execute --dbt 1.0.0 -- run` will execute `dbt run` using dbt 1.0.0, automatically detecting the required adapter from the default target in `profiles.yml`. - `dbtenv execute --dbt 1.0.0 -- run --target prod` will execute `dbt run` using dbt 1.0.0, using the required adapter for the 'prod' target in `profiles.yml`. -- `dbtenv execute --dbt 1.0.0==dbt-bigquery -- run` will execute `dbt run` using dbt-bigquery==1.0.0. +- `dbtenv execute --dbt dbt-bigquery==1.0.0 -- run` will execute `dbt run` using dbt-bigquery==1.0.0. ## Development diff --git a/dbtenv/pyproject.toml b/dbtenv/pyproject.toml index d947139..4101652 100644 --- a/dbtenv/pyproject.toml +++ b/dbtenv/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "dbtenv" -version = "2.1.0" +version = "2.2.0" description = "dbtenv is a version manager for dbt, automatically installing and switching to the needed adapter and version of dbt." authors = ["Brooklyn Data Co. "] keywords = ["dbt"] @@ -27,9 +27,6 @@ PyYAML = "^6.0" requires = ["poetry-core>=1.0.0"] build-backend = "poetry.core.masonry.api" -[tool.poetry.extras] -dbt-alias = ["dbtenv-dbt-alias"] - [tool.poetry.scripts] # CLI declaration dbtenv = "dbtenv.main:main"