diff --git a/.gitignore b/.gitignore index b80a55ba2..9f65b4732 100644 --- a/.gitignore +++ b/.gitignore @@ -11,6 +11,7 @@ __pycache__ *.swp *.txt output.json +path.json *.parquet docs/people.md user_guide/src/examples/target @@ -18,6 +19,7 @@ user_guide/src/examples/target cargo.lock .DS_Store +node_modules # Added by cargo /target diff --git a/Makefile b/Makefile new file mode 100644 index 000000000..722e8ef69 --- /dev/null +++ b/Makefile @@ -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' \ No newline at end of file diff --git a/README.md b/README.md index c7dc28f5d..cef0e177b 100644 --- a/README.md +++ b/README.md @@ -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 diff --git a/package-lock.json b/package-lock.json new file mode 100644 index 000000000..1685a29f5 --- /dev/null +++ b/package-lock.json @@ -0,0 +1,284 @@ +{ + "name": "polars-book", + "lockfileVersion": 3, + "requires": true, + "packages": { + "": { + "dependencies": { + "chance": "^1.1.11" + }, + "devDependencies": { + "nodejs-polars": "0.8.0", + "rome": "12.1.3" + } + }, + "node_modules/@rometools/cli-darwin-arm64": { + "version": "12.1.3", + "resolved": "https://registry.npmjs.org/@rometools/cli-darwin-arm64/-/cli-darwin-arm64-12.1.3.tgz", + "integrity": "sha512-AmFTUDYjBuEGQp/Wwps+2cqUr+qhR7gyXAUnkL5psCuNCz3807TrUq/ecOoct5MIavGJTH6R4aaSL6+f+VlBEg==", + "cpu": [ + "arm64" + ], + "dev": true, + "optional": true, + "os": [ + "darwin" + ] + }, + "node_modules/@rometools/cli-darwin-x64": { + "version": "12.1.3", + "resolved": "https://registry.npmjs.org/@rometools/cli-darwin-x64/-/cli-darwin-x64-12.1.3.tgz", + "integrity": "sha512-k8MbWna8q4LRlb005N2X+JS1UQ+s3ZLBBvwk4fP8TBxlAJXUz17jLLu/Fi+7DTTEmMhM84TWj4FDKW+rNar28g==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "darwin" + ] + }, + "node_modules/@rometools/cli-linux-arm64": { + "version": "12.1.3", + "resolved": "https://registry.npmjs.org/@rometools/cli-linux-arm64/-/cli-linux-arm64-12.1.3.tgz", + "integrity": "sha512-X/uLhJ2/FNA3nu5TiyeNPqiD3OZoFfNfRvw6a3ut0jEREPvEn72NI7WPijH/gxSz55znfQ7UQ6iM4DZumUknJg==", + "cpu": [ + "arm64" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rometools/cli-linux-x64": { + "version": "12.1.3", + "resolved": "https://registry.npmjs.org/@rometools/cli-linux-x64/-/cli-linux-x64-12.1.3.tgz", + "integrity": "sha512-csP17q1eWiUXx9z6Jr/JJPibkplyKIwiWPYNzvPCGE8pHlKhwZj3YHRuu7Dm/4EOqx0XFIuqqWZUYm9bkIC8xg==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rometools/cli-win32-arm64": { + "version": "12.1.3", + "resolved": "https://registry.npmjs.org/@rometools/cli-win32-arm64/-/cli-win32-arm64-12.1.3.tgz", + "integrity": "sha512-RymHWeod57EBOJY4P636CgUwYA6BQdkQjh56XKk4pLEHO6X1bFyMet2XL7KlHw5qOTalzuzf5jJqUs+vf3jdXQ==", + "cpu": [ + "arm64" + ], + "dev": true, + "optional": true, + "os": [ + "win32" + ] + }, + "node_modules/@rometools/cli-win32-x64": { + "version": "12.1.3", + "resolved": "https://registry.npmjs.org/@rometools/cli-win32-x64/-/cli-win32-x64-12.1.3.tgz", + "integrity": "sha512-yHSKYidqJMV9nADqg78GYA+cZ0hS1twANAjiFibQdXj9aGzD+s/IzIFEIi/U/OBLvWYg/SCw0QVozi2vTlKFDQ==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "win32" + ] + }, + "node_modules/chance": { + "version": "1.1.11", + "resolved": "https://registry.npmjs.org/chance/-/chance-1.1.11.tgz", + "integrity": "sha512-kqTg3WWywappJPqtgrdvbA380VoXO2eu9VCV895JgbyHsaErXdyHK9LOZ911OvAk6L0obK7kDk9CGs8+oBawVA==" + }, + "node_modules/nodejs-polars": { + "version": "0.8.0", + "resolved": "https://registry.npmjs.org/nodejs-polars/-/nodejs-polars-0.8.0.tgz", + "integrity": "sha512-77Nhx+AYvCLq4ciVBQbvx1x0iRuPdLZgc59vx2Gund6c3/eEqlfX8C8xgzsfUh0OCpnIbiXsrI8gBuZbFc8YnA==", + "dev": true, + "engines": { + "node": ">= 16" + }, + "optionalDependencies": { + "nodejs-polars-android-arm64": "0.8.0", + "nodejs-polars-darwin-arm64": "0.8.0", + "nodejs-polars-darwin-x64": "0.8.0", + "nodejs-polars-linux-arm64-gnu": "0.8.0", + "nodejs-polars-linux-arm64-musl": "0.8.0", + "nodejs-polars-linux-x64-gnu": "0.8.0", + "nodejs-polars-linux-x64-musl": "0.8.0", + "nodejs-polars-win32-ia32-msvc": "0.8.0", + "nodejs-polars-win32-x64-msvc": "0.8.0" + } + }, + "node_modules/nodejs-polars-android-arm64": { + "version": "0.8.0", + "resolved": "https://registry.npmjs.org/nodejs-polars-android-arm64/-/nodejs-polars-android-arm64-0.8.0.tgz", + "integrity": "sha512-VoR+N1pzo0qApepQZs2IcO5+0Pi7asZbQG0C8Ztov8jEsNNG1A5cCmrjxR5ZbB8LRmas6w84zZu5xo1Uo/nPww==", + "cpu": [ + "arm64" + ], + "dev": true, + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">= 16" + } + }, + "node_modules/nodejs-polars-darwin-arm64": { + "version": "0.8.0", + "resolved": "https://registry.npmjs.org/nodejs-polars-darwin-arm64/-/nodejs-polars-darwin-arm64-0.8.0.tgz", + "integrity": "sha512-UQVgpb79zylNivzbPMIKyk9upPc1xMmo8uE5z8CoQlkDG4sfIsTl0WHH2IbDmzS1laMLkLfuHnbrVyZMSF9u6Q==", + "cpu": [ + "arm64" + ], + "dev": true, + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">= 16" + } + }, + "node_modules/nodejs-polars-darwin-x64": { + "version": "0.8.0", + "resolved": "https://registry.npmjs.org/nodejs-polars-darwin-x64/-/nodejs-polars-darwin-x64-0.8.0.tgz", + "integrity": "sha512-plbOADc3UCSzNeYB/wPyA9jVei/eW1wAREHC326n6FNpvCCTO9bIku1WySDnF7abO/TnnFaxqdAmM+Sl8lU/jA==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">= 16" + } + }, + "node_modules/nodejs-polars-linux-arm64-gnu": { + "version": "0.8.0", + "resolved": "https://registry.npmjs.org/nodejs-polars-linux-arm64-gnu/-/nodejs-polars-linux-arm64-gnu-0.8.0.tgz", + "integrity": "sha512-EeXiYuE4gMjf9LTxOz0TPilSMRYsY7Jh/AnhyKpgevaJVWzf/tUeH6CPizMzF/nFsQnGfZ6SK2dQv3cCj9LmIQ==", + "cpu": [ + "arm64" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">= 16" + } + }, + "node_modules/nodejs-polars-linux-arm64-musl": { + "version": "0.8.0", + "resolved": "https://registry.npmjs.org/nodejs-polars-linux-arm64-musl/-/nodejs-polars-linux-arm64-musl-0.8.0.tgz", + "integrity": "sha512-JSnO/d27ScWPO0595MYzsgm/62PTBC8k1Er41l07hTDzl199ZAgcOal9jWGbq8Cv2r0xTpoGKKjNuA6UfdUhbw==", + "cpu": [ + "arm64" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">= 16" + } + }, + "node_modules/nodejs-polars-linux-x64-gnu": { + "version": "0.8.0", + "resolved": "https://registry.npmjs.org/nodejs-polars-linux-x64-gnu/-/nodejs-polars-linux-x64-gnu-0.8.0.tgz", + "integrity": "sha512-JfPQhd11ufph0aWUKIVI68nVGi5laO7w+tfBvDLcrcwZg0HiVg3zcgM1+8rpwXsi0z/Q8wQO/lqXESjM9nu5kQ==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">= 16" + } + }, + "node_modules/nodejs-polars-linux-x64-musl": { + "version": "0.8.0", + "resolved": "https://registry.npmjs.org/nodejs-polars-linux-x64-musl/-/nodejs-polars-linux-x64-musl-0.8.0.tgz", + "integrity": "sha512-cfqFcpJS5uWTpApX7Ct9F9pHD8T4g6U7qtYcsffqa2U904js9fcYYfAfNbAtvkQLzb9msMdZpZ5jVW5AmXlb1g==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">= 16" + } + }, + "node_modules/nodejs-polars-win32-ia32-msvc": { + "version": "0.8.0", + "resolved": "https://registry.npmjs.org/nodejs-polars-win32-ia32-msvc/-/nodejs-polars-win32-ia32-msvc-0.8.0.tgz", + "integrity": "sha512-FS4fzEAzZGwIfYuEUgey8QOAqB6yIeeNrC+zjhJUm1wCMUg9nJYKDvHf6dlyo8I1LHaPKxeruI8qrUetuVgmpg==", + "cpu": [ + "ia32" + ], + "dev": true, + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">= 16" + } + }, + "node_modules/nodejs-polars-win32-x64-msvc": { + "version": "0.8.0", + "resolved": "https://registry.npmjs.org/nodejs-polars-win32-x64-msvc/-/nodejs-polars-win32-x64-msvc-0.8.0.tgz", + "integrity": "sha512-uucDbxpOkbJTm/Vr9FpDQZgloPHjWxP0EAFave89xnrVyrLI6WQy1s0+7OWF4iVDGb2yXMCw2vqFHTrZFS8EuQ==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">= 16" + } + }, + "node_modules/rome": { + "version": "12.1.3", + "resolved": "https://registry.npmjs.org/rome/-/rome-12.1.3.tgz", + "integrity": "sha512-e+ff72hxDpe/t5/Us7YRBVw3PBET7SeczTQNn6tvrWdrCaAw3qOukQQ+tDCkyFtS4yGsnhjrJbm43ctNbz27Yg==", + "dev": true, + "hasInstallScript": true, + "bin": { + "rome": "bin/rome" + }, + "engines": { + "node": ">=14.*" + }, + "optionalDependencies": { + "@rometools/cli-darwin-arm64": "12.1.3", + "@rometools/cli-darwin-x64": "12.1.3", + "@rometools/cli-linux-arm64": "12.1.3", + "@rometools/cli-linux-x64": "12.1.3", + "@rometools/cli-win32-arm64": "12.1.3", + "@rometools/cli-win32-x64": "12.1.3" + } + } + } +} diff --git a/package.json b/package.json new file mode 100644 index 000000000..3cc28d1d2 --- /dev/null +++ b/package.json @@ -0,0 +1,9 @@ +{ + "devDependencies": { + "nodejs-polars": "0.8.0", + "rome": "12.1.3" + }, + "dependencies": { + "chance": "^1.1.11" + } +}