Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 0 additions & 7 deletions .flake8

This file was deleted.

38 changes: 23 additions & 15 deletions .github/workflows/ci_pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ on:
pull_request:
branches: [ main ]

permissions: read-all

jobs:
build-and-test:
runs-on: ${{ matrix.os }}
Expand All @@ -13,37 +15,43 @@ jobs:
python-version: ["3.9", "3.10", "3.11", "3.12"]

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}

- name: Install dependencies
run: |
pip install "poetry~=1.6.1"
poetry config installer.max-workers 1 # fix ChefBuildError
poetry config virtualenvs.in-project true
- name: Install uv
uses: astral-sh/setup-uv@v3

- name: Cache the virtualenv
uses: actions/cache@v2
- name: Cache UV dependencies
uses: actions/cache@v4
with:
path: ./.venv
key: ${{ runner.os }}-${{ matrix.python-version }}-venv-${{ hashFiles('**/poetry.lock') }}
path: ~/.cache/uv
key: ${{ runner.os }}-${{ matrix.python-version }}-uv-${{ hashFiles('**/pyproject.toml') }}
restore-keys: |
${{ runner.os }}-${{ matrix.python-version }}-uv-

- name: Install dependencies
run: |
poetry install
uv venv
uv sync --all-extras

- name: Code quality
run: |
poetry run poe lint
uv run poe lint

- name: Run tests
run: |
poetry run poe test-cov
uv run poe test-cov

- name: Generate coverage report
run: |
uv run coverage xml -o coverage.xml

- name: Upload coverage to Codecov
uses: codecov/codecov-action@v2
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
file: ./coverage.xml
fail_ci_if_error: true
31 changes: 22 additions & 9 deletions .github/workflows/codecov.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ on:
types: [published]
workflow_dispatch:

permissions: read-all

jobs:
build-and-test:
runs-on: ${{ matrix.os }}
Expand All @@ -14,26 +16,37 @@ jobs:
python-version: ["3.9"]

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}

- name: Install dependencies
run: |
pip install poetry
poetry config virtualenvs.in-project true
- name: Install uv
uses: astral-sh/setup-uv@v3

- name: Install dependencies
run: |
poetry install
uv pip install -e .
uv pip install --dev

- name: Cache the dependencies
uses: actions/cache@v4
with:
path: ~/.cache/uv
key: ${{ runner.os }}-${{ matrix.python-version }}-uv-${{ hashFiles('**/pyproject.toml') }}

- name: Run tests
run: |
poetry run poe test-cov
uv run poe test-cov

- name: Generate coverage report
run: |
uv run coverage xml -o coverage.xml

- name: Upload coverage to Codecov
uses: codecov/codecov-action@v2
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
file: ./coverage.xml
fail_ci_if_error: true
30 changes: 22 additions & 8 deletions .github/workflows/publish-docs-beta.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,15 @@ on:
- true
- false

permissions:
contents: write

jobs:
build:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
fetch-depth: 0
submodules: recursive
Expand All @@ -30,15 +33,26 @@ jobs:
key: ${{ github.ref }}
path: .cache

- uses: abatilo/actions-poetry@v2
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.9'

- name: Install uv
uses: astral-sh/setup-uv@v3

- name: Cache UV dependencies
uses: actions/cache@v4
with:
poetry-version: 1.6.1
path: ~/.cache/uv
key: ubuntu-3.9-uv-${{ hashFiles('**/pyproject.toml') }}
restore-keys: |
ubuntu-3.9-uv-

- name: Install dependencies
run: |
poetry config installer.max-workers 1
poetry config virtualenvs.in-project true
poetry install
uv venv
uv sync --all-extras

- name: Configure Git user
run: |
Expand All @@ -48,9 +62,9 @@ jobs:
- name: Publish site version (non-stable)
if: ${{ inputs.delete == 'false' }}
run: |
poetry run mike deploy --push --update-aliases ${{ inputs.version }}
uv run mike deploy --push --update-aliases ${{ inputs.version }}

