Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve readme and automatically run pip install -r requirements.txt #33

Merged
merged 1 commit into from
Aug 17, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions docs/docs/basics/running-locally.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ sidebar_position: 1

## Environment Setup

Note that this repo supports dev containers so a quick way to setup your environment is to skip this section and [start a codespace](https://github.com/codespaces/new?hide_repo_select=true&ref=main&repo=677467268&skip_quickstart=true). Read on for manual instructions.

- Install the Node version manager (https://github.com/nvm-sh/nvm).

```bash
Expand All @@ -30,6 +32,7 @@ sidebar_position: 1
```bash
brew install git-lfs
```
- Install [Python version >=3.9,<=3.10](https://www.python.org/)
- Install [Bazel](https://bazel.build/install)
```bash
npm install -g @bazel/bazelisk
Expand All @@ -38,6 +41,11 @@ sidebar_position: 1
```bash
git clone https://github.com/ill-inc/biomes-game.git
```
- Setup Python Virtual Environment (optional, but recommended)
```bash
python -m venv .venv
source .venv/bin/activate
```
- Install [Redis 7.0.8](https://redis.io/)
```bash
curl -s https://download.redis.io/releases/redis-7.0.8.tar.gz | tar xvz -C ${HOME} \
Expand All @@ -47,6 +55,7 @@ sidebar_position: 1
```

## Run Biomes

- In the Biomes repository directory,
```bash
./b data-snapshot run
Expand Down
6 changes: 3 additions & 3 deletions scripts/b/bootstrap.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

def check_version():
version = sys.version_info
if version.major != 3 or version.minor < 8:
if version.major != 3 or version.minor < 9:
raise Exception("This script requires Python 3.8 or higher.")


Expand All @@ -29,7 +29,7 @@ def ensure_deps_are_available(deps):
)


def check_git_fls_is_installed():
def check_git_lfs_is_installed():
"""Check that your local repository used git-lfs correctly."""
try:
subprocess.run(
Expand Down Expand Up @@ -86,7 +86,7 @@ def main():
"watchfiles",
]
)
check_git_fls_is_installed()
check_git_lfs_is_installed()
check_bazel_installed()
check_rsync_installed()

Expand Down
9 changes: 5 additions & 4 deletions scripts/b/data_snapshot.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
from pathlib import Path
import b
import click
from pip_install_voxeloo import run_pip_install_voxeloo
from pip_install_voxeloo import run_pip_install_voxeloo, run_pip_install_requirements
import time
import shutil
import tempfile
Expand Down Expand Up @@ -273,14 +273,15 @@ def ensure_redis_populated(ctx):

@data_snapshot.command()
@click.option(
"--pip-install-voxeloo/--no-pip-install-voxeloo",
"--pip-install/--no-pip-install",
help="Whether or not `pip install ./voxeloo` will get called before commands that need it.",
default=True,
)
@click.pass_context
def run(ctx, pip_install_voxeloo: bool):
def run(ctx, pip_install: bool):
"""Run with from data snapshot."""
if pip_install_voxeloo:
if pip_install:
run_pip_install_requirements()
run_pip_install_voxeloo()

# Make sure our data snapshot exists and is up-to-date.
Expand Down
12 changes: 12 additions & 0 deletions scripts/b/pip_install_voxeloo.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,3 +39,15 @@ def run_pip_install_voxeloo():
)
if result.returncode != 0:
sys.exit(result.returncode)


def run_pip_install_requirements():
click.secho("Running `pip install -r requirements`...")
click.secho()
# We call `python` directly here instead of sys.executable because that's
# how Galois is going to subsequently access Python.
result = subprocess.run(
["python", "-m", "pip", "install", "-r", "requirements.txt"], cwd=REPO_DIR
)
if result.returncode != 0:
sys.exit(result.returncode)