From 06a3cb6d2c06eacbb8d1cb4f7b29e85d5543bd45 Mon Sep 17 00:00:00 2001 From: Mike Shultz Date: Fri, 8 Mar 2024 15:45:35 -0700 Subject: [PATCH] docs: update contributing info (#4) --- CONTRIBUTING.md | 49 +++++++++++++++++++++++++++++++++++++++++++++++ README.md | 10 ++++++++++ scripts/update.py | 2 +- 3 files changed, 60 insertions(+), 1 deletion(-) create mode 100644 CONTRIBUTING.md diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 0000000..74dc71b --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,49 @@ +# Development + +To get started with working on the codebase, use the following steps prepare your local environment: + +```bash +# clone the github repo and navigate into the folder +git clone https://github.com/ApeWorX/evmchains.git +cd evmchains + +# create and load a virtual environment +python3 -m venv venv +source venv/bin/activate + +# install evmchains into the virtual environment +python setup.py install + +# install the developer dependencies (-e is interactive mode) +pip install -e .'[dev]' +``` + +## Pre-Commit Hooks + +We use [`pre-commit`](https://pre-commit.com/) hooks to simplify linting and ensure consistent formatting among contributors. +Use of `pre-commit` is not a requirement, but is highly recommended. + +Install `pre-commit` locally from the root folder: + +```bash +pip install pre-commit +pre-commit install +``` + +Committing will now automatically run the local hooks and ensure that your commit passes all lint checks. + +## Pull Requests + +Pull requests are welcomed! Please adhere to the following: + +- Ensure your pull request passes our linting checks +- Include test cases for any new functionality +- Include any relevant documentation updates + +It's a good idea to make pull requests early on. +A pull request represents the start of a discussion, and doesn't necessarily need to be the final, finished submission. + +If you are opening a work-in-progress pull request to verify that it passes CI tests, please consider +[marking it as a draft](https://help.github.com/en/github/collaborating-with-issues-and-pull-requests/about-pull-requests#draft-pull-requests). + +Join the ApeWorX [Discord](https://discord.gg/apeworx) if you have any questions. diff --git a/README.md b/README.md index 505cfb0..e5c5039 100644 --- a/README.md +++ b/README.md @@ -42,3 +42,13 @@ assert chain.chainId == 1 Please see the [contributing guide](CONTRIBUTING.md) to learn more how to contribute to this project. Comments, questions, criticisms and pull requests are welcomed. + +### Adding Chains + +To add a chain to the metadata, please open a pull request with the following changes: + +- Update `CHAIN_IDS` in `scripts/update.py` with the chain IDs you want to add +- Run `python scripts/update.py` +- Submit a PR with the updated script and updated `evmchain/chains.py` metdata file + +**Do not edit `evmchain/chains.py` manually.** Any manual changes are likely to be overwritten later. diff --git a/scripts/update.py b/scripts/update.py index 17b3b1d..babf620 100644 --- a/scripts/update.py +++ b/scripts/update.py @@ -132,7 +132,7 @@ def fetch_chains() -> Dict[str, Dict[str, Chain]]: def write_chain_const(chains: Dict[str, Dict[str, Chain]]): """Write the file with Python constant""" - file_str = "# This file is auto-generated by scripts/update_rpc.py\n" + file_str = "# This file is auto-generated by scripts/update.py\n" file_str += f"# {stamp()}\n" file_str += "# Do not edit this file directly.\n" file_str += "from typing import Any, Dict\n\n"