Skip to content

Commit

Permalink
Reformat core [CT-104 CT-105] (#4697)
Browse files Browse the repository at this point in the history
Reformatting dbt-core via black, flake8, mypy, and assorted pre-commit hooks.
  • Loading branch information
iknox-fa committed Feb 11, 2022
1 parent 41c6177 commit 43e3fc2
Show file tree
Hide file tree
Showing 2,222 changed files with 8,882 additions and 9,620 deletions.
4 changes: 2 additions & 2 deletions .bumpversion.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ parse = (?P<major>\d+)
((?P<prekind>a|b|rc)
(?P<pre>\d+) # pre-release version num
)?
serialize =
serialize =
{major}.{minor}.{patch}{prekind}{pre}
{major}.{minor}.{patch}
commit = False
Expand All @@ -15,7 +15,7 @@ tag = False
[bumpversion:part:prekind]
first_value = a
optional_value = final
values =
values =
a
b
rc
Expand Down
6 changes: 3 additions & 3 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# This file contains the code owners for the dbt-core repo.
# PRs will be automatically assigned for review to the associated
# PRs will be automatically assigned for review to the associated
# team(s) or person(s) that touches any files that are mapped to them.
#
# A statement takes precedence over the statements above it so more general
Expand All @@ -9,7 +9,7 @@
# Consult GitHub documentation for formatting guidelines:
# https://docs.github.com/en/repositories/managing-your-repositorys-settings-and-features/customizing-your-repository/about-code-owners#example-of-a-codeowners-file

# As a default for areas with no assignment,
# As a default for areas with no assignment,
# the core team as a whole will be assigned
* @dbt-labs/core

Expand Down Expand Up @@ -37,7 +37,7 @@
/core/dbt/include/global_project @dbt-labs/core-execution @dbt-labs/core-adapters

# Perf regression testing framework
# This excludes the test project files itself since those aren't specific
# This excludes the test project files itself since those aren't specific
# framework changes (excluded by not setting an owner next to it- no owner)
/performance @nathaniel-may
/performance/projects
6 changes: 3 additions & 3 deletions .github/actions/latest-wrangler/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Plug in the necessary inputs to determine if the container being built should be
| `package` | Name of the GH package to check against |
| `new_version` | Semver of new container |
| `gh_token` | GH token with package read scope|
| `halt_on_missing` | Return non-zero exit code if requested package does not exist. (defaults to false)|
| `halt_on_missing` | Return non-zero exit code if requested package does not exist. (defaults to false)|


## Outputs
Expand All @@ -21,7 +21,7 @@ Plug in the necessary inputs to determine if the container being built should be
## Example workflow
```yaml
name: Ship it!
on:
on:
workflow_dispatch:
inputs:
package:
Expand All @@ -47,4 +47,4 @@ jobs:
run: |
echo "Is it latest? Survey says: ${{ steps.is_latest.outputs.latest }} !"
echo "Is it minor.latest? Survey says: ${{ steps.is_latest.outputs.minor_latest }} !"
```
```
2 changes: 1 addition & 1 deletion .github/actions/latest-wrangler/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ inputs:
new_version:
description: "Semver of the container being built (I.E. 1.0.4)"
required: true
gh_token:
gh_token:
description: "Auth token for github (must have view packages scope)"
required: true
outputs:
Expand Down
4 changes: 2 additions & 2 deletions .github/actions/latest-wrangler/examples/example_workflow.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: Ship it!
on:
on:
workflow_dispatch:
inputs:
package:
Expand All @@ -23,4 +23,4 @@ jobs:
gh_token: ${{ secrets.GITHUB_TOKEN }}
- name: Print the results
run: |
echo "Is it latest? Survey says: ${{ steps.is_latest.outputs.latest }} !"
echo "Is it latest? Survey says: ${{ steps.is_latest.outputs.latest }} !"
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@
"version_number": "1.0.1",
"package": "dbt-redshift"
}
}
}
15 changes: 6 additions & 9 deletions .github/actions/latest-wrangler/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
# Log info if we don't get a 200
if package_request.status_code != 200:
print(f"Call to GH API failed: {package_request.status_code} {package_meta['message']}")

# Make an early exit if there is no matching package in github
if package_request.status_code == 404:
if halt_on_missing:
Expand All @@ -35,12 +35,11 @@
sys.exit(0)

# TODO: verify package meta is "correct"
# https://github.com/dbt-labs/dbt-core/issues/4640
# https://github.com/dbt-labs/dbt-core/issues/4640

# map versions and tags
version_tag_map = {
version["id"]: version["metadata"]["container"]["tags"]
for version in package_meta
version["id"]: version["metadata"]["container"]["tags"] for version in package_meta
}

# is pre-release
Expand All @@ -63,9 +62,7 @@
if f"{new_version.major}.{new_version.minor}.latest" in tags:
# Similar to above, only now we expect exactly two tags:
# major.minor.patch and major.minor.latest
current_minor_latest = parse(
[tag for tag in tags if "latest" not in tag][0]
)
current_minor_latest = parse([tag for tag in tags if "latest" not in tag][0])
else:
current_minor_latest = False

Expand All @@ -79,7 +76,8 @@ def is_latest(
:param pre_rel: Wether or not the version of the new container is a pre-release
:param new_version: The version of the new container
:param remote_latest: The version of the previously identified container that's already tagged latest or False
:param remote_latest: The version of the previously identified container that's
already tagged latest or False
"""
# is a pre-release = not latest
if pre_rel:
Expand All @@ -95,4 +93,3 @@ def is_latest(

print(f"::set-output name=latest::{latest}")
print(f"::set-output name=minor_latest::{minor_latest}")

2 changes: 1 addition & 1 deletion .github/workflows/backport.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# **what?**
# When a PR is merged, if it has the backport label, it will create
# When a PR is merged, if it has the backport label, it will create
# a new PR to backport those changes to the given branch. If it can't
# cleanly do a backport, it will comment on the merged PR of the failure.
#
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/jira-creation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ name: Jira Issue Creation
on:
issues:
types: [opened, labeled]

permissions:
issues: write

Expand Down
3 changes: 1 addition & 2 deletions .github/workflows/jira-label.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ name: Jira Label Mirroring
on:
issues:
types: [labeled, unlabeled]

permissions:
issues: read

Expand All @@ -24,4 +24,3 @@ jobs:
JIRA_BASE_URL: ${{ secrets.JIRA_BASE_URL }}
JIRA_USER_EMAIL: ${{ secrets.JIRA_USER_EMAIL }}
JIRA_API_TOKEN: ${{ secrets.JIRA_API_TOKEN }}

2 changes: 1 addition & 1 deletion .github/workflows/jira-transition.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,4 @@ jobs:
secrets:
JIRA_BASE_URL: ${{ secrets.JIRA_BASE_URL }}
JIRA_USER_EMAIL: ${{ secrets.JIRA_USER_EMAIL }}
JIRA_API_TOKEN: ${{ secrets.JIRA_API_TOKEN }}
JIRA_API_TOKEN: ${{ secrets.JIRA_API_TOKEN }}
12 changes: 6 additions & 6 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# **what?**
# Take the given commit, run unit tests specifically on that sha, build and
# Take the given commit, run unit tests specifically on that sha, build and
# package it, and then release to GitHub and PyPi with that specific build

# **why?**
Expand Down Expand Up @@ -144,7 +144,7 @@ jobs:
github-release:
name: GitHub Release
name: GitHub Release

needs: test-build

Expand All @@ -155,7 +155,7 @@ jobs:
with:
name: dist
path: '.'

# Need to set an output variable because env variables can't be taken as input
# This is needed for the next step with releasing to GitHub
- name: Find release type
Expand All @@ -179,7 +179,7 @@ jobs:
dbt_core-${{github.event.inputs.version_number}}-py3-none-any.whl
dbt-postgres-${{github.event.inputs.version_number}}.tar.gz
dbt-core-${{github.event.inputs.version_number}}.tar.gz
pypi-release:
name: Pypi release

Expand All @@ -188,12 +188,12 @@ jobs:
needs: github-release

environment: PypiProd
steps:
steps:
- uses: actions/download-artifact@v2
with:
name: dist
path: 'dist'

- name: Publish distribution to PyPI
uses: pypa/[email protected]
with:
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/release_docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
# Docker images for dbt are used in a number of important places throughout the dbt ecosystem. This is how we keep those images up-to-date.

# **when?**
# This is triggered manually
# This is triggered manually

# **next steps**
# - build this into the release workflow (or conversly, break out the different release methods into their own workflow files)
Expand Down Expand Up @@ -55,7 +55,7 @@ jobs:
name: Set up docker image builder
runs-on: ubuntu-latest
needs: [get_version_meta]
steps:
steps:
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1

Expand Down Expand Up @@ -110,4 +110,4 @@ jobs:
build-args: |
${{ steps.build_arg.outputs.build_arg_name }}_ref=${{ steps.build_arg.outputs.build_arg_value }}@v${{ github.event.inputs.version_number }}
tags: |
ghcr.io/dbt-labs/${{ github.event.inputs.package }}:latest
ghcr.io/dbt-labs/${{ github.event.inputs.package }}:latest
14 changes: 7 additions & 7 deletions .github/workflows/schema-check.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# **what?**
# Compares the schema of the dbt version of the given ref vs
# Compares the schema of the dbt version of the given ref vs
# the latest official schema releases found in schemas.getdbt.com.
# If there are differences, the workflow will fail and upload the
# diff as an artifact. The metadata team should be alerted to the change.
Expand Down Expand Up @@ -37,20 +37,20 @@ jobs:
uses: actions/setup-python@v2
with:
python-version: 3.8

- name: Checkout dbt repo
uses: actions/[email protected]
with:
path: ${{ env.DBT_REPO_DIRECTORY }}

- name: Checkout schemas.getdbt.com repo
uses: actions/[email protected]
with:
uses: actions/[email protected]
with:
repository: dbt-labs/schemas.getdbt.com
ref: 'main'
ssh-key: ${{ secrets.SCHEMA_SSH_PRIVATE_KEY }}
path: ${{ env.SCHEMA_REPO_DIRECTORY }}

- name: Generate current schema
run: |
cd ${{ env.DBT_REPO_DIRECTORY }}
Expand All @@ -59,7 +59,7 @@ jobs:
pip install --upgrade pip
pip install -r dev-requirements.txt -r editable-requirements.txt
python scripts/collect-artifact-schema.py --path ${{ env.LATEST_SCHEMA_PATH }}
# Copy generated schema files into the schemas.getdbt.com repo
# Do a git diff to find any changes
# Ignore any date or version changes though
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/structured-logging-schema-check.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# This Action checks makes a dbt run to sample json structured logs
# and checks that they conform to the currently documented schema.
#
#
# If this action fails it either means we have unintentionally deviated
# from our documented structured logging schema, or we need to bump the
# version of our structured logging and add new documentation to
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test/.actrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
-P ubuntu-latest=ghcr.io/catthehacker/ubuntu:act-latest
-P ubuntu-latest=ghcr.io/catthehacker/ubuntu:act-latest
2 changes: 1 addition & 1 deletion .github/workflows/test/.gitignore
Original file line number Diff line number Diff line change
@@ -1 +1 @@
.secrets
.secrets
2 changes: 1 addition & 1 deletion .github/workflows/test/.secrets.EXAMPLE
Original file line number Diff line number Diff line change
@@ -1 +1 @@
GITHUB_TOKEN=GH_PERSONAL_ACCESS_TOKEN_GOES_HERE
GITHUB_TOKEN=GH_PERSONAL_ACCESS_TOKEN_GOES_HERE
2 changes: 1 addition & 1 deletion .github/workflows/test/inputs/release_docker.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@
"version_number": "1.0.1",
"package": "dbt-postgres"
}
}
}
20 changes: 10 additions & 10 deletions .github/workflows/version-bump.yml
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
# **what?**
# This workflow will take a version number and a dry run flag. With that
# it will run versionbump to update the version number everywhere in the
# it will run versionbump to update the version number everywhere in the
# code base and then generate an update Docker requirements file. If this
# is a dry run, a draft PR will open with the changes. If this isn't a dry
# run, the changes will be committed to the branch this is run on.

# **why?**
# This is to aid in releasing dbt and making sure we have updated
# This is to aid in releasing dbt and making sure we have updated
# the versions and Docker requirements in all places.

# **when?**
# This is triggered either manually OR
# This is triggered either manually OR
# from the repository_dispatch event "version-bump" which is sent from
# the dbt-release repo Action

Expand All @@ -25,10 +25,10 @@ on:
is_dry_run:
description: 'Creates a draft PR to allow testing instead of committing to a branch'
required: true
default: 'true'
default: 'true'
repository_dispatch:
types: [version-bump]

jobs:
bump:
runs-on: ubuntu-latest
Expand Down Expand Up @@ -57,26 +57,26 @@ jobs:
run: |
python3 -m venv env
source env/bin/activate
pip install --upgrade pip
pip install --upgrade pip
- name: Create PR branch
if: ${{ steps.variables.outputs.IS_DRY_RUN == 'true' }}
run: |
git checkout -b bumping-version/${{steps.variables.outputs.VERSION_NUMBER}}_$GITHUB_RUN_ID
git push origin bumping-version/${{steps.variables.outputs.VERSION_NUMBER}}_$GITHUB_RUN_ID
git branch --set-upstream-to=origin/bumping-version/${{steps.variables.outputs.VERSION_NUMBER}}_$GITHUB_RUN_ID bumping-version/${{steps.variables.outputs.VERSION_NUMBER}}_$GITHUB_RUN_ID
# - name: Generate Docker requirements
# run: |
# source env/bin/activate
# pip install -r requirements.txt
# pip install -r requirements.txt
# pip freeze -l > docker/requirements/requirements.txt
# git status

- name: Bump version
run: |
source env/bin/activate
pip install -r dev-requirements.txt
pip install -r dev-requirements.txt
env/bin/bumpversion --allow-dirty --new-version ${{steps.variables.outputs.VERSION_NUMBER}} major
git status
Expand Down
Loading

0 comments on commit 43e3fc2

Please sign in to comment.