From 8fe5fdff2b81e80c2f34bdd60873b8d8b405f8fa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ricardo=20Montan=CC=83ana?= Date: Sun, 25 Apr 2021 12:46:49 +0200 Subject: [PATCH] Refactor setup and add Makefile --- Makefile | 39 +++++++++++++++++++++++++++++++++++++++ setup.py | 19 +++++++++---------- stree/Strees.py | 6 +----- stree/__init__.py | 8 ++++++++ 4 files changed, 57 insertions(+), 15 deletions(-) create mode 100644 Makefile diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..ca256b9 --- /dev/null +++ b/Makefile @@ -0,0 +1,39 @@ +SHELL := /bin/bash +.DEFAULT_GOAL := help +.PHONY: coverage deps help lint push test + +coverage: ## Run tests with coverage + coverage erase + coverage run -m unittest -v stree.tests + coverage report -m + +deps: ## Install dependencies + pip install -r requirements.txt + +lint: ## Lint and static-check + black stree + flake8 stree + mypy stree + +push: ## Push code with tags + git push && git push --tags + +test: ## Run tests + python -m unittest -v stree.tests + +help: ## Show help message + @IFS=$$'\n' ; \ + help_lines=(`fgrep -h "##" $(MAKEFILE_LIST) | fgrep -v fgrep | sed -e 's/\\$$//' | sed -e 's/##/:/'`); \ + printf "%s\n\n" "Usage: make [task]"; \ + printf "%-20s %s\n" "task" "help" ; \ + printf "%-20s %s\n" "------" "----" ; \ + for help_line in $${help_lines[@]}; do \ + IFS=$$':' ; \ + help_split=($$help_line) ; \ + help_command=`echo $${help_split[0]} | sed -e 's/^ *//' -e 's/ *$$//'` ; \ + help_info=`echo $${help_split[2]} | sed -e 's/^ *//' -e 's/ *$$//'` ; \ + printf '\033[36m'; \ + printf "%-20s %s" $$help_command ; \ + printf '\033[0m'; \ + printf "%s\n" $$help_info; \ + done diff --git a/setup.py b/setup.py index 611ac80..b56823d 100644 --- a/setup.py +++ b/setup.py @@ -1,7 +1,5 @@ import setuptools - -__version__ = "1.1" -__author__ = "Ricardo Montañana Gómez" +import stree def readme(): @@ -9,22 +7,23 @@ def readme(): return f.read() +VERSION = stree.__version__ setuptools.setup( name="STree", - version=__version__, - license="MIT License", + version=stree.__version__, + license=stree.__license__, description="Oblique decision tree with svm nodes", long_description=readme(), long_description_content_type="text/markdown", packages=setuptools.find_packages(), - url="https://github.com/doctorado-ml/stree", - author=__author__, - author_email="ricardo.montanana@alu.uclm.es", + url=stree.__url__, + author=stree.__author__, + author_email=stree.__author_email__, keywords="scikit-learn oblique-classifier oblique-decision-tree decision-\ tree svm svc", classifiers=[ - "Development Status :: 4 - Beta", - "License :: OSI Approved :: MIT License", + "Development Status :: 5 - Production/Stable", + "License :: OSI Approved :: " + stree.__license__, "Programming Language :: Python :: 3.8", "Natural Language :: English", "Topic :: Scientific/Engineering :: Artificial Intelligence", diff --git a/stree/Strees.py b/stree/Strees.py index 5bb7c1a..1c1ed95 100644 --- a/stree/Strees.py +++ b/stree/Strees.py @@ -1,9 +1,5 @@ """ -__author__ = "Ricardo Montañana Gómez" -__copyright__ = "Copyright 2020, Ricardo Montañana Gómez" -__license__ = "MIT" -__version__ = "0.9" -Build an oblique tree classifier based on SVM nodes +Oblique decision tree classifier based on SVM nodes """ import os diff --git a/stree/__init__.py b/stree/__init__.py index 6768b82..d58a553 100644 --- a/stree/__init__.py +++ b/stree/__init__.py @@ -1,3 +1,11 @@ from .Strees import Stree, Snode, Siterator, Splitter +__version__ = "1.0" + +__author__ = "Ricardo Montañana Gómez" +__copyright__ = "Copyright 2020-2021, Ricardo Montañana Gómez" +__license__ = "MIT License" +__author_email__ = "ricardo.montanana@alu.uclm.es" +__url__ = "https://github.com/doctorado-ml/stree" + __all__ = ["Stree", "Snode", "Siterator", "Splitter"]