- name: Delete site version
if: ${{ inputs.delete == 'true' }}
run: |
poetry run mike delete --push ${{ inputs.version }}
uv run mike delete --push ${{ inputs.version }}
28 changes: 21 additions & 7 deletions .github/workflows/publish-docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,15 @@ on:
description: Document version e.g. 1.1, 1.2
required: true

permissions:
contents: write

jobs:
build:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
fetch-depth: 0
submodules: recursive
Expand All @@ -22,15 +25,26 @@ jobs:
key: ${{ github.ref }}
path: .cache

- uses: abatilo/actions-poetry@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.9'

- name: Install uv
uses: astral-sh/setup-uv@v3

- name: Cache UV dependencies
uses: actions/cache@v4
with:
poetry-version: 1.7.1
path: ~/.cache/uv
key: ubuntu-3.9-uv-${{ hashFiles('**/pyproject.toml') }}
restore-keys: |
ubuntu-3.9-uv-

- name: Install dependencies
run: |
poetry config installer.max-workers 1
poetry config virtualenvs.in-project true
poetry install
uv venv
uv sync --all-extras

- name: Configure Git user
run: |
Expand All @@ -39,4 +53,4 @@ jobs:

- name: Publish site
run: |
poetry run mike deploy --push --update-aliases ${{ inputs.version }} latest
uv run mike deploy --push --update-aliases ${{ inputs.version }} latest
57 changes: 42 additions & 15 deletions .github/workflows/pypi-publish.yml
Original file line number Diff line number Diff line change
@@ -1,26 +1,53 @@
name: Publish PYPI

on:
workflow_dispatch:
inputs:
deploy-to:
type: choice
description: Choose where to publish (test/prod)
options:
- PypiProd
- PypiTest
default: PypiTest
release:
types: [created]

permissions: read-all

jobs:
deploy:

name: PyPI - ${{ inputs.deploy-to || 'PypiProd' }}
runs-on: ubuntu-latest
permissions:
id-token: write

steps:
- uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.x'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install poetry
- name: Build and publish
run: |
poetry version $(git describe --tags --abbrev=0)
poetry build
poetry publish --username ${{ secrets.PYPI_USERNAME }} --password ${{ secrets.PYPI_PASSWORD }}
- name: Check out repository
uses: actions/checkout@v4
with:
persist-credentials: false

- name: Install uv
uses: astral-sh/setup-uv@v3

- name: Cache UV dependencies
uses: actions/cache@v4
with:
path: ~/.cache/uv
key: ubuntu-publish-uv-${{ hashFiles('**/pyproject.toml') }}
restore-keys: |
ubuntu-publish-uv-

- name: Build artifacts
run: uv build

- name: Publish artifacts to PyPI Test
if: inputs.deploy-to == 'PypiTest'
uses: pypa/gh-action-pypi-publish@release/v1
with:
repository-url: https://test.pypi.org/legacy/

- name: Publish artifacts to PyPI Prod
if: inputs.deploy-to == 'PypiProd' || github.event_name == 'push'
uses: pypa/gh-action-pypi-publish@release/v1
15 changes: 15 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
/samples/local
CHANGELOG.md
/dbt_packages
/.claude

# Byte-compiled / optimized / DLL files
__pycache__/
Expand Down Expand Up @@ -133,3 +134,17 @@ dmypy.json

# Pyre type checker
.pyre/

# uv specific
.uv/
.pdm-build/
__pypackages__/
.pdm-python
.ruff_cache/
requirements.txt

# Editor specific
.vscode/
.idea/
*.swp
*.swo
9 changes: 5 additions & 4 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,9 @@ repos:
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- repo: https://github.com/pycqa/flake8
rev: 5.0.4
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.2.0
hooks:
- id: flake8
args: ['--config=.flake8']
- id: ruff
args: [--fix]
- id: ruff-format
11 changes: 11 additions & 0 deletions dbterd/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
"""dbterd package initialization."""

import warnings


# Suppress the pydantic warning from the dbt-artifacts-parser dependency
warnings.filterwarnings(
"ignore",
message=r"Field \"model_unique_id\" in (ParsedMetric|Metric) has conflict with protected namespace \"model_\"",
module="pydantic",
)
1 change: 1 addition & 0 deletions dbterd/__main__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
from dbterd import main


main.main()
Loading