Commit dea1e380 authored by pcboy's avatar pcboy Committed by Gaétan Lepage
Browse files

harlequin: init at 1.24.1

parent 31a555a6
Loading
Loading
Loading
Loading
+79 −0
Original line number Diff line number Diff line
{
  lib,
  python3Packages,
  fetchFromGitHub,
  harlequin,
  testers,
  nix-update-script,
  versionCheckHook,
  withPostgresAdapter ? true,
  withBigQueryAdapter ? true,
}:
python3Packages.buildPythonApplication rec {
  pname = "harlequin";
  version = "1.24.1";
  pyproject = true;

  src = fetchFromGitHub {
    owner = "tconbeer";
    repo = "harlequin";
    rev = "refs/tags/v${version}";
    hash = "sha256-3Rb47zkWsC6RJhk1btQc/kwxpFFWVnxY2PJooHB7IzQ=";
  };

  build-system = with python3Packages; [
    poetry-core
  ];

  dependencies =
    with python3Packages;
    [
      textual
      textual-fastdatatable
      textual-textarea
      click
      rich-click
      duckdb
      sqlfmt
      platformdirs
      importlib-metadata
      tomlkit
      questionary
      numpy
      packaging
    ]
    ++ lib.optionals withPostgresAdapter [ harlequin-postgres ]
    ++ lib.optionals withBigQueryAdapter [ harlequin-bigquery ];

  pythonRelaxDeps = [
    "textual"
  ];

  pythonImportsCheck = [
    "harlequin"
    "harlequin_duckdb"
    "harlequin_sqlite"
    "harlequin_vscode"
  ];

  passthru = {
    updateScript = nix-update-script { };
    tests.version = testers.testVersion {
      package = harlequin;
    };
  };

  nativeCheckInputs = [
    versionCheckHook
  ];

  meta = {
    description = "The SQL IDE for Your Terminal";
    homepage = "https://harlequin.sh";
    mainProgram = "harlequin";
    license = lib.licenses.mit;
    maintainers = with lib.maintainers; [ pcboy ];
    platforms = lib.platforms.unix;
    changelog = "https://github.com/tconbeer/harlequin/releases/tag/v${version}";
  };
}
+43 −0
Original line number Diff line number Diff line
{
  lib,
  buildPythonPackage,
  fetchPypi,
  poetry-core,
  google-cloud-bigquery,
  google-cloud-bigquery-storage,
}:

buildPythonPackage rec {
  pname = "harlequin-bigquery";
  version = "1.0.2";
  pyproject = true;

  src = fetchPypi {
    pname = "harlequin_bigquery";
    inherit version;
    hash = "sha256-uIPYhK4R6N7pqsKY2GozkG76WI+gru2unsK5BxO4+/Y=";
  };

  build-system = [
    poetry-core
  ];

  dependencies = [
    google-cloud-bigquery
    google-cloud-bigquery-storage
  ];

  # To prevent circular dependency
  # as harlequin-bigquery requires harlequin which requires harlequin-bigquery
  doCheck = false;
  pythonRemoveDeps = [
    "harlequin"
  ];

  meta = {
    description = "A Harlequin adapter for Google BigQuery";
    homepage = "https://pypi.org/project/harlequin-bigquery/";
    license = lib.licenses.mit;
    maintainers = with lib.maintainers; [ pcboy ];
  };
}
+42 −0
Original line number Diff line number Diff line
{
  lib,
  buildPythonPackage,
  fetchPypi,
  poetry-core,
  psycopg,
}:

buildPythonPackage rec {
  pname = "harlequin-postgres";
  version = "0.4.0";
  pyproject = true;

  src = fetchPypi {
    pname = "harlequin_postgres";
    inherit version;
    hash = "sha256-1y8S3z6ZTt+PZg75aB/bKnEPdAtqjZ2IqyBtUBk8IFA=";
  };

  build-system = [
    poetry-core
  ];

  dependencies = [
    psycopg
    psycopg.pool
  ];

  # To prevent circular dependency
  # as harlequin-postgres requires harlequin which requires harlequin-postgres
  doCheck = false;
  pythonRemoveDeps = [
    "harlequin"
  ];

  meta = {
    description = "A Harlequin adapter for Postgres";
    homepage = "https://pypi.org/project/harlequin-postgres/";
    license = lib.licenses.mit;
    maintainers = with lib.maintainers; [ pcboy ];
  };
}
+66 −0
Original line number Diff line number Diff line
{
  lib,
  buildPythonPackage,
  fetchPypi,
  fetchFromGitHub,
  importlib-metadata,
  black,
  poetry-core,
  click,
  jinja2,
  platformdirs,
  tomli,
  tqdm,
  gitpython,
}:

buildPythonPackage rec {
  pname = "sqlfmt";
  version = "0.23.2";
  pyproject = true;

  src = fetchFromGitHub {
    owner = "tconbeer";
    repo = "sqlfmt";
    rev = "refs/tags/v${version}";
    hash = "sha256-g2ycfpsBFMh16pYVzCmde0mhQhhvAhH25i3LJTcG7Ac=";
  };

  build-system = [
    poetry-core
  ];

  dependencies = [
    click
    importlib-metadata
    jinja2
    platformdirs
    tomli
    tqdm
  ];

  optional-dependencies = {
    jinjafmt = [
      black
    ];
    sqlfmt_primer = [
      gitpython
    ];
  };

  pythonRelaxDeps = [
    "platformdirs"
  ];

  pythonImportsCheck = [
    "sqlfmt"
  ];

  meta = {
    description = "Sqlfmt formats your dbt SQL files so you don't have to";
    homepage = "https://github.com/tconbeer/sqlfmt";
    license = lib.licenses.asl20;
    maintainers = with lib.maintainers; [ pcboy ];
    mainProgram = "sqlfmt";
  };
}
+51 −0
Original line number Diff line number Diff line
{
  lib,
  buildPythonPackage,
  fetchPypi,
  poetry-core,
  pyarrow,
  pytz,
  textual,
  tzdata,
  polars,
}:

buildPythonPackage rec {
  pname = "textual-fastdatatable";
  version = "0.9.0";
  pyproject = true;

  src = fetchPypi {
    pname = "textual_fastdatatable";
    inherit version;
    hash = "sha256-AS3SiwetCHkCMu8H81xbp5QvN/2GCvMlWgU4qZKvBRU=";
  };

  build-system = [
    poetry-core
  ];

  dependencies = [
    pyarrow
    pytz
    textual
    tzdata
  ];

  optional-dependencies = {
    polars = [
      polars
    ];
  };

  pythonImportsCheck = [
    "textual_fastdatatable"
  ];

  meta = {
    description = "A performance-focused reimplementation of Textual's DataTable widget, with a pluggable data storage backend";
    homepage = "https://pypi.org/project/textual-fastdatatable/";
    license = lib.licenses.mit;
    maintainers = with lib.maintainers; [ pcboy ];
  };
}
Loading