1{
2 lib,
3 buildPythonPackage,
4 cargo,
5 fetchFromGitHub,
6 libiconv,
7 poetry-core,
8 pytestCheckHook,
9 pythonOlder,
10 rustc,
11 rustPlatform,
12 stdenv,
13}:
14
15buildPythonPackage rec {
16 pname = "pyheck";
17 version = "0.1.5";
18 format = "pyproject";
19
20 disabled = pythonOlder "3.7";
21
22 src = fetchFromGitHub {
23 owner = "kevinheavey";
24 repo = "pyheck";
25 tag = version;
26 hash = "sha256-mfXkrCbBaJ0da+taKJvfyU5NS43tYJWqtTUXiCLVoGQ=";
27 };
28
29 cargoDeps = rustPlatform.importCargoLock { lockFile = ./Cargo.lock; };
30
31 postPatch = ''
32 ln -s ${./Cargo.lock} Cargo.lock
33 '';
34
35 nativeBuildInputs = [
36 cargo
37 poetry-core
38 rustc
39 rustPlatform.cargoSetupHook
40 rustPlatform.maturinBuildHook
41 ];
42
43 buildInputs = lib.optionals stdenv.hostPlatform.isDarwin [ libiconv ];
44
45 nativeCheckInputs = [ pytestCheckHook ];
46
47 pythonImportsCheck = [ "pyheck" ];
48
49 meta = with lib; {
50 description = "Python bindings for heck, the Rust case conversion library";
51 homepage = "https://github.com/kevinheavey/pyheck";
52 changelog = "https://github.com/kevinheavey/pyheck/blob/${version}/CHANGELOG.md";
53 license = licenses.mit;
54 maintainers = with maintainers; [ fab ];
55 };
56}