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

Use justfile instead of makefile #602

Merged
merged 2 commits into from
Jun 7, 2024
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
2 changes: 1 addition & 1 deletion .github/workflows/ibis-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ jobs:
python-version-file: ./ibis-server/pyproject.toml
cache: 'poetry'
- name: Install dependencies
run: make install
run: poetry install
- name: Run tests
env:
WREN_ENGINE_ENDPOINT: http://localhost:8080
Expand Down
32 changes: 0 additions & 32 deletions ibis-server/Makefile

This file was deleted.

23 changes: 12 additions & 11 deletions ibis-server/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,32 +61,33 @@ vim .env
```
Install the dependencies
```bash
make install
just install
```
Run the server
```bash
make run
just run
```

## Developer Guide

### Environment Setup
- Python 3.11
- Install `poetry` with version 1.7.1: `curl -sSL https://install.python-poetry.org | python3 - --version 1.7.1`
- Install pre-commit hooks: `make pre-commit-install`
- Execute `make install` to install the dependencies
- Execute `make test` to run the tests
- Install [poetry](https://github.com/python-poetry/poetry) with version 1.7.1: `curl -sSL https://install.python-poetry.org | python3 - --version 1.7.1`
- Install [casey/just](https://github.com/casey/just)
- Install [pre-commit](https://pre-commit.com) hooks: `just pre-commit-install`
- Execute `just install` to install the dependencies
- Execute `just test` to run the tests
Comment on lines +75 to +79
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Moving to just is a good improvement. However, there're many requirement tools before starting to develop this project. How about implementing a Makefile to install all of them?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As discussed offline, we leave this issue for the user to decide how to install the requirements themselves.

- Create `.env` file and fill in the environment variables

### Environment Variables
- `WREN_ENGINE_ENDPOINT`: The endpoint of the Wren Java engine
- `LOG_LEVEL`: The log level of the server. Default is `INFO`

### Start the server
- Execute `make run` to start the server
- Execute `make dev` to start the server in development mode. It will auto-reload after the code is edited.
- Default port is `8000`, you can change it by `make run PORT=8001` or `make dev PORT=8001`
- Execute `just run` to start the server
- Execute `just dev` to start the server in development mode. It will auto-reload after the code is edited.
- Default port is `8000`, you can change it by `just port=8001 run` or `just port=8001 dev`

### Docker
- Build the image: `make docker-build`
- Run the container: `make docker-run`
- Build the image: `just docker-build`
- Run the container: `just docker-run`
39 changes: 39 additions & 0 deletions ibis-server/justfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
default:
@just --list --unsorted

install:
poetry install

pre-commit-install:
poetry run pre-commit install

port := "8000"

run:
poetry run fastapi run --port {{port}}

dev:
poetry run fastapi dev --port {{port}}

test:
poetry run pytest

docker-build:
# alias for `docker-build`
dbuild:
docker image build . -t wren-engine-ibis

docker-run:
# alias for `docker-run`
drun:
docker run -it --rm -p 8000:8000 --env-file .env wren-engine-ibis

lint:
poetry run ruff format -q . --check
poetry run ruff check .

format:
# alias for `format`
fmt:
poetry run ruff format .
poetry run ruff check --fix .
Loading