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