Unverified Commit c4fd8927 authored by Michael Daniels's avatar Michael Daniels Committed by GitHub
Browse files

python3Packages.dbt-common: 1.28.0-unstable-2025-08-14 ->...

python3Packages.dbt-common: 1.28.0-unstable-2025-08-14 -> 1.36.0-unstable-2025-11-10; add updateScript (#444827)
parents 983f4cda b6244319
Loading
Loading
Loading
Loading
+26 −6
Original line number Diff line number Diff line
@@ -2,6 +2,7 @@
  lib,
  buildPythonPackage,
  fetchFromGitHub,
  writeScript,

  # build-system
  hatchling,
@@ -27,27 +28,25 @@
  pytest-xdist,
}:

buildPythonPackage {
buildPythonPackage rec {
  pname = "dbt-common";
  version = "1.28.0-unstable-2025-08-14";
  version = "1.36.0-unstable-2025-11-10";
  pyproject = true;

  src = fetchFromGitHub {
    owner = "dbt-labs";
    repo = "dbt-common";
    rev = "dd34e0a0565620863ff70c0b02421d84fcee8a02"; # They don't tag releases
    hash = "sha256-hG6S+IIAR3Cu69oFapQUVoCdaiEQYeMQ/ekBuAXxPrI=";
    rev = "e306773b935738838cedd52de762224330f9840e"; # They don't tag releases
    hash = "sha256-LuM9St90M7yGIqYJZTNLNYGZ1Dva2o2z3Q6ZPw4HP8g=";
  };

  build-system = [ hatchling ];

  pythonRelaxDeps = [
    "agate"
    "deepdiff"
    # 0.6.x -> 0.7.2 doesn't seem too risky at a glance
    # https://pypi.org/project/isodate/0.7.2/
    "isodate"
    "protobuf"
  ];

  dependencies = [
@@ -80,6 +79,27 @@ buildPythonPackage {

  pythonImportsCheck = [ "dbt_common" ];

  passthru.updateScript = writeScript "update-dbt-common" ''
    #!/usr/bin/env nix-shell
    #!nix-shell -i bash -p git common-updater-scripts perl

    tmpdir="$(mktemp -d)"
    git clone --depth=1 "${src.gitRepoUrl}" "$tmpdir"

    pushd "$tmpdir"

    newVersionNumber=$(perl -pe 's/version = "([\d.]+)"/$1/' dbt_common/__about__.py | tr -d '\n')
    newRevision=$(git show -s --pretty='format:%H')
    newDate=$(git show -s --pretty='format:%cs')
    newVersion="$newVersionNumber-unstable-$newDate"
    popd

    rm -rf "$tmpdir"
    update-source-version --rev="$newRevision" "python3Packages.dbt-common" "$newVersion"
    perl -pe 's/^(.*version = ")([\d\.]+)(.*)$/''${1}'"''${newVersion}"'";/' \
      -i 'pkgs/development/python-modules/dbt-common/default.nix'
  '';

  meta = {
    description = "Shared common utilities for dbt-core and adapter implementations use";
    homepage = "https://github.com/dbt-labs/dbt-common";