Skip to content

Commit

Permalink
ADAP-1123: Create the package subdirectory (#176)
Browse files Browse the repository at this point in the history
  • Loading branch information
mikealfare authored Dec 11, 2024
1 parent ae48e67 commit 3798eb1
Show file tree
Hide file tree
Showing 267 changed files with 146 additions and 124 deletions.
8 changes: 2 additions & 6 deletions .github/workflows/changelog-entry-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,7 @@ permissions:

jobs:
changelog-entry-check:
uses: dbt-labs/actions/.github/workflows/changelog-existence.yml@main
uses: dbt-labs/dbt-adapters/.github/workflows/_changelog-entry-check.yml@main
with:
changelog_comment: >-
Thank you for your pull request! We could not find a changelog entry for this change.
For details on how to document a change, see the
[dbt-postgres contributing guide](https://github.com/dbt-labs/dbt-postgres/blob/main/CONTRIBUTING.md).
skip_label: "Skip Changelog"
pull-request: ${{ github.event.pull_request.number }}
secrets: inherit
4 changes: 3 additions & 1 deletion .github/workflows/code-quality.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,13 @@ jobs:
- name: Update Adapters and Core branches
if: ${{ contains(github.event_name, 'workflow_') }}
shell: bash
run: ./.github/scripts/update_dev_packages.sh ${{ inputs.dbt_adapters_branch }} "main"
run: scripts/update_dev_packages.sh ${{ inputs.dbt_adapters_branch }} "main"
working-directory: ./dbt-postgres

- name: Setup `hatch`
uses: dbt-labs/dbt-adapters/.github/actions/setup-hatch@main

- name: Run code quality
shell: bash
run: hatch run code-quality
working-directory: ./dbt-postgres
17 changes: 12 additions & 5 deletions .github/workflows/integration-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -111,14 +111,16 @@ jobs:
- name: Update Adapters and Core branches
if: ${{ github.event_name == 'workflow_call' || github.event_name == 'workflow_dispatch'}}
run: |
./.github/scripts/update_dev_dependency_branches.sh \
scripts/update_dev_dependency_branches.sh \
${{ inputs.dbt_adapters_branch }} \
${{ inputs.dbt_core_branch }} \
${{ inputs.dbt_common_branch }}
cat pyproject.toml
working-directory: ./dbt-postgres

- name: Setup postgres
run: psql -f ./scripts/setup_test_database.sql
working-directory: ./dbt-postgres
env:
PGHOST: localhost
PGPORT: 5432
Expand All @@ -133,6 +135,7 @@ jobs:

- name: Run integration tests
run: hatch run integration-tests
working-directory: ./dbt-postgres
env:
POSTGRES_TEST_HOST: localhost
POSTGRES_TEST_PORT: 5432
Expand Down Expand Up @@ -164,25 +167,29 @@ jobs:
brew install postgresql
- name: "Test psycopg2 name - default"
run: .github/scripts/psycopg2-check.sh
run: scripts/psycopg2-check.sh
working-directory: ./dbt-postgres
env:
PSYCOPG2_EXPECTED_NAME: psycopg2-binary

- name: "Test psycopg2 name - invalid override"
run: .github/scripts/psycopg2-check.sh
run: scripts/psycopg2-check.sh
working-directory: ./dbt-postgres
env:
DBT_PSYCOPG2_NAME: rubber-baby-buggy-bumpers
PSYCOPG2_EXPECTED_NAME: psycopg2-binary

- name: "Test psycopg2 name - override"
run: .github/scripts/psycopg2-check.sh
run: scripts/psycopg2-check.sh
working-directory: ./dbt-postgres
env:
DBT_PSYCOPG2_NAME: psycopg2
PSYCOPG2_EXPECTED_NAME: psycopg2-binary # we have not implemented the hook yet, so this doesn't work

- name: "Test psycopg2 name - manual override"
# verify that the workaround documented in the `README.md` continues to work
run: .github/scripts/psycopg2-check.sh
run: scripts/psycopg2-check.sh
working-directory: ./dbt-postgres
env:
PSYCOPG2_WORKAROUND: true
PSYCOPG2_EXPECTED_NAME: psycopg2
7 changes: 6 additions & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,15 @@ concurrency:
group: "${{ github.workflow }}-${{ github.event_name }}-${{ inputs.version }}-${{ inputs.deploy-to }}"
cancel-in-progress: true

defaults:
run:
shell: bash
working-directory: ./dbt-postgres

jobs:
release-prep:
name: "Release prep: generate changelog, bump version"
uses: dbt-labs/dbt-postgres/.github/workflows/release_prep_hatch.yml@main
uses: ./.github/workflows/release_prep_hatch.yml
with:
branch: ${{ inputs.branch }}
version: ${{ inputs.version }}
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/unit-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,3 +39,4 @@ jobs:
- name: Run unit tests
run: hatch run unit-tests
shell: bash
working-directory: ./dbt-postgres
5 changes: 5 additions & 0 deletions .github/workflows/version-bump.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,11 @@ on:
description: 'The version number to bump to (ex. 1.2.0, 1.3.0b1)'
required: true

defaults:
run:
shell: bash
working-directory: ./dbt-postgres

jobs:
version_bump_and_changie:
uses: dbt-labs/actions/.github/workflows/version-bump.yml@main
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
kind: Under the Hood
body: Migrate to a monorepo in dbt-adapters
time: 2024-12-01T12:22:44.407931-05:00
custom:
Author: mikealfare
Issue: "176"
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
62 changes: 62 additions & 0 deletions dbt-postgres/hatch.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
[version]
path = "src/dbt/adapters/postgres/__version__.py"

[build.targets.sdist]
packages = ["src/dbt/adapters", "src/dbt/include"]
sources = ["src"]

[build.targets.wheel]
packages = ["src/dbt/adapters", "src/dbt/include"]
sources = ["src"]

[envs.default]
dependencies = [
"dbt-adapters @ git+https://github.com/dbt-labs/dbt-adapters.git",
"dbt-common @ git+https://github.com/dbt-labs/dbt-common.git",
"dbt-tests-adapter @ git+https://github.com/dbt-labs/dbt-adapters.git#subdirectory=dbt-tests-adapter",
"dbt-core @ git+https://github.com/dbt-labs/dbt-core.git#subdirectory=core",
"pre-commit==3.7.0",
"freezegun",
"pytest",
"pytest-dotenv",
"pytest-mock",
"pytest-xdist",
]
[envs.default.env-vars]
DBT_TEST_USER_1 = "dbt_test_user_1"
DBT_TEST_USER_2 = "dbt_test_user_2"
DBT_TEST_USER_3 = "dbt_test_user_3"
[envs.default.scripts]
setup = "pre-commit install"
code-quality = "pre-commit run --all-files"
unit-tests = "python -m pytest {args:tests/unit}"
integration-tests = "python -m pytest {args:tests/functional}"
docker-dev = [
"echo Does not support integration testing, only development and unit testing. See issue https://github.com/dbt-labs/dbt-postgres/issues/99",
"docker build -f docker/dev.Dockerfile -t dbt-postgres-dev .",
"docker run --rm -it --name dbt-postgres-dev -v $(pwd):/opt/code dbt-postgres-dev",
]
docker-prod = "docker build -f docker/Dockerfile -t dbt-postgres ."

[envs.build]
detached = true
dependencies = [
"wheel",
"twine",
"check-wheel-contents",
]
[envs.build.scripts]
check-all = [
"- check-wheel",
"- check-sdist",
]
check-wheel = [
"twine check dist/*",
"find ./dist/dbt_postgres-*.whl -maxdepth 1 -type f | xargs python -m pip install --force-reinstall --find-links=dist/",
"pip freeze | grep dbt-postgres",
]
check-sdist = [
"check-wheel-contents dist/*.whl --ignore W007,W008",
"find ./dist/dbt_postgres-*.gz -maxdepth 1 -type f | xargs python -m pip install --force-reinstall --find-links=dist/",
"pip freeze | grep dbt-postgres",
]
49 changes: 49 additions & 0 deletions dbt-postgres/pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
[build-system]
requires = ["hatchling"]
build-backend = "hatchling.build"

[project]
dynamic = ["version"]
name = "dbt-postgres"
description = "The set of adapter protocols and base functionality that supports integration with dbt-core"
readme = "README.md"
keywords = ["dbt", "adapter", "adapters", "database", "elt", "dbt-core", "dbt Core", "dbt Cloud", "dbt Labs", "postgres"]
requires-python = ">=3.9.0"
authors = [
{ name = "dbt Labs", email = "[email protected]" },
]
maintainers = [
{ name = "dbt Labs", email = "[email protected]" },
]
classifiers = [
"Development Status :: 5 - Production/Stable",
"License :: OSI Approved :: Apache Software License",
"Operating System :: MacOS :: MacOS X",
"Operating System :: Microsoft :: Windows",
"Operating System :: POSIX :: Linux",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
]
dependencies = [
"psycopg2-binary>=2.9,<3.0",
"dbt-adapters>=1.7.0,<2.0",
# add dbt-core to ensure backwards compatibility of installation, this is not a functional dependency
"dbt-core>=1.8.0",
# installed via dbt-adapters but used directly
"dbt-common>=1.0.4,<2.0",
"agate>=1.0,<2.0",
]
[project.urls]
Homepage = "https://github.com/dbt-labs/dbt-postgres"
Documentation = "https://docs.getdbt.com"
Repository = "https://github.com/dbt-labs/dbt-postgres.git"
Issues = "https://github.com/dbt-labs/dbt-postgres/issues"
Changelog = "https://github.com/dbt-labs/dbt-postgres/blob/main/CHANGELOG.md"

[tool.pytest]
testpaths = [
"tests/functional",
"tests/unit",
]
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
111 changes: 0 additions & 111 deletions pyproject.toml

This file was deleted.

0 comments on commit 3798eb1

Please sign in to comment.