Skip to content

Commit

Permalink
Release 2.2.0 (#33)
Browse files Browse the repository at this point in the history
  • Loading branch information
NiallRees authored Apr 18, 2022
1 parent caba493 commit 267059e
Show file tree
Hide file tree
Showing 9 changed files with 126 additions and 101 deletions.
34 changes: 0 additions & 34 deletions .github/workflows/publish_dbtenv_dbt_alias_release_to_pypi.yml

This file was deleted.

34 changes: 0 additions & 34 deletions .github/workflows/publish_dbtenv_release_to_pypi.yml

This file was deleted.

63 changes: 63 additions & 0 deletions .github/workflows/publish_releases_to_pypi.yml
Original file line number Diff line number Diff line change
@@ -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/[email protected]
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/[email protected]
with:
password: ${{ secrets.PYPI_API_TOKEN }}
packages_dir: dbtenv-dbt-alias/dist

12 changes: 11 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,24 @@ 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

### Changed

### 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
Expand Down
35 changes: 23 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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 <args>` - 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`.
Expand Down Expand Up @@ -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

Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion dbtenv-dbt-alias/README.md
Original file line number Diff line number Diff line change
@@ -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 --'.
7 changes: 4 additions & 3 deletions dbtenv-dbt-alias/pyproject.toml
Original file line number Diff line number Diff line change
@@ -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. <[email protected]>"]
keywords = ["dbt"]
license = "Apache 2.0"
Expand All @@ -19,7 +19,7 @@ classifiers = [

[tool.poetry.dependencies]
python = ">=3.8"
dbtenv = ">=2.1.0"
dbtenv = "==2.1.0"

[tool.poetry.dev-dependencies]

Expand All @@ -29,4 +29,5 @@ build-backend = "poetry.core.masonry.api"

[tool.poetry.scripts]
# CLI declaration
dbtenv = "dbtenv.main:main"
dbt = "dbtenv.main:main"
35 changes: 23 additions & 12 deletions dbtenv/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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 <args>` - 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`.
Expand Down Expand Up @@ -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

Expand All @@ -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
Expand Down
5 changes: 1 addition & 4 deletions dbtenv/pyproject.toml
Original file line number Diff line number Diff line change
@@ -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. <[email protected]>"]
keywords = ["dbt"]
Expand All @@ -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"

0 comments on commit 267059e

Please sign in to comment.