diff --git a/Makefile b/Makefile index 1396d92e31335..c0ddf04582c4b 100644 --- a/Makefile +++ b/Makefile @@ -1,55 +1,30 @@ # simple makefile to simplify repetitive build env management tasks under posix -# caution: testing won't work on windows, see README - PYTHON ?= python -CYTHON ?= cython -PYTEST ?= pytest -# skip doctests on 32bit python -BITS := $(shell python -c 'import struct; print(8 * struct.calcsize("P"))') +all: + @echo "Please use 'make ' where is one of" + @echo " dev build scikit-learn with Meson" + @echo " clean clean scikit-learn Meson build. Very rarely needed," + @echo " one use case is when switching back to setuptools" + @echo " dev-setuptools build scikit-learn with setuptools (deprecated)" + @echo " clean-setuptools clean scikit-learn setuptools build (deprecated)" -all: clean inplace test +.PHONY: all -clean: - $(PYTHON) setup.py clean - rm -rf dist - -in: inplace # just a shortcut -inplace: - $(PYTHON) setup.py build_ext -i +dev: dev-meson dev-meson: pip install --verbose --no-build-isolation --editable . --check-build-dependencies --config-settings editable-verbose=true +clean: clean-meson + clean-meson: pip uninstall -y scikit-learn -test-code: in - $(PYTEST) --showlocals -v sklearn --durations=20 -test-sphinxext: - $(PYTEST) --showlocals -v doc/sphinxext/ -test-doc: -ifeq ($(BITS),64) - $(PYTEST) $(shell find doc -name '*.rst' | sort) -endif -test-code-parallel: in - $(PYTEST) -n auto --showlocals -v sklearn --durations=20 - -test-coverage: - rm -rf coverage .coverage - $(PYTEST) sklearn --showlocals -v --cov=sklearn --cov-report=html:coverage -test-coverage-parallel: - rm -rf coverage .coverage .coverage.* - $(PYTEST) sklearn -n auto --showlocals -v --cov=sklearn --cov-report=html:coverage - -test: test-code test-sphinxext test-doc - -cython: - python setup.py build_src - -doc: inplace - $(MAKE) -C doc html - -doc-noplot: inplace - $(MAKE) -C doc html-noplot +dev-setuptools: + $(PYTHON) setup.py build_ext -i + +clean-setuptools: + $(PYTHON) setup.py clean + rm -rf dist diff --git a/build_tools/azure/test_docs.sh b/build_tools/azure/test_docs.sh index 1258ecf69f080..48ad2763edb36 100755 --- a/build_tools/azure/test_docs.sh +++ b/build_tools/azure/test_docs.sh @@ -1,11 +1,10 @@ #!/bin/bash -set -e +set -ex -if [[ "$DISTRIB" =~ ^conda.* ]]; then - source activate $VIRTUALENV -elif [[ "$DISTRIB" == "ubuntu" || "$DISTRIB" == "pip-free-threaded" ]]; then - source $VIRTUALENV/bin/activate -fi +source build_tools/shared.sh +activate_environment -make test-doc +# XXX: for some unknown reason python -m pytest fails here in the CI, can't +# reproduce locally and not worth spending time on this +pytest $(find doc -name '*.rst' | sort) diff --git a/doc/developers/contributing.rst b/doc/developers/contributing.rst index b931b9f8d091f..afdd5e8271e53 100644 --- a/doc/developers/contributing.rst +++ b/doc/developers/contributing.rst @@ -996,7 +996,7 @@ We expect code coverage of new features to be at least around 90%. To test code coverage, you need to install the `coverage `_ package in addition to `pytest`. - 1. Run `make test-coverage`. The output lists for each file the line + 1. Run `pytest --cov sklearn /path/to/tests`. The output lists for each file the line numbers that are not tested. 2. Find a low hanging fruit, looking at which lines are not tested,