<commit_before>.PHONY: clean coverage develop env extras package release test virtualenv build_ext shell docs doc-sources gh-pages

PYMODULE := clustering_metrics
PYPI_HOST := pypi
DISTRIBUTE := sdist bdist_wheel
SHELL_PRELOAD := $(PYMODULE)/_workspace.py

SRC_ROOT := $(patsubst %/,%,$(dir $(abspath $(lastword $(MAKEFILE_LIST)))))
SHELL_PRELOAD := $(SRC_ROOT)/$(SHELL_PRELOAD)

EXTENSION_PYX := $(shell find $(PYMODULE) -type f -name '*.pyx')
EXTENSION_PYX_MOD := $(patsubst %.pyx,%.cpp,$(EXTENSION_PYX))

EXTENSION_PYF := $(shell find $(PYMODULE) -type f -name '*.pyf')
EXTENSION_PYF_MOD := $(patsubst %.pyf,%module.c,$(EXTENSION_PYF))

EXTENSION_SO := \
	$(patsubst %.pyf,%.so,$(EXTENSION_PYF)) \
	$(patsubst %.cpp,%.so,$(EXTENSION_PYX_MOD))

EXTRAS_REQS := $(wildcard extras-*-requirements.txt)

PYENV := . env/bin/activate;
PYTHON := $(PYENV) python
PIP := $(PYENV) pip


doc-sources:
	sphinx-apidoc \
		-A "`$(PYTHON) setup.py --author`" \
		-H "`$(PYTHON) setup.py --name`" \
		-V "`$(PYTHON) setup.py --version`" \
		-f -e -d 4 -F -o docs $(PYMODULE)
	-git checkout docs/conf.py
	-git checkout docs/Makefile
	-git add docs/index.rst
	-git commit -m"update doc sources"

docs: env build_ext
	$(PYENV) cd docs; make html; cd ..
	@echo "The doc index is: docs/_build/html/index.html"

gh-pages:
	git checkout --orphan gh-pages || git checkout gh-pages
	git reset
	find . -path ./.git -prune -o -path ./env -prune -o -path ./docs/_build/html -prune -o -type f -exec rm -f {} \;
	cp -R docs/_build/html/* .
	echo "" > .gitignore
	echo "docs/" >> .gitignore
	echo "env/" >> .gitignore
	touch .nojekyll
	-git commit -a -m"add github pages"
	git push --set-upstream origin gh-pages || git push origin
	git checkout master

package: env build_ext
	$(PYTHON) setup.py $(DISTRIBUTE)

release: env build_ext
	$(PYTHON) setup.py $(DISTRIBUTE) upload -r $(PYPI_HOST)

# if in local dev on Mac, `make coverage` will run tests and open
# coverage report in the browser
ifeq ($(shell uname -s), Darwin)
coverage: test
	open cover/index.html
endif

test: env build_ext
	# make sure package can be pip-installed from local directory
	$(PIP) install -e .
	# run tests
	$(PYENV) $(ENV_EXTRA) python `which nosetests` $(NOSEARGS)

shell: extras build_ext<commit_msg>yet another update to gh-pages target<commit_after>.PHONY: clean coverage develop env extras package release test virtualenv build_ext shell docs doc-sources gh-pages

PYMODULE := clustering_metrics
PYPI_HOST := pypi
DISTRIBUTE := sdist bdist_wheel
SHELL_PRELOAD := $(PYMODULE)/_workspace.py

SRC_ROOT := $(patsubst %/,%,$(dir $(abspath $(lastword $(MAKEFILE_LIST)))))
SHELL_PRELOAD := $(SRC_ROOT)/$(SHELL_PRELOAD)

EXTENSION_PYX := $(shell find $(PYMODULE) -type f -name '*.pyx')
EXTENSION_PYX_MOD := $(patsubst %.pyx,%.cpp,$(EXTENSION_PYX))

EXTENSION_PYF := $(shell find $(PYMODULE) -type f -name '*.pyf')
EXTENSION_PYF_MOD := $(patsubst %.pyf,%module.c,$(EXTENSION_PYF))

EXTENSION_SO := \
	$(patsubst %.pyf,%.so,$(EXTENSION_PYF)) \
	$(patsubst %.cpp,%.so,$(EXTENSION_PYX_MOD))

EXTRAS_REQS := $(wildcard extras-*-requirements.txt)

PYENV := . env/bin/activate;
PYTHON := $(PYENV) python
PIP := $(PYENV) pip


doc-sources:
	sphinx-apidoc \
		-A "`$(PYTHON) setup.py --author`" \
		-H "`$(PYTHON) setup.py --name`" \
		-V "`$(PYTHON) setup.py --version`" \
		-f -e -d 4 -F -o docs $(PYMODULE)
	-git checkout docs/conf.py
	-git checkout docs/Makefile
	-git add docs/index.rst
	-git commit -m"update doc sources"

docs: env build_ext
	$(PYENV) cd docs; make html; cd ..
	@echo "The doc index is: docs/_build/html/index.html"

gh-pages:
	git checkout --orphan gh-pages || git checkout gh-pages
	git reset
	find . -path ./.git -prune -o -path ./env -prune -o -path ./docs/_build/html -prune -o -type f -exec rm -f {} \;
	cp -R docs/_build/html/* .
	echo "" > .gitignore
	echo "docs/" >> .gitignore
	echo "env/" >> .gitignore
	touch .nojekyll
	-git add -A
	-git commit -a -m"update github pages"
	git push --set-upstream origin gh-pages || git push origin
	git checkout master

package: env build_ext
	$(PYTHON) setup.py $(DISTRIBUTE)

release: env build_ext
	$(PYTHON) setup.py $(DISTRIBUTE) upload -r $(PYPI_HOST)

# if in local dev on Mac, `make coverage` will run tests and open
# coverage report in the browser
ifeq ($(shell uname -s), Darwin)
coverage: test
	open cover/index.html
endif

test: env build_ext
	# make sure package can be pip-installed from local directory
	$(PIP) install -e .
	# run tests
	$(PYENV) $(ENV_EXTRA) python `which nosetests` $(NOSEARGS)

shell: extras build_ext
{'fraction_non_alphanumeric': 0.15904091509018917, 'fraction_numerical': 0.0004399472063352398, 'mean_word_length': 3.8839957035445756, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '428786', 'n_tokens_mistral': 1797, 'n_tokens_neox': 1718, 'n_words': 503}