1- from setuptools import setup , find_packages , Command
2- from setuptools .command .build_py import build_py
3- from distutils import dir_util
4- from distutils .util import convert_path
5- from pathlib import Path
1+ import ast
2+ import copy
3+ import json
4+ import logging
65import os
76import string
8- from typing import Dict , List , Sequence , Optional , Tuple
9- import ast
10- import subprocess
117import sys
12- import copy
8+ import warnings
9+
1310from collections import OrderedDict
14- import json
11+ from distutils import dir_util
12+ from distutils .util import convert_path
1513from functools import lru_cache
14+ from marko .block import Heading , FencedCode , LinkRefDef , BlankLine
15+ from marko .ext .gfm import gfm
16+ from marko .ext .gfm .elements import Table
17+ from marko .inline import CodeSpan
18+ from pathlib import Path
19+ from ruamel .yaml import YAML
20+ from setuptools import setup , find_packages , Command
21+ from setuptools .command .build_py import build_py
22+ from typing import Dict , List , Sequence , Optional , Tuple
23+
24+ pysetup_path = os .path .abspath (os .path .dirname (__file__ ))
25+ sys .path .insert (0 , pysetup_path )
1626
1727from pysetup .constants import (
18- # code names
1928 PHASE0 ,
20- # misc
2129 ETH2_SPEC_COMMENT_PREFIX ,
2230)
23- from pysetup .spec_builders import spec_builders
24- from pysetup .typing import (
25- BuildTarget ,
26- ProtocolDefinition ,
27- SpecObject ,
28- VariableDefinition ,
29- )
3031from pysetup .helpers import (
3132 combine_spec_objects ,
3233 dependency_order_class_objects ,
3334 objects_to_spec ,
3435 parse_config_vars ,
3536)
36- from pysetup .md_doc_paths import get_md_doc_paths
37+ from pysetup .md_doc_paths import (
38+ get_md_doc_paths
39+ )
40+ from pysetup .spec_builders import (
41+ spec_builders
42+ )
43+ from pysetup .typing import (
44+ BuildTarget ,
45+ ProtocolDefinition ,
46+ SpecObject ,
47+ VariableDefinition ,
48+ )
49+
3750
3851# Ignore '1.5.0-alpha.*' to '1.5.0a*' messages.
39- import warnings
4052warnings .filterwarnings ('ignore' , message = 'Normalizing .* to .*' )
4153
4254# Ignore 'running' and 'creating' messages
43- import logging
4455class PyspecFilter (logging .Filter ):
4556 def filter (self , record ):
4657 return not record .getMessage ().startswith (('running ' , 'creating ' ))
4758logging .getLogger ().addFilter (PyspecFilter ())
4859
49- # NOTE: have to programmatically include third-party dependencies in `setup.py`.
50- def installPackage (package : str ):
51- subprocess .check_call ([sys .executable , '-m' , 'pip' , 'install' , package ])
52-
53- RUAMEL_YAML_VERSION = "ruamel.yaml==0.17.21"
54- try :
55- import ruamel .yaml
56- except ImportError :
57- installPackage (RUAMEL_YAML_VERSION )
58-
59- from ruamel .yaml import YAML
60-
61- MARKO_VERSION = "marko==1.0.2"
62- try :
63- import marko
64- except ImportError :
65- installPackage (MARKO_VERSION )
66-
67- from marko .block import Heading , FencedCode , LinkRefDef , BlankLine
68- from marko .inline import CodeSpan
69- from marko .ext .gfm import gfm
70- from marko .ext .gfm .elements import Table
71-
7260
7361@lru_cache (maxsize = None )
7462def _get_name_from_heading (heading : Heading ) -> Optional [str ]:
@@ -550,12 +538,9 @@ def run(self):
550538 spec_version = f .read ().strip ()
551539
552540setup (
553- name = 'eth2spec' ,
554541 version = spec_version ,
555- description = "Eth2 spec, provided as Python package for tooling and testing" ,
556542 long_description = readme ,
557543 long_description_content_type = "text/markdown" ,
558- author = "ethereum" ,
559544 url = "https://github.com/ethereum/consensus-specs" ,
560545 include_package_data = False ,
561546 package_data = {
@@ -575,25 +560,4 @@ def run(self):
575560 packages = find_packages (where = 'tests/core/pyspec' ) + ['configs' , 'presets' , 'specs' , 'presets' , 'sync' ],
576561 py_modules = ["eth2spec" ],
577562 cmdclass = commands ,
578- python_requires = ">=3.9, <4" ,
579- extras_require = {
580- "test" : ["pytest>=4.4" , "pytest-cov" , "pytest-xdist" ],
581- "lint" : ["flake8==5.0.4" , "mypy==0.981" , "pylint==3.3.1" , "codespell==2.4.0" ],
582- "generator" : ["setuptools>=72.0.0" , "pytest>4.4" , "python-snappy==0.7.3" , "filelock" , "pathos==0.3.0" ],
583- "docs" : ["mkdocs==1.4.2" , "mkdocs-material==9.1.5" , "mdx-truly-sane-lists==1.3" , "mkdocs-awesome-pages-plugin==2.8.0" ]
584- },
585- install_requires = [
586- "eth-utils>=2.0.0,<3" ,
587- "eth-typing>=3.2.0,<4.0.0" ,
588- "pycryptodome>=3.19.1" ,
589- "py_ecc==6.0.0" ,
590- "milagro_bls_binding==1.9.0" ,
591- "remerkleable==0.1.28" ,
592- "trie>=3,<4" ,
593- RUAMEL_YAML_VERSION ,
594- "lru-dict==1.2.0" ,
595- MARKO_VERSION ,
596- "py_arkworks_bls12381==0.3.8" ,
597- "curdleproofs==0.1.2" ,
598- ]
599563)
0 commit comments