nixpkgs mirror (for testing) github.com/NixOS/nixpkgs
nix
at python-updates 110 lines 2.5 kB view raw
1{ 2 lib, 3 buildPythonPackage, 4 fetchFromGitHub, 5 writeScript, 6 7 # build-system 8 hatchling, 9 10 # dependencies 11 dbt-protos, 12 agate, 13 colorama, 14 deepdiff, 15 isodate, 16 jinja2, 17 jsonschema, 18 mashumaro, 19 pathspec, 20 protobuf, 21 python-dateutil, 22 requests, 23 typing-extensions, 24 25 # tests 26 pytestCheckHook, 27 pytest-mock, 28 pytest-xdist, 29}: 30 31buildPythonPackage rec { 32 pname = "dbt-common"; 33 version = "1.37.2-unstable-2026-01-22"; 34 pyproject = true; 35 36 src = fetchFromGitHub { 37 owner = "dbt-labs"; 38 repo = "dbt-common"; 39 rev = "5b331b9c50ca5fee959a9e4fa9ecca964549930c"; # They don't tag releases 40 hash = "sha256-OF4zKmKVHa9SdiQ1WRLvNoqQd3FWCUr5hK9ZYls9EsY="; 41 }; 42 43 build-system = [ hatchling ]; 44 45 pythonRelaxDeps = [ 46 "agate" 47 # 0.6.x -> 0.7.2 doesn't seem too risky at a glance 48 # https://pypi.org/project/isodate/0.7.2/ 49 "isodate" 50 ]; 51 52 dependencies = [ 53 dbt-protos 54 agate 55 colorama 56 deepdiff 57 isodate 58 jinja2 59 jsonschema 60 mashumaro 61 pathspec 62 protobuf 63 python-dateutil 64 requests 65 typing-extensions 66 ] 67 ++ mashumaro.optional-dependencies.msgpack; 68 69 nativeCheckInputs = [ 70 pytestCheckHook 71 pytest-xdist 72 pytest-mock 73 ]; 74 75 disabledTests = [ 76 # flaky test: https://github.com/dbt-labs/dbt-common/issues/280 77 "TestFindMatching" 78 ]; 79 80 pythonImportsCheck = [ "dbt_common" ]; 81 82 passthru.updateScript = writeScript "update-dbt-common" '' 83 #!/usr/bin/env nix-shell 84 #!nix-shell -i bash -p git common-updater-scripts perl 85 86 tmpdir="$(mktemp -d)" 87 git clone --depth=1 "${src.gitRepoUrl}" "$tmpdir" 88 89 pushd "$tmpdir" 90 91 newVersionNumber=$(perl -pe 's/version = "([\d.]+)"/$1/' dbt_common/__about__.py | tr -d '\n') 92 newRevision=$(git show -s --pretty='format:%H') 93 newDate=$(git show -s --pretty='format:%cs') 94 newVersion="$newVersionNumber-unstable-$newDate" 95 popd 96 97 rm -rf "$tmpdir" 98 update-source-version --rev="$newRevision" "python3Packages.dbt-common" "$newVersion" 99 perl -pe 's/^(.*version = ")([\d\.]+)(.*)$/''${1}'"''${newVersion}"'";/' \ 100 -i 'pkgs/development/python-modules/dbt-common/default.nix' 101 ''; 102 103 meta = { 104 description = "Shared common utilities for dbt-core and adapter implementations use"; 105 homepage = "https://github.com/dbt-labs/dbt-common"; 106 changelog = "https://github.com/dbt-labs/dbt-common/blob/main/CHANGELOG.md"; 107 license = lib.licenses.asl20; 108 maintainers = [ ]; 109 }; 110}