Skip to content
This repository has been archived by the owner on Sep 26, 2023. It is now read-only.

Commit

Permalink
build: add makefile (#353)
Browse files Browse the repository at this point in the history
* build: add makefile

* update makefile to have additional commands

* update readme
  • Loading branch information
universalmind303 authored Jul 5, 2023
1 parent 1980708 commit 0ccaa84
Show file tree
Hide file tree
Showing 5 changed files with 356 additions and 3 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,15 @@ __pycache__
*.swp
*.txt
output.json
path.json
*.parquet
docs/people.md
user_guide/src/examples/target
.vscode
cargo.lock
.DS_Store

node_modules
# Added by cargo

/target
58 changes: 58 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
.DEFAULT_GOAL := help

PYTHONPATH=
SHELL=/bin/bash
VENV = .venv

ifeq ($(OS),Windows_NT)
VENV_BIN=$(VENV)/Scripts
else
VENV_BIN=$(VENV)/bin
endif

install-graphviz:
ifeq ($(shell uname), Darwin) # MacOS
brew install graphviz
else ifeq ($(shell uname -o), Cygwin) # Windows
choco install graphviz
else ifeq ($(shell uname -o), GNU/Linux) # Linux
if command -v apt-get >/dev/null; then sudo apt-get install -y graphviz; fi
if command -v yum >/dev/null; then sudo yum install -y graphviz; fi
if command -v dnf >/dev/null; then sudo dnf install -y graphviz; fi
if command -v pacman >/dev/null; then sudo pacman -S --noconfirm graphviz; fi
else
@echo "Could not identify OS or appropriate package manager."
endif

.venv: ## Set up virtual environment and install requirements
python3 -m venv $(VENV)
$(MAKE) requirements
$(MAKE) install-graphviz

.PHONY: node_modules
node_modules:
npm install

.PHONY: requirements
requirements: .venv
$(VENV_BIN)/python -m pip install --upgrade pip
$(VENV_BIN)/pip install -r requirements.txt

.PHONY: serve
serve: .venv
@unset CONDA_PREFIX && source $(VENV_BIN)/activate && mkdocs serve

.PHONY: lint
lint: .venv node_modules
# python
$(VENV_BIN)/black --check .
# js
npx rome format docs/src/node/

.PHONY: test-python
test-python: .venv
find docs/src/ -name "*.py" | xargs -n 1 sh -c 'python $$0 || exit 255'

.PHONY: test-node
test-node: node_modules
find docs/src/ -name "*.js" | xargs -n 1 sh -c 'node $$0 || exit 255'
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@ This repo contains the [User Guide](https://pola-rs.github.io/polars-book/user-g
The User guide is made with [Material for mkdocs](https://squidfunk.github.io/mkdocs-material/). In order to get started with building this book perform the following steps:

```shell
sudo apt-get install graphviz
pip install -r requirements.txt
make requirements

```

In order to serve the books run `mkdocs serve`. This will run all the python examples and display the output inline using the `markdown-exec` plugin.
In order to serve the books run `make serve`. This will run all the python examples and display the output inline using the `markdown-exec` plugin.

## Deployment

Expand Down
284 changes: 284 additions & 0 deletions package-lock.json

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

9 changes: 9 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"devDependencies": {
"nodejs-polars": "0.8.0",
"rome": "12.1.3"
},
"dependencies": {
"chance": "^1.1.11"
}
}

0 comments on commit 0ccaa84

Please sign in to comment.