Skip to content

Commit

Permalink
Update makefile, tiltfile
Browse files Browse the repository at this point in the history
  • Loading branch information
matiasb committed Feb 14, 2024
1 parent 91e8c5e commit e9c9b5c
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 11 deletions.
15 changes: 9 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ DEV_HELM_FILE = $(DEV_ENV_DIR)/helm-local.yml
DEV_HELM_USER_SPECIFIC_FILE = $(DEV_ENV_DIR)/helm-local.dev.yml

ENGINE_DIR = ./engine
VENV_DIR = ./venv
REQUIREMENTS_DEV_IN = $(ENGINE_DIR)/requirements-dev.in
REQUIREMENTS_DEV_TXT = $(ENGINE_DIR)/requirements-dev.txt
REQUIREMENTS_IN = $(ENGINE_DIR)/requirements.in
Expand Down Expand Up @@ -240,26 +241,28 @@ backend-debug-disable: _backend-debug-disable stop start
define backend_command
export `grep -v '^#' $(DEV_ENV_FILE) | xargs -0` && \
export BROKER_TYPE=$(BROKER_TYPE) && \
. ./venv/bin/activate && \
cd engine && \
$(1)
endef

backend-bootstrap:
pip install -U pip wheel pip-tools
pip-sync $(REQUIREMENTS_TXT) $(REQUIREMENTS_DEV_TXT)
python3.11 -m venv $(VENV_DIR)
$(VENV_DIR)/bin/pip install -U pip wheel pip-tools
$(VENV_DIR)/bin/pip-sync $(REQUIREMENTS_TXT) $(REQUIREMENTS_DEV_TXT)
@if [ -f $(REQUIREMENTS_ENTERPRISE_TXT) ]; then \
pip-sync $(REQUIREMENTS_ENTERPRISE_TXT); \
$(VENV_DIR)/bin/pip install -r $(REQUIREMENTS_ENTERPRISE_TXT); \
fi

backend-migrate:
$(call backend_command,python manage.py migrate)

backend-compile-deps:
pip-compile --resolver=backtracking --pre --strip-extras $(REQUIREMENTS_IN)
pip-compile --resolver=backtracking --pre --strip-extras $(REQUIREMENTS_DEV_IN)
pip-compile --strip-extras $(REQUIREMENTS_IN)
pip-compile --strip-extras $(REQUIREMENTS_DEV_IN)

backend-upgrade-deps:
pip-compile --resolver=backtracking --pre --strip-extras --upgrade $(REQUIREMENTS_IN)
pip-compile --strip-extras --upgrade $(REQUIREMENTS_IN)

run-backend-server:
$(call backend_command,python manage.py runserver 0.0.0.0:8080)
Expand Down
2 changes: 1 addition & 1 deletion Tiltfile
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ docker_build_sub(
live_update=[
sync("./engine/", "/etc/app"),
run(
"cd /etc/app && pip install -r requirements.txt",
"cd /etc/app && pip install pip-tools && pip-sync",
trigger="./engine/requirements.txt",
),
],
Expand Down
6 changes: 2 additions & 4 deletions dev/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -216,13 +216,11 @@ See the `django-silk` documentation [here](https://github.com/jazzband/django-si
By default everything runs inside Docker. If you would like to run the backend services outside of Docker
(for integrating w/ PyCharm for example), follow these instructions:

1. Create a Python 3.11 virtual environment using a method of your choosing (ex.
[venv](https://docs.python.org/3.11/library/venv.html) or [pyenv-virtualenv](https://github.com/pyenv/pyenv-virtualenv)).
Make sure the virtualenv is "activated".
1. Make sure you have Python 3.11 installed.
2. `postgres` is a dependency on some of our Python dependencies (notably `psycopg2`
([docs](https://www.psycopg.org/docs/install.html#prerequisites))). Please visit
[here](https://www.postgresql.org/download/) for installation instructions.
3. `make backend-bootstrap` - installs all backend dependencies
3. `make backend-bootstrap` - will create the virtual env and install all backend dependencies
4. Modify your `.env.dev` by copying the contents of one of `.env.mysql.dev`, `.env.postgres.dev`,
or `.env.sqlite.dev` into `.env.dev` (you should exclude the `GF_` prefixed environment variables).

Expand Down

0 comments on commit e9c9b5c

Please sign in to comment.