From dea1e380d9d975a4c0fe5a4b20d24bc3eae6a613 Mon Sep 17 00:00:00 2001 From: pcboy Date: Mon, 23 Sep 2024 21:36:21 +0900 Subject: [PATCH] harlequin: init at 1.24.1 --- pkgs/by-name/ha/harlequin/package.nix | 79 +++++++++++++++++++ .../harlequin-bigquery/default.nix | 43 ++++++++++ .../harlequin-postgres/default.nix | 42 ++++++++++ .../python-modules/sqlfmt/default.nix | 66 ++++++++++++++++ .../textual-fastdatatable/default.nix | 51 ++++++++++++ .../textual-textarea/default.nix | 40 ++++++++++ pkgs/top-level/python-packages.nix | 10 +++ 7 files changed, 331 insertions(+) create mode 100644 pkgs/by-name/ha/harlequin/package.nix create mode 100644 pkgs/development/python-modules/harlequin-bigquery/default.nix create mode 100644 pkgs/development/python-modules/harlequin-postgres/default.nix create mode 100644 pkgs/development/python-modules/sqlfmt/default.nix create mode 100644 pkgs/development/python-modules/textual-fastdatatable/default.nix create mode 100644 pkgs/development/python-modules/textual-textarea/default.nix diff --git a/pkgs/by-name/ha/harlequin/package.nix b/pkgs/by-name/ha/harlequin/package.nix new file mode 100644 index 000000000000..17ce48993e95 --- /dev/null +++ b/pkgs/by-name/ha/harlequin/package.nix @@ -0,0 +1,79 @@ +{ + 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}"; + }; +} diff --git a/pkgs/development/python-modules/harlequin-bigquery/default.nix b/pkgs/development/python-modules/harlequin-bigquery/default.nix new file mode 100644 index 000000000000..e43e00a4b3b2 --- /dev/null +++ b/pkgs/development/python-modules/harlequin-bigquery/default.nix @@ -0,0 +1,43 @@ +{ + 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 ]; + }; +} diff --git a/pkgs/development/python-modules/harlequin-postgres/default.nix b/pkgs/development/python-modules/harlequin-postgres/default.nix new file mode 100644 index 000000000000..65ec22fb04aa --- /dev/null +++ b/pkgs/development/python-modules/harlequin-postgres/default.nix @@ -0,0 +1,42 @@ +{ + 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 ]; + }; +} diff --git a/pkgs/development/python-modules/sqlfmt/default.nix b/pkgs/development/python-modules/sqlfmt/default.nix new file mode 100644 index 000000000000..37f23ca89ee7 --- /dev/null +++ b/pkgs/development/python-modules/sqlfmt/default.nix @@ -0,0 +1,66 @@ +{ + 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"; + }; +} diff --git a/pkgs/development/python-modules/textual-fastdatatable/default.nix b/pkgs/development/python-modules/textual-fastdatatable/default.nix new file mode 100644 index 000000000000..16d5418a2736 --- /dev/null +++ b/pkgs/development/python-modules/textual-fastdatatable/default.nix @@ -0,0 +1,51 @@ +{ + 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 ]; + }; +} diff --git a/pkgs/development/python-modules/textual-textarea/default.nix b/pkgs/development/python-modules/textual-textarea/default.nix new file mode 100644 index 000000000000..74293ee3c2e4 --- /dev/null +++ b/pkgs/development/python-modules/textual-textarea/default.nix @@ -0,0 +1,40 @@ +{ + lib, + buildPythonPackage, + fetchPypi, + poetry-core, + pyperclip, + textual, +}: + +buildPythonPackage rec { + pname = "textual-textarea"; + version = "0.14.2"; + pyproject = true; + + src = fetchPypi { + pname = "textual_textarea"; + inherit version; + hash = "sha256-AJU7BBoev6pBrLhvbfF4I7l+E8YnO5jCD5OIsNf6NW0="; + }; + + build-system = [ + poetry-core + ]; + + dependencies = [ + pyperclip + textual + ]; + + pythonImportsCheck = [ + "textual_textarea" + ]; + + meta = { + description = "A text area (multi-line input) with syntax highlighting for Textual"; + homepage = "https://pypi.org/project/textual-textarea/"; + license = lib.licenses.mit; + maintainers = with lib.maintainers; [ pcboy ]; + }; +} diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix index a5aa74d6df42..846865f5269e 100644 --- a/pkgs/top-level/python-packages.nix +++ b/pkgs/top-level/python-packages.nix @@ -5562,6 +5562,10 @@ self: super: with self; { hap-python = callPackage ../development/python-modules/hap-python { }; + harlequin-bigquery = callPackage ../development/python-modules/harlequin-bigquery { }; + + harlequin-postgres = callPackage ../development/python-modules/harlequin-postgres { }; + hass-client = callPackage ../development/python-modules/hass-client { }; hass-nabucasa = callPackage ../development/python-modules/hass-nabucasa { }; @@ -14856,6 +14860,8 @@ self: super: with self; { sqlbag = callPackage ../development/python-modules/sqlbag { }; + sqlfmt = callPackage ../development/python-modules/sqlfmt { }; + sqlglot = callPackage ../development/python-modules/sqlglot { }; sqlite-anyio = callPackage ../development/python-modules/sqlite-anyio { }; @@ -15451,10 +15457,14 @@ self: super: with self; { textual-dev = callPackage ../development/python-modules/textual-dev { }; + textual-fastdatatable = callPackage ../development/python-modules/textual-fastdatatable { }; + textual-slider = callPackage ../development/python-modules/textual-slider { }; textual-universal-directorytree = callPackage ../development/python-modules/textual-universal-directorytree { }; + textual-textarea = callPackage ../development/python-modules/textual-textarea { }; + testbook = callPackage ../development/python-modules/testbook { }; testing-common-database = callPackage ../development/python-modules/testing-common-database { };