Skip to content

Commit e3b1225

Browse files
committed
python312Packages.sqlfmt: refactor
1 parent 2702f06 commit e3b1225

File tree

1 file changed

+26
-20
lines changed

1 file changed

+26
-20
lines changed

pkgs/development/python-modules/sqlfmt/default.nix

Lines changed: 26 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,39 @@
11
{
22
lib,
3+
black,
34
buildPythonPackage,
4-
fetchPypi,
5+
click,
56
fetchFromGitHub,
7+
fetchPypi,
8+
gitpython,
69
importlib-metadata,
7-
black,
8-
poetry-core,
9-
click,
1010
jinja2,
1111
platformdirs,
12+
poetry-core,
13+
pytest-asyncio,
14+
pytestCheckHook,
15+
pythonOlder,
1216
tomli,
1317
tqdm,
14-
gitpython,
1518
}:
1619

1720
buildPythonPackage rec {
1821
pname = "sqlfmt";
1922
version = "0.23.3";
2023
pyproject = true;
2124

25+
disabled = pythonOlder "3.9";
26+
2227
src = fetchFromGitHub {
2328
owner = "tconbeer";
2429
repo = "sqlfmt";
2530
rev = "refs/tags/v${version}";
2631
hash = "sha256-kbluj29P1HwTaCYv1Myslak9s8FFm2e/eHdGgi3H4i0=";
2732
};
2833

29-
build-system = [
30-
poetry-core
31-
];
34+
pythonRelaxDeps = [ "platformdirs" ];
35+
36+
build-system = [ poetry-core ];
3237

3338
dependencies = [
3439
click
@@ -40,25 +45,26 @@ buildPythonPackage rec {
4045
];
4146

4247
optional-dependencies = {
43-
jinjafmt = [
44-
black
45-
];
46-
sqlfmt_primer = [
47-
gitpython
48-
];
48+
jinjafmt = [ black ];
49+
sqlfmt_primer = [ gitpython ];
4950
};
5051

51-
pythonRelaxDeps = [
52-
"platformdirs"
53-
];
52+
nativeCheckInputs = [
53+
pytest-asyncio
54+
pytestCheckHook
55+
] ++ lib.flatten (builtins.attrValues optional-dependencies);
5456

55-
pythonImportsCheck = [
56-
"sqlfmt"
57-
];
57+
preCheck = ''
58+
export HOME=$(mktemp -d)
59+
export PATH="$PATH:$out/bin";
60+
'';
61+
62+
pythonImportsCheck = [ "sqlfmt" ];
5863

5964
meta = {
6065
description = "Sqlfmt formats your dbt SQL files so you don't have to";
6166
homepage = "https://github.com/tconbeer/sqlfmt";
67+
changelog = "https://github.com/tconbeer/sqlfmt/blob/${src.rev}/CHANGELOG.md";
6268
license = lib.licenses.asl20;
6369
maintainers = with lib.maintainers; [ pcboy ];
6470
mainProgram = "sqlfmt";

0 commit comments

Comments
 (0)