Skip to content

Commit

Permalink
Add ruff lint
Browse files Browse the repository at this point in the history
  • Loading branch information
grieve54706 committed Jun 6, 2024
1 parent 1201621 commit fd68736
Show file tree
Hide file tree
Showing 6 changed files with 145 additions and 2 deletions.
5 changes: 5 additions & 0 deletions .github/workflows/ibis-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,11 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Ruff check
uses: chartboost/ruff-action@v1
with:
src: './ibis-server'
changed-files: 'true'
- name: Start Wren JAVA engine
working-directory: ./example/duckdb-tpch-example
run: |
Expand Down
10 changes: 10 additions & 0 deletions ibis-server/.pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
repos:
- repo: https://github.com/astral-sh/ruff-pre-commit
# Ruff version.
rev: v0.4.8
hooks:
# Run the linter.
- id: ruff
args: [ --fix ]
# Run the formatter.
- id: ruff-format
11 changes: 11 additions & 0 deletions ibis-server/Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
install:
poetry install

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

define port-command
$(shell [ -z "$(PORT)" ] && echo "" || echo "--port $(PORT)")
endef
Expand All @@ -19,3 +22,11 @@ docker-build:

docker-run:
docker run -it --rm -p 8000:8000 --env-file .env wren-engine-ibis

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

fmt:
poetry run ruff format .
poetry run ruff check --fix .
3 changes: 2 additions & 1 deletion ibis-server/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ make run
### 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
- Create `.env` file and fill in the environment variables
Expand All @@ -88,4 +89,4 @@ make run

### Docker
- Build the image: `make docker-build`
- Run the container: `make docker-run`
- Run the container: `make docker-run`
113 changes: 112 additions & 1 deletion ibis-server/poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions ibis-server/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ pandas = "2.2.2"
pytest = "8.2.0"
testcontainers = {extras = ["postgres"], version = "4.5.0"}
sqlalchemy = "2.0.30"
pre-commit = "3.7.1"
ruff = "0.4.8"

[tool.pytest.ini_options]
addopts = "--strict-markers"
Expand All @@ -31,6 +33,9 @@ markers = [
"snowflake: mark a test as a snowflake test",
]

[tool.ruff]
target-version = "py311"

[build-system]
requires = ["poetry-core"]
build-backend = "poetry.core.masonry.api"

0 comments on commit fd68736

Please sign in to comment.