From 8f2f40f6c374bb9683921270ebca42c9461a77ae Mon Sep 17 00:00:00 2001 From: Stijn de Gooijer Date: Sun, 26 Mar 2023 07:06:52 +0200 Subject: [PATCH 1/3] chore(python): Rename `venv` folder to `.venv` --- .github/workflows/benchmark.yml | 4 ++-- .github/workflows/test-python.yml | 4 ++-- .gitignore | 2 +- CONTRIBUTING.md | 2 +- dprint.json | 3 ++- py-polars/.gitignore | 2 +- py-polars/Makefile | 20 ++++++++++---------- 7 files changed, 19 insertions(+), 18 deletions(-) diff --git a/.github/workflows/benchmark.yml b/.github/workflows/benchmark.yml index 6c79a08100dd..df7073ce11e7 100644 --- a/.github/workflows/benchmark.yml +++ b/.github/workflows/benchmark.yml @@ -28,8 +28,8 @@ jobs: - name: Create virtual environment working-directory: py-polars run: | - python -m venv venv - echo "$GITHUB_WORKSPACE/py-polars/venv/bin" >> $GITHUB_PATH + python -m venv .venv + echo "$GITHUB_WORKSPACE/py-polars/.venv/bin" >> $GITHUB_PATH - name: Install Python dependencies working-directory: py-polars diff --git a/.github/workflows/test-python.yml b/.github/workflows/test-python.yml index b32fd7af9968..47cd415162d4 100644 --- a/.github/workflows/test-python.yml +++ b/.github/workflows/test-python.yml @@ -35,8 +35,8 @@ jobs: - name: Create virtual environment run: | - python -m venv venv - echo "$GITHUB_WORKSPACE/py-polars/venv/bin" >> $GITHUB_PATH + python -m venv .venv + echo "$GITHUB_WORKSPACE/py-polars/.venv/bin" >> $GITHUB_PATH - name: Install dependencies run: | diff --git a/.gitignore b/.gitignore index b39db3fa274d..ccc058663a70 100644 --- a/.gitignore +++ b/.gitignore @@ -22,5 +22,5 @@ data/ node_modules/ polars/vendor target/ -venv/ +.venv/ .vim diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 3459e277297e..1d0f9bccd8b3 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -87,7 +87,7 @@ make test This will do a number of things: -- Use Python to create a virtual environment in the `py-polars/venv` folder. +- Use Python to create a virtual environment in the `py-polars/.venv` folder. - Use [pip](https://pip.pypa.io/) to install all Python dependencies for development, linting, and building documentation. - Use Rust to compile and install Polars in your virtual environment. - Use [pytest](https://docs.pytest.org/) to run the Python unittests in your virtual environment diff --git a/dprint.json b/dprint.json index a62e1a4b1bbd..60290669328c 100644 --- a/dprint.json +++ b/dprint.json @@ -4,7 +4,8 @@ ], "excludes": [ "**/target", - "py-polars/venv" + "py-polars/.pytest_cache", + "py-polars/.venv" ], "plugins": [ "https://plugins.dprint.dev/markdown-0.15.2.wasm", diff --git a/py-polars/.gitignore b/py-polars/.gitignore index 926a743b659d..e4fee43a6878 100644 --- a/py-polars/.gitignore +++ b/py-polars/.gitignore @@ -1,7 +1,7 @@ wheels/ !Cargo.lock target/ -venv/ +.venv/ .hypothesis .DS_Store .ruff_cache/ diff --git a/py-polars/Makefile b/py-polars/Makefile index c7a1576a3d7e..bb1b9882c41d 100644 --- a/py-polars/Makefile +++ b/py-polars/Makefile @@ -2,7 +2,7 @@ PYTHONPATH= SHELL=/bin/bash -VENV = venv +VENV = .venv ifeq ($(OS),Windows_NT) VENV_BIN=$(VENV)/Scripts @@ -10,7 +10,7 @@ else VENV_BIN=$(VENV)/bin endif -venv: ## Set up virtual environment +.venv: ## Set up virtual environment python3 -m venv $(VENV) $(VENV_BIN)/python -m pip install --upgrade pip $(VENV_BIN)/pip install -r requirements-dev.txt @@ -18,15 +18,15 @@ venv: ## Set up virtual environment $(VENV_BIN)/pip install -r docs/requirements-docs.txt .PHONY: build -build: venv ## Compile and install Polars for development +build: .venv ## Compile and install Polars for development @unset CONDA_PREFIX && source $(VENV_BIN)/activate && maturin develop .PHONY: build-release -build-release: venv ## Compile and install a faster Polars binary +build-release: .venv ## Compile and install a faster Polars binary @unset CONDA_PREFIX && source $(VENV_BIN)/activate && maturin develop --release .PHONY: fmt -fmt: venv ## Run autoformatting and linting +fmt: .venv ## Run autoformatting and linting $(VENV_BIN)/black . $(VENV_BIN)/blackdoc . $(VENV_BIN)/ruff . @@ -43,25 +43,25 @@ clippy: ## Run clippy pre-commit: fmt clippy ## Run all code quality checks .PHONY: test -test: venv build ## Run fast unittests +test: .venv build ## Run fast unittests $(VENV_BIN)/pytest -n auto --dist worksteal .PHONY: doctest -doctest: venv build ## Run doctests +doctest: .venv build ## Run doctests $(VENV_BIN)/python tests/docs/run_doctest.py .PHONY: test-all -test-all: venv build ## Run all tests +test-all: .venv build ## Run all tests $(VENV_BIN)/pytest -n auto --dist worksteal -m "slow or not slow" $(VENV_BIN)/python tests/docs/run_doctest.py .PHONY: coverage -coverage: venv build ## Run tests and report coverage +coverage: .venv build ## Run tests and report coverage $(VENV_BIN)/pytest --cov -n auto --dist worksteal -m "not benchmark" .PHONY: clean clean: ## Clean up caches and build artifacts - @rm -rf venv/ + @rm -rf .venv/ @rm -rf target/ @rm -rf docs/build/ @rm -rf docs/source/reference/api/ From 31ff8f9051d536d02fb8916a96e1edb78c72e41e Mon Sep 17 00:00:00 2001 From: konstin Date: Sat, 25 Mar 2023 13:02:33 +0100 Subject: [PATCH 2/3] Use maturin v1.0.0-beta.5 with PEP 704 (.venv) support --- README.md | 2 +- examples/python_rust_compiled_function/pyproject.toml | 2 +- py-polars/pyproject.toml | 2 +- py-polars/requirements-dev.txt | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index fac262bfa067..328df623c218 100644 --- a/README.md +++ b/README.md @@ -178,7 +178,7 @@ If you want a bleeding edge release or maximal performance you should compile ** This can be done by going through the following steps in sequence: 1. Install the latest [Rust compiler](https://www.rust-lang.org/tools/install) -2. Install [maturin](https://maturin.rs/): `pip install maturin` +2. Install [maturin](https://maturin.rs/): `pip install maturin==v1.0.0-beta.5` 3. Choose any of: - Fastest binary, very long compile times: ```sh diff --git a/examples/python_rust_compiled_function/pyproject.toml b/examples/python_rust_compiled_function/pyproject.toml index cde5434f8129..660b9e9df7ce 100644 --- a/examples/python_rust_compiled_function/pyproject.toml +++ b/examples/python_rust_compiled_function/pyproject.toml @@ -1,5 +1,5 @@ [build-system] -requires = ["maturin>=0.14,<0.15"] +requires = ["maturin==v1.0.0-beta.5"] build-backend = "maturin" [project] diff --git a/py-polars/pyproject.toml b/py-polars/pyproject.toml index 3a4ff75162b4..20716d5c74cd 100644 --- a/py-polars/pyproject.toml +++ b/py-polars/pyproject.toml @@ -1,5 +1,5 @@ [build-system] -requires = ["maturin>=0.14,<0.15"] +requires = ["maturin==v1.0.0-beta.5"] build-backend = "maturin" [project] diff --git a/py-polars/requirements-dev.txt b/py-polars/requirements-dev.txt index 60bb82acea7d..971cceac6c60 100644 --- a/py-polars/requirements-dev.txt +++ b/py-polars/requirements-dev.txt @@ -18,7 +18,7 @@ connectorx==0.3.2a2; python_version >= '3.8' # Latest full release is broken - # Tooling hypothesis==6.68.2 -maturin==0.14.10 +maturin==v1.0.0-beta.5 pytest==7.2.0 pytest-cov==4.0.0 pytest-xdist==3.2.0 From 3bf0135c5e1958813357eaf88f07011507ad7afd Mon Sep 17 00:00:00 2001 From: konstin Date: Mon, 27 Mar 2023 20:52:12 +0200 Subject: [PATCH 3/3] merge fixup --- py-polars/Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/py-polars/Makefile b/py-polars/Makefile index db3e02093e43..066064dc6db5 100644 --- a/py-polars/Makefile +++ b/py-polars/Makefile @@ -23,11 +23,11 @@ requirements: .venv ## Install/refresh all project requirements .PHONY: build build: .venv ## Compile and install Polars for development - @unset CONDA_PREFIX && source $(VENV_BIN)/activate && maturin develop + @unset CONDA_PREFIX && maturin develop .PHONY: build-release build-release: .venv ## Compile and install a faster Polars binary - @unset CONDA_PREFIX && source $(VENV_BIN)/activate && maturin develop --release + @unset CONDA_PREFIX && maturin develop --release .PHONY: fmt fmt: .venv ## Run autoformatting and linting