1{
2 lib,
3 lark,
4 asttokens,
5 buildPythonPackage,
6 cbor2,
7 fetchPypi,
8 git,
9 immutables,
10 importlib-metadata,
11 packaging,
12 pycryptodome,
13 pythonOlder,
14 recommonmark,
15 setuptools-scm,
16 sphinx,
17 sphinx-rtd-theme,
18 writeText,
19}:
20
21let
22 sample-contract = writeText "example.vy" ''
23 count: int128
24
25 @deploy
26 def __init__(foo: address):
27 self.count = 1
28 '';
29
30in
31buildPythonPackage rec {
32 pname = "vyper";
33 version = "0.4.3";
34 pyproject = true;
35
36 disabled = pythonOlder "3.10";
37
38 src = fetchPypi {
39 inherit pname version;
40 hash = "sha256-IqdXNldAHYo7xpDWXWt3QWgABxgJeMOgX5iS2zHV3PU=";
41 };
42
43 postPatch = ''
44 # pythonRelaxDeps doesn't work
45 substituteInPlace setup.py \
46 --replace-fail "setuptools_scm>=7.1.0,<8.0.0" "setuptools_scm>=7.1.0"
47 '';
48
49 nativeBuildInputs = [
50 # Git is used in setup.py to compute version information during building
51 # ever since https://github.com/vyperlang/vyper/pull/2816
52 git
53
54 setuptools-scm
55 ];
56
57 pythonRelaxDeps = [
58 "asttokens"
59 "packaging"
60 ];
61
62 propagatedBuildInputs = [
63 lark
64 asttokens
65 cbor2
66 immutables
67 importlib-metadata
68 packaging
69 pycryptodome
70
71 # docs
72 recommonmark
73 sphinx
74 sphinx-rtd-theme
75 ];
76
77 checkPhase = ''
78 $out/bin/vyper "${sample-contract}"
79 '';
80
81 pythonImportsCheck = [
82 "vyper"
83 ];
84
85 meta = with lib; {
86 description = "Pythonic Smart Contract Language for the EVM";
87 homepage = "https://github.com/vyperlang/vyper";
88 changelog = "https://github.com/vyperlang/vyper/releases/tag/v${version}";
89 license = licenses.asl20;
90 maintainers = with maintainers; [ siraben ];
91 };
92}