From 451c28342a16e25054a04eb79d877db64c018bdf Mon Sep 17 00:00:00 2001 From: Danny Ryan Date: Wed, 24 Apr 2019 11:59:13 -0600 Subject: [PATCH] Revert "Only use `setup.py`" --- .circleci/config.yml | 14 +++++------ .gitignore | 7 ------ Makefile | 14 ++++------- test_generators/README.md | 2 +- test_libs/config_helpers/requirements.txt | 1 + test_libs/config_helpers/setup.py | 21 ++++------------ test_libs/gen_helpers/requirements.txt | 2 ++ test_libs/gen_helpers/setup.py | 23 +++++------------- test_libs/pyspec/README.md | 2 +- test_libs/pyspec/requirements-testing.txt | 3 +++ test_libs/pyspec/requirements.txt | 4 ++++ test_libs/pyspec/setup.py | 27 +++++---------------- test_libs/setup.py | 29 ----------------------- 13 files changed, 40 insertions(+), 109 deletions(-) create mode 100644 test_libs/config_helpers/requirements.txt create mode 100644 test_libs/gen_helpers/requirements.txt create mode 100644 test_libs/pyspec/requirements-testing.txt create mode 100644 test_libs/pyspec/requirements.txt delete mode 100644 test_libs/setup.py diff --git a/.circleci/config.yml b/.circleci/config.yml index 41e8092073..4f806b00f2 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -60,15 +60,15 @@ jobs: - restore_cache: key: v1-specs-repo-{{ .Branch }}-{{ .Revision }} - restore_cached_venv: - venv_name: v1-test_libs - reqs_checksum: '{{ checksum "test_libs/pyspec/setup.py" }}' + venv_name: v1-pyspec + reqs_checksum: '{{ checksum "test_libs/pyspec/requirements.txt" }}-{{ checksum "test_libs/pyspec/requirements-testing.txt" }}' - run: name: Install pyspec requirements command: make install_test - save_cached_venv: - venv_name: v1-test_libs - reqs_checksum: '{{ checksum "test_libs/pyspec/setup.py" }}' - venv_path: ./test_libs/venv + venv_name: v1-pyspec + reqs_checksum: '{{ checksum "test_libs/pyspec/requirements.txt" }}-{{ checksum "test_libs/pyspec/requirements-testing.txt" }}' + venv_path: ./test_libs/pyspec/venv test: docker: - image: circleci/python:3.6 @@ -77,8 +77,8 @@ jobs: - restore_cache: key: v1-specs-repo-{{ .Branch }}-{{ .Revision }} - restore_cached_venv: - venv_name: v1-test_libs - reqs_checksum: '{{ checksum "test_libs/pyspec/setup.py" }}' + venv_name: v1-pyspec + reqs_checksum: '{{ checksum "test_libs/pyspec/requirements.txt" }}-{{ checksum "test_libs/pyspec/requirements-testing.txt" }}' - run: name: Run py-tests command: make citest diff --git a/.gitignore b/.gitignore index 84938d2985..3dd86fc805 100644 --- a/.gitignore +++ b/.gitignore @@ -4,10 +4,6 @@ venv .venvs .venv /.pytest_cache -*.egg -*.egg-info -eggs -.eggs build/ output/ @@ -17,6 +13,3 @@ eth2.0-spec-tests/ # Dynamically built from Markdown spec test_libs/pyspec/eth2spec/phase0/spec.py - -# vscode -.vscode/** diff --git a/Makefile b/Makefile index 1351248985..73d8adea89 100644 --- a/Makefile +++ b/Makefile @@ -2,7 +2,6 @@ SPEC_DIR = ./specs SCRIPT_DIR = ./scripts TEST_LIBS_DIR = ./test_libs PY_SPEC_DIR = $(TEST_LIBS_DIR)/pyspec -CONFIG_HELPERS_DIR = $(TEST_LIBS_DIR)/config_helpers YAML_TEST_DIR = ./eth2.0-spec-tests/tests GENERATOR_DIR = ./test_generators CONFIGS_DIR = ./configs @@ -24,8 +23,7 @@ all: $(PY_SPEC_ALL_TARGETS) $(YAML_TEST_DIR) $(YAML_TEST_TARGETS) clean: rm -rf $(YAML_TEST_DIR) rm -rf $(GENERATOR_VENVS) - rm -rf $(TEST_LIBS_DIR)/venv - rm -rf $(PY_SPEC_DIR)/.pytest_cache + rm -rf $(PY_SPEC_DIR)/venv $(PY_SPEC_DIR)/.pytest_cache rm -rf $(PY_SPEC_ALL_TARGETS) # "make gen_yaml_tests" to run generators @@ -33,17 +31,13 @@ gen_yaml_tests: $(PY_SPEC_ALL_TARGETS) $(YAML_TEST_TARGETS) # installs the packages to run pyspec tests install_test: - cd $(TEST_LIBS_DIR); python3 -m venv venv; . venv/bin/activate; \ - cd ..; cd $(CONFIG_HELPERS_DIR); pip3 install -e .; \ - cd ../..; cd $(PY_SPEC_DIR); pip3 install -e .[dev]; + cd $(PY_SPEC_DIR); python3 -m venv venv; . venv/bin/activate; pip3 install -r requirements-testing.txt; test: $(PY_SPEC_ALL_TARGETS) - cd $(TEST_LIBS_DIR); . venv/bin/activate; \ - cd ..; cd $(PY_SPEC_DIR); python -m pytest .; + cd $(PY_SPEC_DIR); . venv/bin/activate; python -m pytest . citest: $(PY_SPEC_ALL_TARGETS) - cd $(TEST_LIBS_DIR); . venv/bin/activate; \ - cd ..; cd $(PY_SPEC_DIR); mkdir -p test-reports/eth2spec; python -m pytest --junitxml=test-reports/eth2spec/test_results.xml . + cd $(PY_SPEC_DIR); mkdir -p test-reports/eth2spec; . venv/bin/activate; python -m pytest --junitxml=test-reports/eth2spec/test_results.xml . # "make pyspec" to create the pyspec for all phases. pyspec: $(PY_SPEC_ALL_TARGETS) diff --git a/test_generators/README.md b/test_generators/README.md index 94db105c02..66534e5a8f 100644 --- a/test_generators/README.md +++ b/test_generators/README.md @@ -72,7 +72,7 @@ Note: make sure to run `make pyspec` from the root of the specs repository, to b Install all the necessary requirements (re-run when you add more): ```bash -pip3 install -e .[pyspec] +pip3 install -r requirements.txt ``` And write your initial test generator, extending the base generator: diff --git a/test_libs/config_helpers/requirements.txt b/test_libs/config_helpers/requirements.txt new file mode 100644 index 0000000000..e441a474b8 --- /dev/null +++ b/test_libs/config_helpers/requirements.txt @@ -0,0 +1 @@ +ruamel.yaml==0.15.87 diff --git a/test_libs/config_helpers/setup.py b/test_libs/config_helpers/setup.py index 88669c0928..90ad94ee44 100644 --- a/test_libs/config_helpers/setup.py +++ b/test_libs/config_helpers/setup.py @@ -1,20 +1,9 @@ -from setuptools import setup, find_packages - - -deps = { - 'preset_loader': [ - "ruamel.yaml==0.15.87", - ], -} - -deps['dev'] = ( - deps['preset_loader'] -) - -install_requires = deps['preset_loader'] +from distutils.core import setup setup( name='config_helpers', - packages=find_packages(exclude=["tests", "tests.*"]), - install_requires=install_requires, + packages=['preset_loader'], + install_requires=[ + "ruamel.yaml==0.15.87" + ] ) diff --git a/test_libs/gen_helpers/requirements.txt b/test_libs/gen_helpers/requirements.txt new file mode 100644 index 0000000000..3d6a39458e --- /dev/null +++ b/test_libs/gen_helpers/requirements.txt @@ -0,0 +1,2 @@ +ruamel.yaml==0.15.87 +eth-utils==1.4.1 diff --git a/test_libs/gen_helpers/setup.py b/test_libs/gen_helpers/setup.py index 0c84ff2e2b..5de27a6dbe 100644 --- a/test_libs/gen_helpers/setup.py +++ b/test_libs/gen_helpers/setup.py @@ -1,21 +1,10 @@ -from setuptools import setup, find_packages - - -deps = { - 'gen_base': [ - "ruamel.yaml==0.15.87", - "eth-utils==1.4.1", - ], -} - -deps['dev'] = ( - deps['gen_base'] -) - -install_requires = deps['gen_base'] +from distutils.core import setup setup( name='gen_helpers', - packages=find_packages(exclude=["tests", "tests.*"]), - install_requires=install_requires, + packages=['gen_base'], + install_requires=[ + "ruamel.yaml==0.15.87", + "eth-utils==1.4.1" + ] ) diff --git a/test_libs/pyspec/README.md b/test_libs/pyspec/README.md index ab2967024a..df18342100 100644 --- a/test_libs/pyspec/README.md +++ b/test_libs/pyspec/README.md @@ -38,7 +38,7 @@ Install dependencies: ```bash python3 -m venv venv . venv/bin/activate -pip3 install -e .[dev] +pip3 install -r requirements-testing.txt ``` Note: make sure to run `make -B pyspec` from the root of the specs repository, to build the parts of the pyspec module derived from the markdown specs. diff --git a/test_libs/pyspec/requirements-testing.txt b/test_libs/pyspec/requirements-testing.txt new file mode 100644 index 0000000000..388a878a90 --- /dev/null +++ b/test_libs/pyspec/requirements-testing.txt @@ -0,0 +1,3 @@ +-r requirements.txt +pytest>=3.6,<3.7 +../config_helpers diff --git a/test_libs/pyspec/requirements.txt b/test_libs/pyspec/requirements.txt new file mode 100644 index 0000000000..78d41708dc --- /dev/null +++ b/test_libs/pyspec/requirements.txt @@ -0,0 +1,4 @@ +eth-utils>=1.3.0,<2 +eth-typing>=2.1.0,<3.0.0 +pycryptodome==3.7.3 +py_ecc>=1.6.0 diff --git a/test_libs/pyspec/setup.py b/test_libs/pyspec/setup.py index 3fd9d4c0f1..1a131a4171 100644 --- a/test_libs/pyspec/setup.py +++ b/test_libs/pyspec/setup.py @@ -1,28 +1,13 @@ from setuptools import setup, find_packages - -deps = { - 'pyspec': [ +setup( + name='pyspec', + packages=find_packages(), + tests_require=["pytest"], + install_requires=[ "eth-utils>=1.3.0,<2", "eth-typing>=2.1.0,<3.0.0", "pycryptodome==3.7.3", "py_ecc>=1.6.0", - ], - 'test': [ - "pytest>=3.6,<3.7", - ], -} - -deps['dev'] = ( - deps['pyspec'] + - deps['test'] -) - -install_requires = deps['pyspec'] - -setup( - name='pyspec', - packages=find_packages(exclude=["tests", "tests.*"]), - install_requires=install_requires, - extras_require=deps, + ] ) diff --git a/test_libs/setup.py b/test_libs/setup.py deleted file mode 100644 index b82fc369c1..0000000000 --- a/test_libs/setup.py +++ /dev/null @@ -1,29 +0,0 @@ -from setuptools import setup, find_packages - - -deps = { - 'pyspec': [ - "eth-utils>=1.3.0,<2", - "eth-typing>=2.1.0,<3.0.0", - "pycryptodome==3.7.3", - "py_ecc>=1.6.0", - ], - 'test': [ - "pytest>=3.6,<3.7", - ], -} - -deps['dev'] = ( - deps['pyspec'] + - deps['test'] -) - -install_requires = deps['pyspec'] - - -setup( - name='pyspec', - packages=find_packages(exclude=["tests", "tests.*"]), - install_requires=install_requires, - extras_require=deps, -)