Unverified Commit 1db78866 authored by Nick Cao's avatar Nick Cao Committed by GitHub
Browse files

python312Packages.google-cloud-bigquery: cleanup, fix (#400528)

parents bfe9c696 ca33c51d
Loading
Loading
Loading
Loading
+18 −12
Original line number Diff line number Diff line
{
  lib,
  agate,
  buildPythonPackage,
  fetchFromGitHub,

  # build-system
  setuptools,

  # dependencies
  agate,
  dbt-adapters,
  dbt-common,
  dbt-core,
  fetchFromGitHub,
  google-cloud-bigquery,
  google-cloud-dataproc,
  google-cloud-storage,

  # tests
  pytestCheckHook,
  pythonOlder,
  setuptools,
}:

buildPythonPackage rec {
@@ -19,8 +24,6 @@ buildPythonPackage rec {
  version = "1.9.1";
  pyproject = true;

  disabled = pythonOlder "3.8";

  src = fetchFromGitHub {
    owner = "dbt-labs";
    repo = "dbt-bigquery";
@@ -28,7 +31,10 @@ buildPythonPackage rec {
    hash = "sha256-YZA8lcUGoq5jMNS1GlbBd036X2F3khsZWr5Pv65zpPI=";
  };

  pythonRelaxDeps = [ "agate" ];
  pythonRelaxDeps = [
    "agate"
    "google-cloud-storage"
  ];

  build-system = [
    setuptools
@@ -36,12 +42,12 @@ buildPythonPackage rec {

  dependencies = [
    agate
    dbt-common
    dbt-adapters
    dbt-common
    dbt-core
    google-cloud-bigquery
    google-cloud-storage
    google-cloud-dataproc
    google-cloud-storage
  ];

  nativeCheckInputs = [ pytestCheckHook ];
@@ -50,11 +56,11 @@ buildPythonPackage rec {

  pythonImportsCheck = [ "dbt.adapters.bigquery" ];

  meta = with lib; {
  meta = {
    description = "Plugin enabling dbt to operate on a BigQuery database";
    homepage = "https://github.com/dbt-labs/dbt-bigquery";
    changelog = "https://github.com/dbt-labs/dbt-bigquery/blob/${version}/CHANGELOG.md";
    license = licenses.asl20;
    maintainers = with maintainers; [ tjni ];
    license = lib.licenses.asl20;
    maintainers = with lib.maintainers; [ tjni ];
  };
}
+10 −13
Original line number Diff line number Diff line
{
  lib,
  fetchFromGitHub,
  buildPythonPackage,
  pythonOlder,
  fetchPypi,

  # build-system
  hatchling,
@@ -29,19 +28,14 @@

buildPythonPackage rec {
  pname = "dbt-common";
  version = "1.14.0";
  version = "1.22.0";
  pyproject = true;

  disabled = pythonOlder "3.9";

  src = fetchFromGitHub {
    owner = "dbt-labs";
    repo = "dbt-common";
    # Unfortunately, upstream doesn't tag commits on GitHub, and the pypi source
    # doesn't include tests. TODO: Write an update script that will detect the
    # version from `dbt_common/__about__.py`.
    rev = "965ad815f0dd546678d2595a3010d81f344f8b73";
    hash = "sha256-63gWkETi52uOrO0FTPwM831UHECqcyCtb7wVHQuujnc=";
  # No tags on GitHub
  src = fetchPypi {
    pname = "dbt_common";
    inherit version;
    hash = "sha256-6cdTMVCCB6SNEUsQtzKUBnKuJgwfttl7o2+zBp8Fu5g=";
  };

  build-system = [ hatchling ];
@@ -82,6 +76,9 @@ buildPythonPackage rec {
    "test_extra_dict_on_event"
  ];

  # No tests in the pypi archive
  doCheck = false;

  pythonImportsCheck = [ "dbt_common" ];

  meta = {
+27 −13
Original line number Diff line number Diff line
{
  lib,
  agate,
  buildPythonPackage,
  fetchFromGitHub,

  # build-system
  setuptools,

  # dependencies
  agate,
  click,
  daff,
  dbt-adapters,
  dbt-common,
  dbt-extractor,
  dbt-semantic-interfaces,
  fetchFromGitHub,
  jinja2,
  logbook,
  mashumaro,
@@ -16,35 +21,41 @@
  packaging,
  pathspec,
  protobuf,
  callPackage,
  pythonOlder,
  pydantic,
  pydantic-settings,
  pytz,
  pyyaml,
  requests,
  setuptools,
  snowplow-tracker,
  sqlparse,
  typing-extensions,

  # passthru
  callPackage,
}:

buildPythonPackage rec {
  pname = "dbt-core";
  version = "1.9.3";
  version = "1.10.0b2";
  pyproject = true;

  disabled = pythonOlder "3.9";

  src = fetchFromGitHub {
    owner = "dbt-labs";
    repo = "dbt-core";
    tag = "v${version}";
    hash = "sha256-kJyeXKETYYZIHyx1LeOVcC1ELQ9NkHFhkd8gb6cuzZc=";
    hash = "sha256-MTrdpbPqdakFDmLKRFJ23u9hLgGhZ5T+r4om9HPBjkw=";
  };

  postPatch = ''
    substituteInPlace dbt/utils/artifact_upload.py \
      --replace-fail \
        "from pydantic import BaseSettings" \
        "from pydantic_settings import BaseSettings"
  '';

  sourceRoot = "${src.name}/core";

  pythonRelaxDeps = [
    "protobuf"
    "agate"
    "click"
    "dbt-common"
@@ -54,6 +65,7 @@ buildPythonPackage rec {
    "networkx"
    "pathspec"
    "protobuf"
    "pydantic"
    "urllib3"
  ];

@@ -76,6 +88,8 @@ buildPythonPackage rec {
    packaging
    pathspec
    protobuf
    pydantic
    pydantic-settings
    pytz
    pyyaml
    requests
@@ -91,7 +105,7 @@ buildPythonPackage rec {
    withAdapters = callPackage ./with-adapters.nix { };
  };

  meta = with lib; {
  meta = {
    description = "Enables data analysts and engineers to transform their data using the same practices that software engineers use to build applications";
    longDescription = ''
      The dbt tool needs adapters to data sources in order to work. The available
@@ -111,8 +125,8 @@ buildPythonPackage rec {
    '';
    homepage = "https://github.com/dbt-labs/dbt-core";
    changelog = "https://github.com/dbt-labs/dbt-core/blob/${src.tag}/CHANGELOG.md";
    license = licenses.asl20;
    maintainers = with maintainers; [
    license = lib.licenses.asl20;
    maintainers = with lib.maintainers; [
      mausch
      tjni
    ];
+47 −36
Original line number Diff line number Diff line
{
  lib,
  buildPythonPackage,
  db-dtypes,
  fetchPypi,
  freezegun,

  # build-system
  setuptools,

  # dependencies
  google-api-core,
  google-cloud-bigquery-storage,
  google-cloud-core,
  google-cloud-datacatalog,
  google-cloud-storage,
  google-cloud-testutils,
  google-resumable-media,
  grpcio,
  ipython,
  mock,
  pandas,
  proto-plus,
  protobuf,
  psutil,
  pyarrow,
  pytest-xdist,
  pytestCheckHook,
  python-dateutil,
  pythonOlder,
  requests,
  setuptools,

  # optional-dependencies
  pyarrow,
  db-dtypes,
  pandas,
  tqdm,
  ipython,

  #  tests
  freezegun,
  google-cloud-datacatalog,
  google-cloud-storage,
  google-cloud-testutils,
  mock,
  psutil,
  pytest-xdist,
  pytestCheckHook,
}:

buildPythonPackage rec {
@@ -33,8 +40,6 @@ buildPythonPackage rec {
  version = "3.31.0";
  pyproject = true;

  disabled = pythonOlder "3.7";

  src = fetchPypi {
    pname = "google_cloud_bigquery";
    inherit version;
@@ -44,15 +49,15 @@ buildPythonPackage rec {
  build-system = [ setuptools ];

  dependencies = [
    grpcio
    google-api-core
    google-cloud-core
    google-cloud-bigquery-storage
    google-cloud-core
    google-resumable-media
    grpcio
    proto-plus
    protobuf
    requests
    python-dateutil
    requests
  ] ++ google-api-core.optional-dependencies.grpc;

  optional-dependencies = {
@@ -73,13 +78,13 @@ buildPythonPackage rec {
  nativeCheckInputs =
    [
      freezegun
      google-cloud-datacatalog
      google-cloud-storage
      google-cloud-testutils
      mock
      psutil
      google-cloud-datacatalog
      google-cloud-storage
      pytestCheckHook
      pytest-xdist
      pytestCheckHook
    ]
    ++ optional-dependencies.pandas
    ++ optional-dependencies.ipython;
@@ -91,39 +96,45 @@ buildPythonPackage rec {

  disabledTests = [
    # requires credentials
    "test_bigquery_magic"
    "TestBigQuery"
    "test_context_with_no_query_cache_from_context"
    "test_arrow_extension_types_same_for_storage_and_REST_APIs_894"
    "test_bigquery_magic"
    "test_context_with_no_query_cache_from_context"
    "test_dry_run"
    "test_list_rows_empty_table"
    "test_list_rows_page_size"
    "test_list_rows_range_csv"
    "test_list_rows_range"
    "test_list_rows_scalars_extreme"
    "test_list_rows_range_csv"
    "test_list_rows_scalars"
    "test_dry_run"
    "test_list_rows_scalars_extreme"
    "test_session"
    "test_to_arrow_query_with_empty_result"

    # Mocking of _ensure_bqstorage_client fails
    "test_to_arrow_ensure_bqstorage_client_wo_bqstorage"

    # requires network
    "test__initiate_resumable_upload"
    "test__initiate_resumable_upload_mtls"
    "test__initiate_resumable_upload_with_retry"
    "test_context_with_custom_connection"
    "test_context_with_default_connection"
    "test_dbapi_create_view"
    "test_list_rows_nullable_scalars_dtypes"
    "test_parameterized_types_round_trip"
    "test_structs"
    "test_table_snapshots"
    "test__initiate_resumable_upload"
    "test__initiate_resumable_upload_mtls"
    "test__initiate_resumable_upload_with_retry"
    "test_table_clones"
    "test_context_with_default_connection"
    "test_context_with_custom_connection"
    "test_table_snapshots"
  ];

  disabledTestPaths = [
    # Tests require credentials
    "tests/system/test_query.py"
    "tests/system/test_job_retry.py"
    "tests/system/test_pandas.py"
    "tests/system/test_query.py"

    # ModuleNotFoundError: No module named 'google.cloud.resourcemanager_v3'
    "tests/system/test_client.py"
  ];

  pythonImportsCheck = [
@@ -131,11 +142,11 @@ buildPythonPackage rec {
    "google.cloud.bigquery_v2"
  ];

  meta = with lib; {
  meta = {
    description = "Google BigQuery API client library";
    homepage = "https://github.com/googleapis/python-bigquery";
    changelog = "https://github.com/googleapis/python-bigquery/blob/v${version}/CHANGELOG.md";
    license = licenses.asl20;
    license = lib.licenses.asl20;
    maintainers = [ ];
  };
}