Skip to content

Commit

Permalink
use virtualenv (#2025)
Browse files Browse the repository at this point in the history
  • Loading branch information
ritchie46 committed Dec 11, 2021
1 parent 04aa99c commit 7ea98c7
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 28 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ jobs:
- name: Run tests
run: |
export RUSTFLAGS="-C debuginfo=0"
cd py-polars && rustup override set nightly-2021-12-02 && make build-and-test-with-cov
cd py-polars && rustup override set nightly-2021-12-02 && make venv && make test-with-cov
cargo clippy
- name: Check doc examples
run: |
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test-windows.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ jobs:
shell: bash
run: |
export RUSTFLAGS="-C debuginfo=0"
cd py-polars && rustup override set nightly-2021-12-02 && make build-and-test
cd py-polars && rustup override set nightly-2021-12-02 && make build-and-test-no-venv
cargo clippy
# test if we can import polars without any requirements
- name: Import polars
Expand Down
1 change: 1 addition & 0 deletions py-polars/.gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
wheels/
!Cargo.lock
target/
venv/
60 changes: 34 additions & 26 deletions py-polars/Makefile
Original file line number Diff line number Diff line change
@@ -1,40 +1,48 @@
SHELL=/bin/bash
PYTHON=venv/bin/python
PYTHON_BIN=venv/bin

.PHONY: pre-commit test pip clean

venv:
@python -m venv venv
@venv/bin/pip install -U pip
@venv/bin/pip install -r build.requirements.txt
@unset CONDA_PREFIX && source venv/bin/activate && maturin develop

clean:
@rm -r venv
@rm -r target/

pre-commit:
isort .
black .
blackdoc .
mypy
flake8 .
$(PYTHON_BIN)/isort .
$(PYTHON_BIN)/black .
$(PYTHON_BIN)/blackdoc .
$(PYTHON_BIN)/mypy
$(PYTHON_BIN) flake8 .
make -C .. fmt_toml
cargo fmt --all
$(PYTHON) -m cargo fmt --all

pip:
pip install --force-reinstall -U wheels/polars-*.whl

release-build:
maturin build --release -o wheels
test: venv
$(PYTHON_BIN)/maturin develop
$(PYTHON) -m pytest tests

release-install: release-build pip
test-with-cov: venv
@cd tests && ../$(PYTHON) -m pytest --cov=polars --import-mode=importlib

test:
maturin develop
pytest tests
doctest:
cd tests && ../$(PYTHON) run_doc_examples.py

test-with-cov:
maturin develop
cd tests && pytest --cov=polars --import-mode=importlib
install-wheel:
pip install --force-reinstall -U wheels/polars-*.whl

test-build:
build-no-venv:
maturin build -o wheels

test-install: test-build pip

build-and-test: test-install
build-and-test-no-venv:
maturin build -o wheels
pip install --force-reinstall -U wheels/polars-*.whl
pytest tests

build-and-test-with-cov: test-install
cd tests && pytest --cov=polars --import-mode=importlib
install-no-venv: build-no-venv install-wheel

doctest:
cd tests && python run_doc_examples.py

0 comments on commit 7ea98c7

Please sign in to comment.