Skip to content

Commit

Permalink
Update poetry instructions in CONTRIBUTING.md (#78)
Browse files Browse the repository at this point in the history
  • Loading branch information
vwxyzjn authored Dec 1, 2021
1 parent 2d1dda5 commit c0cc134
Showing 1 changed file with 40 additions and 7 deletions.
47 changes: 40 additions & 7 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,21 +9,54 @@ If you plan to work on an issue, let us know in the issue thread so we can avoid
## Dev Setup

```bash
pip -r requirements-dev.txt
pip install -e entity_gym
pip install -e enn_ppo # If you didn't have torch installed already, the torch-scatter install will fail. Just run the install command again.
poetry install # torch-scatter installation will fail, simply run again
poetry install # fix torch-scatter installation
```

Then you can run the scripts under the poetry environment in two ways: `poetry run` or `poetry shell`.

* `poetry run`:
By prefixing `poetry run`, your command will run in poetry's virtual environment. For example, try running
```bash
poetry run python enn_ppo/enn_ppo/train.py
```
* `poetry shell`:
First, activate the poetry's virtual environment by executing `poetry shell`. Then, the name of the poetry's
virtual environment (e.g. `(incubator-EKBuw-J_-py3.9)`) should appear in the left side of your shell.
Afterwards, you can directly run
```bash
python enn_ppo/enn_ppo/train.py
```

See the following video as an example.

[![asciicast](https://asciinema.org/a/452597.svg)](https://asciinema.org/a/452597)

## Code Formatting

We use [Black](https://black.readthedocs.io/en/stable/) for code formatting.
You can run `black .` to format all files.
Make sure that your version of `black` matches the version in [`requirements-dev.txt`]().
You can run the following to format all files:

```bash
poetry run black .
```

## Running MyPy and Tests

```bash
dmypy run -- entity_gym enn_ppo
pytest .
poetry run dmypy run -- entity_gym enn_ppo rogue_net
poetry run pytest .
```


## Troubleshoot Build Problems

`poetry` sometimes does not play nicely with `conda`. So make sure you run a fresh shell that does not activate any conda environments. If you are running into any other build issues, try the following recommended instructions.


* Ubuntu/Debian/Mint:
```bash
sudo apt install python3-dev make build-essential libssl-dev zlib1g-dev \
libbz2-dev libreadline-dev libsqlite3-dev wget curl llvm \
libncursesw5-dev xz-utils tk-dev libxml2-dev libxmlsec1-dev libffi-dev liblzma-dev
```

0 comments on commit c0cc134

Please sign in to comment.