From ef9a526abca004e03a29019e628f03d2a761bec2 Mon Sep 17 00:00:00 2001 From: PatrickAlphac <54278053+PatrickAlphaC@users.noreply.github.com> Date: Thu, 18 Jul 2024 20:41:02 -0400 Subject: [PATCH] add contributing.md file --- .env.unsafe.example | 5 ++ .gitignore | 2 + CONTRIBUTING.md | 113 ++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 120 insertions(+) create mode 100644 .env.unsafe.example create mode 100644 CONTRIBUTING.md diff --git a/.env.unsafe.example b/.env.unsafe.example new file mode 100644 index 00000000..1d302dd6 --- /dev/null +++ b/.env.unsafe.example @@ -0,0 +1,5 @@ +# This is your unsafe environment file. Assume that you will accidently expose values in this file. +# Meaning, you should never store private keys associated with real funds in here! +MAINNET_ENDPOINT=xxx +SEPOLIA_ENDPOINT=xxx +SEPOLIA_PKEY=xxx \ No newline at end of file diff --git a/.gitignore b/.gitignore index 4a919aca..69f0ee35 100644 --- a/.gitignore +++ b/.gitignore @@ -10,6 +10,8 @@ dist/ .pytest_cache venv/ *.env +.env +.env.unsafe .coverage .coverage.* diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 00000000..ac184365 --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,113 @@ +# Contributing + +Thank you for wanting to contribute! This project reviews PRs that have an associated issue with +them. If you have not make an issue for your PR, please make one first. + +Issues, feedback, and sharing that you're using Titanoboa and Vyper on social media is always welcome! + +# Table of Contents + +- [Contributing](#contributing) +- [Table of Contents](#table-of-contents) +- [Setup](#setup) + - [Requirements](#requirements) + - [Installing for local development](#installing-for-local-development) + - [Running Tests](#running-tests) + - [Unit tests](#unit-tests) + - [Integration tests](#integration-tests) +- [Thank you!](#thank-you) + +# Setup + +## Requirements + +You must have the following installed to proceed with contributing to this project. + +- [git](https://git-scm.com/book/en/v2/Getting-Started-Installing-Git) + - You'll know you did it right if you can run `git --version` and you see a response like `git version x.x.x` +- [python](https://www.python.org/downloads/) + - You'll know you did it right if you can run `python --version` and you see a response like `Python x.x.x` +- [pip](https://pip.pypa.io/en/stable/installation/) + - You'll know you did it right if you can run `pip --version` and you see a response like `pip x.x.x` +- Linux and/or MacOS + - This project is not tested on Windows, so it is recommended to use a Linux or MacOS machine, or use a tool like [WSL](https://learn.microsoft.com/en-us/windows/wsl/install) for windows users. + +## Installing for local development + +Follow the steps to clone the repo for you to make changes to this project. + +1. Clone the repo + +```bash +git clone https://github.com/vyperlang/titanoboa +cd titanoboa +``` + +2. Setup virtual environment and install dependencies + +*You can learn more about [activating and deactivating virtual environments here.](https://docs.python.org/3/library/venv.html)* + +```bash +python -m venv venv +source venv/bin/activate +pip install -r dev-requirements.txt +``` + +*Note: When you delete your terminal/shell, you will need to reactivate this virtual environment again each time. To exit this python virtual environment, type `deactivate`* + +3. Create a new branch + +```bash +git checkout -b +``` + +And start making your changes! Once you're done, you can commit your changes and push them to your forked repo. + +```bash +git add . +git commit -m 'your commit message' +git push +``` + +## Running Tests + +Once you have your environment setup, you can run the tests to make sure everything is working as expected. You'll need to have your virtual environment activated to run the tests. + +### Unit tests + +Run the following: + +```bash +pytest tests/unitary -x +``` + +This will skip the integration tests, which need extra "stuff". + +### Integration tests + +Once you have setup your virtual environment, to run integration tests, you'll need to add environment variables. + +You can see the `.env.unsafe.example` for environment variables you'll want to use. + +```bash +MAINNET_ENDPOINT= +SEPOLIA_ENDPOINT= +SEPOLIA_PKEY= # DO NOT USE A KEY ASSSOCIATED WITH REAL FUNDS +``` + +You can optionally copy `.env.unsafe.example` and create a new file called `.env.unsafe` file and run the following command to load the environment variables. + +```bash +source .env.unsafe +``` + +Then, you can just run: + +```bash +pytest tests/integration/ -x +``` + + +# Thank you! + +Thank you for wanting to participate in titanoboa! \ No newline at end of file