Skip to content

Commit

Permalink
chore(python): Fix pip warning filter return code (#13935)
Browse files Browse the repository at this point in the history
  • Loading branch information
stinodego authored Jan 23, 2024
1 parent 6a8a90d commit d3ceeac
Showing 1 changed file with 12 additions and 9 deletions.
21 changes: 12 additions & 9 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ else
VENV_BIN=$(VENV)/bin
endif

# Define command to filter pip warnings when running maturin
FILTER_PIP_WARNINGS=| grep -v "don't match your environment"; test $${PIPESTATUS[0]} -eq 0

.venv: ## Set up Python virtual environment and install requirements
python3 -m venv $(VENV)
$(MAKE) requirements
Expand All @@ -26,55 +29,55 @@ requirements: .venv ## Install/refresh Python project requirements
build: .venv ## Compile and install Python Polars for development
@unset CONDA_PREFIX && source $(VENV_BIN)/activate \
&& maturin develop -m py-polars/Cargo.toml \
| grep -v "don't match your environment" || true
$(FILTER_PIP_WARNINGS)

.PHONY: build-debug-opt
build-debug-opt: .venv ## Compile and install Python Polars with minimal optimizations turned on
@unset CONDA_PREFIX && source $(VENV_BIN)/activate \
&& maturin develop -m py-polars/Cargo.toml --profile opt-dev \
| grep -v "don't match your environment" || true
$(FILTER_PIP_WARNINGS)

.PHONY: build-debug-opt-subset
build-debug-opt-subset: .venv ## Compile and install Python Polars with minimal optimizations turned on and no default features
@unset CONDA_PREFIX && source $(VENV_BIN)/activate \
&& maturin develop -m py-polars/Cargo.toml --no-default-features --profile opt-dev \
| grep -v "don't match your environment" || true
$(FILTER_PIP_WARNINGS)

.PHONY: build-opt
build-opt: .venv ## Compile and install Python Polars with nearly full optimization on and debug assertions turned off, but with debug symbols on
@unset CONDA_PREFIX && source $(VENV_BIN)/activate \
&& maturin develop -m py-polars/Cargo.toml --profile debug-release \
| grep -v "don't match your environment" || true
$(FILTER_PIP_WARNINGS)

.PHONY: build-release
build-release: .venv ## Compile and install a faster Python Polars binary with full optimizations
@unset CONDA_PREFIX && source $(VENV_BIN)/activate \
&& maturin develop -m py-polars/Cargo.toml --release \
| grep -v "don't match your environment" || true
$(FILTER_PIP_WARNINGS)

.PHONY: build-native
build-native: .venv ## Same as build, except with native CPU optimizations turned on
@unset CONDA_PREFIX && source $(VENV_BIN)/activate \
&& maturin develop -m py-polars/Cargo.toml -- -C target-cpu=native \
| grep -v "don't match your environment" || true
$(FILTER_PIP_WARNINGS)

.PHONY: build-debug-opt-native
build-debug-opt-native: .venv ## Same as build-debug-opt, except with native CPU optimizations turned on
@unset CONDA_PREFIX && source $(VENV_BIN)/activate \
&& maturin develop -m py-polars/Cargo.toml --profile opt-dev -- -C target-cpu=native \
| grep -v "don't match your environment" || true
$(FILTER_PIP_WARNINGS)

.PHONY: build-opt-native
build-opt-native: .venv ## Same as build-opt, except with native CPU optimizations turned on
@unset CONDA_PREFIX && source $(VENV_BIN)/activate \
&& maturin develop -m py-polars/Cargo.toml --profile debug-release -- -C target-cpu=native \
| grep -v "don't match your environment" || true
$(FILTER_PIP_WARNINGS)

.PHONY: build-release-native
build-release-native: .venv ## Same as build-release, except with native CPU optimizations turned on
@unset CONDA_PREFIX && source $(VENV_BIN)/activate \
&& maturin develop -m py-polars/Cargo.toml --release -- -C target-cpu=native \
| grep -v "don't match your environment" || true
$(FILTER_PIP_WARNINGS)

.PHONY: clippy
clippy: ## Run clippy with all features
Expand Down

0 comments on commit d3ceeac

Please sign in to comment.