63 lines
1.7 KiB
Markdown
Raw Normal View History

# ETH 2.0 PySpec
2019-03-28 00:43:56 +08:00
The Python executable spec is built from the ETH 2.0 specification,
complemented with the necessary helper functions for hashing, BLS, and more.
With this executable spec,
test-generators can easily create test-vectors for client implementations,
and the spec itself can be verified to be consistent and coherent, through sanity tests implemented with pytest.
2019-04-17 17:47:56 +10:00
2019-03-29 00:51:49 +08:00
## Building
All the dynamic parts of the spec can be build at once with `make pyspec`.
Alternatively, you can build a sub-set of the pyspec: `make phase0`.
2019-04-03 14:18:17 +11:00
Or, to build a single file, specify the path, e.g. `make test_libs/pyspec/eth2spec/phase0/spec.py`
2019-03-29 00:51:49 +08:00
2019-04-17 17:47:56 +10:00
## Py-tests
After building, you can install the dependencies for running the `pyspec` tests with `make install_test`
2019-04-17 17:47:56 +10:00
These tests are not intended for client-consumption.
These tests are sanity tests, to verify if the spec itself is consistent.
### How to run tests
#### Automated
Run `make test` from the root of the spec repository.
#### Manual
From within the `pyspec` folder:
Install dependencies:
```bash
python3 -m venv venv
. venv/bin/activate
2019-04-24 11:59:13 -06:00
pip3 install -r requirements-testing.txt
2019-04-17 17:47:56 +10:00
```
Note: make sure to run `make -B pyspec` from the root of the specs repository,
2019-04-17 17:47:56 +10:00
to build the parts of the pyspec module derived from the markdown specs.
The `-B` flag may be helpful to force-overwrite the `pyspec` output after you made a change to the markdown source files.
2019-04-17 17:47:56 +10:00
Run the tests:
```
pytest --config=minimal eth2spec
2019-04-17 17:47:56 +10:00
```
Note the package-name, this is to locate the tests.
2019-04-17 17:47:56 +10:00
2019-03-29 00:51:49 +08:00
## Contributing
2019-03-28 00:43:56 +08:00
Contributions are welcome, but consider implementing your idea as part of the spec itself first.
The pyspec is not a replacement.
2019-04-17 17:47:56 +10:00
2019-03-28 00:43:56 +08:00
## License
2019-04-23 12:57:15 -05:00
Same as the spec itself, see [LICENSE](../../LICENSE) file in spec repository root.