forked from nok/sklearn-porter
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
pr/33: Merge branch 'release/0.7.3' into pr/33
- Loading branch information
Showing
271 changed files
with
11,337 additions
and
25,688 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
#!/usr/bin/env bash | ||
|
||
SCRIPTPATH="$( cd "$(dirname "$0")" ; pwd -P )" | ||
|
||
conda env create -n sklearn-porter -f $SCRIPTPATH/../environment.yml | ||
source activate sklearn-porter |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
#!/usr/bin/env bash | ||
|
||
read -r -p "Install function 'porter' to ~/.bash_profile? [y/N] " response | ||
if [[ "$response" =~ ^([yY][eE][sS]|[yY])+$ ]]; then | ||
SCRIPTPATH="$( cd "$(dirname "$0")" ; pwd -P )" | ||
cat $SCRIPTPATH/function.sh >> ~/.bash_profile | ||
source ~/.bash_profile | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
#!/usr/bin/env bash | ||
|
||
SCRIPTPATH="$( cd "$(dirname "$0")" ; pwd -P )" | ||
|
||
pip freeze | grep --quiet twine | ||
if [[ $? -eq 1 ]]; then | ||
pip install -q --no-cache-dir -r $SCRIPTPATH/../requirements.development.txt | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
#!/usr/bin/env bash | ||
|
||
SCRIPTPATH="$( cd "$(dirname "$0")" ; pwd -P )" | ||
|
||
pip freeze | grep --quiet jupyter-lab | ||
if [[ $? -eq 1 ]]; then | ||
pip install -q --no-cache-dir -r $SCRIPTPATH/../requirements.examples.txt | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
#!/usr/bin/env bash | ||
|
||
SCRIPTPATH="$( cd "$(dirname "$0")" ; pwd -P )" | ||
|
||
pip freeze | grep --quiet scikit-learn | ||
if [[ $? -eq 1 ]]; then | ||
pip install -q --no-cache-dir -r $SCRIPTPATH/../requirements.txt | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
#!/usr/bin/env bash | ||
|
||
# Set local variables: | ||
NAME=sklearn-porter | ||
ANACONDA_ENV=sklearn-porter | ||
|
||
source activate $ANACONDA_ENV | ||
|
||
VERSION=`python -c "from sklearn_porter import __version__ as ver; print(ver);"` | ||
COMMIT=`git rev-parse --short HEAD` | ||
|
||
# Environment: | ||
TARGET="https://upload.pypi.org/legacy/" | ||
read -r -p "Do you want to use the staging environment (test.pypi.org)? [y/N] " response | ||
if [[ "$response" =~ ^([yY][eE][sS]|[yY])+$ ]]; then | ||
TARGET="https://test.pypi.org/legacy/" | ||
fi | ||
|
||
# Build the package: | ||
python ./setup.py sdist bdist_wheel | ||
|
||
# Upload the package: | ||
read -r -p "Upload $NAME@$VERSION (#$COMMIT) to '$TARGET'? [y/N] " response | ||
if [[ "$response" =~ ^([yY][eE][sS]|[yY])+$ ]]; then | ||
twine upload ./dist/* --repository-url $TARGET | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
#!/usr/bin/env bash | ||
|
||
SCRIPTPATH="$( cd "$(dirname "$0")" ; pwd -P )" | ||
|
||
cd $SCRIPTPATH/../examples/estimator | ||
|
||
for py_file in $(find . -type f -name '*.pct.py') | ||
do | ||
ipynp_file="${py_file%.py}.ipynb" | ||
echo "$py_file" | ||
echo "$ipynp_file" | ||
jupytext --from "py:percent" --to "notebook" "$py_file" | ||
jupyter nbconvert --to notebook --execute "$ipynp_file" --output $(basename -- "$ipynp_file") | ||
done | ||
|
||
for json_file in $(find . -type f -name 'data.json') | ||
do | ||
echo "$json_file" | ||
rm -f "$json_file" | ||
done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
#!/usr/bin/env bash | ||
|
||
SCRIPTPATH="$( cd "$(dirname "$0")" ; pwd -P )" | ||
|
||
cd $SCRIPTPATH/.. | ||
|
||
# Dependencies: | ||
if [[ ! -f ./gson.jar ]]; then | ||
wget http://central.maven.org/maven2/com/google/code/gson/gson/2.8.5/gson-2.8.5.jar | ||
mv gson-2.8.5.jar gson.jar | ||
fi | ||
|
||
# Local server: | ||
if [[ $(python -c "import sys; print(sys.version_info[:1][0]);") == "2" ]]; then | ||
python -m SimpleHTTPServer 8713 &>/dev/null & serve_pid=$!; | ||
else | ||
python -m http.server 8713 &>/dev/null & serve_pid=$!; | ||
fi | ||
|
||
# Test params: | ||
if [[ -z "${TEST_N_RANDOM_FEATURE_SETS}" ]]; then | ||
TEST_N_RANDOM_FEATURE_SETS=25 | ||
fi | ||
if [[ -z "${TEST_N_EXISTING_FEATURE_SETS}" ]]; then | ||
TEST_N_EXISTING_FEATURE_SETS=25 | ||
fi | ||
|
||
# Tests: | ||
TEST_N_RANDOM_FEATURE_SETS=${TEST_N_RANDOM_FEATURE_SETS} \ | ||
TEST_N_EXISTING_FEATURE_SETS=${TEST_N_EXISTING_FEATURE_SETS} \ | ||
pytest tests -v -x -p no:doctest | ||
success=$? | ||
|
||
kill $serve_pid | ||
rm gson.jar | ||
|
||
exit $success |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
include readme.md requirements.txt changelog.md license.txt | ||
recursive-include sklearn_porter *.txt *.py | ||
recursive-include sklearn_porter *.py *.txt *.json |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
BASH := /bin/bash | ||
|
||
PYTHON_FILES := $(shell find -s ./sklearn_porter -name '*.py' | tr '\n' ' ') | ||
|
||
TEST_N_RANDOM_FEATURE_SETS=25 | ||
TEST_N_EXISTING_FEATURE_SETS=25 | ||
|
||
# | ||
# Requirements | ||
# | ||
|
||
install.environment: | ||
$(info Start [install.environment] ...) | ||
$(BASH) .scripts/install.environment.sh | ||
|
||
install.requirements: | ||
$(info Start [install.requirements] ...) | ||
$(BASH) .scripts/install.requirements.sh | ||
|
||
install.requirements.examples: install.requirements | ||
$(info Start [install.requirements.examples] ...) | ||
$(BASH) .scripts/install.requirements.examples.sh | ||
|
||
install.requirements.development: install.requirements.examples | ||
$(info Start [install.requirements.development] ...) | ||
$(BASH) .scripts/install.requirements.development.sh | ||
|
||
# | ||
# Examples | ||
# | ||
|
||
open.examples: install.requirements.examples examples.pid | ||
|
||
examples.pid: | ||
$(info Start [examples.pid] ...) | ||
jupyter-lab --notebook-dir='examples' > /dev/null 2>&1 & echo $$! > $@; | ||
|
||
stop.examples: examples.pid | ||
kill `cat $<` && rm $< | ||
|
||
.PHONY: open.examples stop.examples | ||
|
||
# | ||
# Development | ||
# | ||
|
||
all: lint test jupytext clean | ||
|
||
lint: install.requirements.development | ||
$(info Start [lint] ...) | ||
pylint --rcfile=.pylintrc --output-format=text $(PYTHON_FILES) 2>&1 | tee pylint.txt | sed -n 's/^Your code has been rated at \([-0-9.]*\)\/.*/\1/p' | ||
|
||
test: install.requirements.development | ||
$(info Start [test] ...) | ||
TEST_N_RANDOM_FEATURE_SETS=$(TEST_N_RANDOM_FEATURE_SETS) \ | ||
TEST_N_EXISTING_FEATURE_SETS=$(TEST_N_EXISTING_FEATURE_SETS) \ | ||
$(BASH) .scripts/run.tests.sh | ||
|
||
test.sample: install.requirements.development | ||
$(info Start [test.sample] ...) | ||
TEST_N_RANDOM_FEATURE_SETS=3 \ | ||
TEST_N_EXISTING_FEATURE_SETS=3 \ | ||
$(BASH) .scripts/run.tests.sh | ||
|
||
jupytext: install.requirements.development | ||
$(info Start [jupytext] ...) | ||
$(BASH) .scripts/run.jupytext.sh | ||
|
||
deploy: clean | ||
$(info Start [deploy.test] ...) | ||
$(BASH) .scripts/run.deployment.sh | ||
|
||
clean: | ||
$(info Start [clean] ...) | ||
rm -rf tmp | ||
rm -rf build | ||
rm -rf dist |
Oops, something went wrong.