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