1{
2 lib,
3 buildPythonPackage,
4 pythonAtLeast,
5 fetchFromGitHub,
6 rustPlatform,
7 numpy,
8 pytestCheckHook,
9 syrupy,
10}:
11
12buildPythonPackage rec {
13 pname = "quil";
14 version = "0.17.0";
15 pyproject = true;
16
17 # error: the configured Python interpreter version (3.13) is newer than PyO3's maximum supported version (3.12)
18 disabled = pythonAtLeast "3.13";
19
20 src = fetchFromGitHub {
21 owner = "rigetti";
22 repo = "quil-rs";
23 tag = "quil-py/v${version}";
24 hash = "sha256-sQvHar52IFVUM+AssPEtBcSGVEma9e909K/5c8H0WQw=";
25 };
26
27 cargoDeps = rustPlatform.fetchCargoVendor {
28 inherit pname version src;
29 hash = "sha256-3qFrsevaVP2tPf0OV0hW6HhhWsj2BM/2sZUvdq1Aa4k=";
30 };
31
32 buildAndTestSubdir = "quil-py";
33
34 nativeBuildInputs = [
35 rustPlatform.cargoSetupHook
36 rustPlatform.maturinBuildHook
37 ];
38
39 dependencies = [ numpy ];
40
41 pythonImportsCheck = [
42 "quil.expression"
43 "quil.instructions"
44 "quil.program"
45 "quil.validation"
46 ];
47
48 nativeCheckInputs = [
49 pytestCheckHook
50 syrupy
51 ];
52
53 pytestFlags = [
54 "quil-py/tests_py"
55 ];
56
57 meta = {
58 changelog = "https://github.com/rigetti/quil-rs/blob/${src.tag}/quil-py/CHANGELOG.md";
59 description = "Python package for building and parsing Quil programs";
60 homepage = "https://github.com/rigetti/quil-rs/tree/main/quil-py";
61 license = lib.licenses.asl20;
62 maintainers = with lib.maintainers; [ dotlambda ];
63 };
64}