Repository navigation
Expand file tree
/
Copy pathflake.nix
More file actions
83 lines (74 loc) · 2.32 KB
/
Copy pathflake.nix
File metadata and controls
83 lines (74 loc) · 2.32 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
{
description = "ibflex2 - Python parser for Interactive Brokers Flex XML statements";
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 = import nixpkgs { inherit system; };
mkDevShell = python:
let
pyEnv = python.withPackages (ps: with ps; [
defusedxml
requests
pytest
pytest-cov
coverage
mypy
hypothesis
types-requests
build
setuptools
]);
in
pkgs.mkShell {
packages = [ pyEnv pkgs.ruff ];
shellHook = ''
export PYTHONPATH="$PWD:$PYTHONPATH"
echo "ibflex2 dev shell (${python.pythonVersion})"
echo " pytest -- run tests"
echo " mypy ibflex tests -- static analysis"
echo " ruff check ibflex tests -- lint"
echo " ruff format ibflex tests -- format"
echo " python -m build -- build sdist+wheel"
'';
};
in
{
devShells = {
default = mkDevShell pkgs.python312;
py312 = mkDevShell pkgs.python312;
py313 = mkDevShell pkgs.python313;
};
packages.default = pkgs.python312Packages.buildPythonPackage {
pname = "ibflex2";
version = "1.0.0";
src = ./.;
pyproject = true;
build-system = with pkgs.python312Packages; [
setuptools
];
dependencies = with pkgs.python312Packages; [
defusedxml
requests
];
nativeCheckInputs = with pkgs.python312Packages; [
pytest
pytest-cov
hypothesis
];
checkPhase = ''
runHook preCheck
pytest tests/
runHook postCheck
'';
meta = with pkgs.lib; {
description = "Parse Interactive Brokers Flex XML reports (maintained fork)";
homepage = "https://github.com/robcohen/ibflex2";
license = licenses.mit;
};
};
});
}