-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathflake.nix
More file actions
146 lines (127 loc) · 4.1 KB
/
flake.nix
File metadata and controls
146 lines (127 loc) · 4.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
{
description = "Unofficial Python SDK for the FinWise API";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
flake-utils.url = "github:numtide/flake-utils";
};
outputs = { self, nixpkgs, flake-utils }:
flake-utils.lib.eachDefaultSystem (system:
let
pkgs = nixpkgs.legacyPackages.${system};
pythonVersions = {
python311 = pkgs.python311;
python312 = pkgs.python312;
python313 = pkgs.python313;
};
defaultPython = pythonVersions.python311;
mkFinwise = python: python.pkgs.buildPythonPackage rec {
pname = "finwise-python";
version = "1.2.0";
pyproject = true;
src = pkgs.lib.cleanSourceWith {
filter = name: type:
let baseName = baseNameOf (toString name);
in !(
baseName == ".git" ||
baseName == ".github" ||
baseName == ".venv" ||
baseName == ".mypy_cache" ||
baseName == ".pytest_cache" ||
baseName == ".ruff_cache" ||
baseName == "site" ||
baseName == "__pycache__" ||
baseName == "result" ||
baseName == ".direnv" ||
pkgs.lib.hasSuffix ".egg-info" baseName
);
src = ./.;
};
build-system = with python.pkgs; [
hatchling
];
dependencies = with python.pkgs; [
httpx
pydantic
];
nativeCheckInputs = with python.pkgs; [
pytestCheckHook
pytest-cov
respx
];
pythonImportsCheck = [ "finwise" ];
meta = with pkgs.lib; {
description = "Unofficial Python SDK for the FinWise API";
homepage = "https://github.com/rameezk/finwise-python";
license = licenses.mit;
maintainers = [ ];
platforms = platforms.unix;
};
};
mkDevShell = python: pkgs.mkShell {
packages = [
(python.withPackages (ps: with ps; [
httpx
pydantic
pytest
pytest-cov
respx
mypy
ruff
hatchling
pip
build
]))
];
shellHook = ''
echo "FinWise Python SDK development environment"
echo "Python version: $(python --version)"
'';
};
docsShell = pkgs.mkShell {
packages = [
(defaultPython.withPackages (ps: with ps; [
mkdocs
mkdocs-material
]))
];
shellHook = ''
echo "FinWise Python SDK documentation environment"
echo "Run 'mkdocs serve' to preview docs locally"
'';
};
in {
packages = {
default = mkFinwise defaultPython;
finwise-python311 = mkFinwise pythonVersions.python311;
finwise-python312 = mkFinwise pythonVersions.python312;
finwise-python313 = mkFinwise pythonVersions.python313;
};
devShells = {
default = mkDevShell defaultPython;
python311 = mkDevShell pythonVersions.python311;
python312 = mkDevShell pythonVersions.python312;
python313 = mkDevShell pythonVersions.python313;
docs = docsShell;
};
apps = {
docs-serve = {
type = "app";
program = toString (pkgs.writeShellScript "docs-serve" ''
cd ${./.}
${defaultPython.withPackages (ps: with ps; [ mkdocs mkdocs-material ])}/bin/mkdocs serve
'');
};
docs-build = {
type = "app";
program = toString (pkgs.writeShellScript "docs-build" ''
cd ${./.}
${defaultPython.withPackages (ps: with ps; [ mkdocs mkdocs-material ])}/bin/mkdocs build
'');
};
};
checks = {
default = mkFinwise defaultPython;
};
}
);
}