From e0dd7416308d2a6cd18af63ec8fa5947e66f8ea9 Mon Sep 17 00:00:00 2001 From: Roman Feldbauer Date: Fri, 15 Sep 2023 11:34:59 +0200 Subject: [PATCH 1/2] General maintenance --- .travis.yml | 11 ++++---- README.rst | 16 ++++++------ copac/__init__.py | 12 ++++----- environment.yml | 50 +++++++++++++++++++++++++++++++++++ requirements.txt | 64 +++++++++++---------------------------------- setup.cfg | 52 +++++++++++++++++++++++++++++++++++++ setup.py | 66 ----------------------------------------------- 7 files changed, 135 insertions(+), 136 deletions(-) create mode 100644 environment.yml create mode 100644 setup.cfg delete mode 100644 setup.py diff --git a/.travis.yml b/.travis.yml index 206b6a1..6b66a44 100644 --- a/.travis.yml +++ b/.travis.yml @@ -13,19 +13,18 @@ install: - conda config --set always_yes yes --set changeps1 no - conda update -q conda - conda info -a -- conda create -q -n test-environment python=$TRAVIS_PYTHON_VERSION numpy scipy scikit-learn +- conda create -q -n test-environment python=$TRAVIS_PYTHON_VERSION numpy scipy scikit-learn pytest coverage - source activate test-environment - pip install coveralls nose -- python setup.py build -- python setup.py install +- python -m pip install . script: -- python setup.py test -- coverage run setup.py test +- pytest . +- coverage - coverage combine # required for multiprocessing after_success: - coveralls cache: - apt - directories: -- "$HOME/.cache/pip" + - "$HOME/.cache/pip" diff --git a/README.rst b/README.rst index 4199b70..f37d487 100644 --- a/README.rst +++ b/README.rst @@ -1,5 +1,5 @@ -.. image:: https://travis-ci.com/VarIr/copac.svg?token=Pv7ns6A7X34baaBVUTz8&branch=master - :target: https://travis-ci.com/VarIr/copac +.. image:: https://travis-ci.org/VarIr/copac.svg?token=Pv7ns6A7X34baaBVUTz8&branch=master + :target: https://travis-ci.org/VarIr/copac .. image:: https://zenodo.org/badge/106809618.svg :target: https://zenodo.org/badge/latestdoi/106809618 @@ -13,20 +13,20 @@ We implement COPAC (Correlation Partition Clustering), which #. computes the local correlation dimensionality based on the largest eigenvalues #. partitions the data set based on this dimension #. calculates a Euclidean distance variant weighted with the correlation dimension, called correlation distance -#. further clusters objects within each partition with Generalized DBSCAN, requiring a minimum number of objects to be within eps range for each core point. +#. further clusters objects within each partition with Generalized DBSCAN, + requiring a minimum number of objects to be within eps range for each core point. Installation ------------ -Make sure you have a working Python3 environment (at least 3.6) with -numpy, scipy and scikit-learn packages. Consider using -`Anaconda `_. -You can install COPAC from within the cloned directory with +Clone this repository and ``pip install`` like so: .. code-block:: bash - python3 setup.py install + git clone https://github.com/VarIr/copac.git + cd copac + python3 -m pip install . COPAC is then available through the `copac` package. diff --git a/copac/__init__.py b/copac/__init__.py index d1437f9..4e2150e 100644 --- a/copac/__init__.py +++ b/copac/__init__.py @@ -1,9 +1,7 @@ -""" -Created on 25.10.2017 - -@author: roman -""" from .copac import COPAC, copac -__all__ = ['COPAC', - 'copac'] +__all__ = [ + 'COPAC', + 'copac', +] +__version__ = "0.2.1" diff --git a/environment.yml b/environment.yml new file mode 100644 index 0000000..86bc52b --- /dev/null +++ b/environment.yml @@ -0,0 +1,50 @@ +name: copac +channels: + - conda-forge + - bioconda + - defaults +dependencies: + - _libgcc_mutex=0.1=conda_forge + - _openmp_mutex=4.5=2_gnu + - bzip2=1.0.8=h7f98852_4 + - ca-certificates=2023.7.22=hbcca054_0 + - colorama=0.4.6=pyhd8ed1ab_0 + - exceptiongroup=1.1.3=pyhd8ed1ab_0 + - iniconfig=2.0.0=pyhd8ed1ab_0 + - joblib=1.3.2=pyhd8ed1ab_0 + - ld_impl_linux-64=2.40=h41732ed_0 + - libblas=3.9.0=18_linux64_openblas + - libcblas=3.9.0=18_linux64_openblas + - libexpat=2.5.0=hcb278e6_1 + - libffi=3.4.2=h7f98852_5 + - libgcc-ng=13.2.0=h807b86a_0 + - libgfortran-ng=13.2.0=h69a702a_0 + - libgfortran5=13.2.0=ha4646dd_0 + - libgomp=13.2.0=h807b86a_0 + - liblapack=3.9.0=18_linux64_openblas + - libnsl=2.0.0=h7f98852_0 + - libopenblas=0.3.24=pthreads_h413a1c8_0 + - libsqlite=3.43.0=h2797004_0 + - libstdcxx-ng=13.2.0=h7e041cc_0 + - libuuid=2.38.1=h0b41bf4_0 + - libzlib=1.2.13=hd590300_5 + - ncurses=6.4=hcb278e6_0 + - openssl=3.1.2=hd590300_0 + - packaging=23.1=pyhd8ed1ab_0 + - pip=23.2.1=pyhd8ed1ab_0 + - pluggy=1.3.0=pyhd8ed1ab_0 + - pytest=7.4.2=pyhd8ed1ab_0 + - python=3.11.5=hab00c5b_0_cpython + - python_abi=3.11=3_cp311 + - readline=8.2=h8228510_1 + - setuptools=68.2.2=pyhd8ed1ab_0 + - threadpoolctl=3.2.0=pyha21a80b_0 + - tk=8.6.12=h27826a3_0 + - tomli=2.0.1=pyhd8ed1ab_0 + - tzdata=2023c=h71feb2d_0 + - wheel=0.41.2=pyhd8ed1ab_0 + - xz=5.2.6=h166bdaf_0 + - pip: + - numpy==1.25.2 + - scikit-learn==1.3.0 + - scipy==1.11.2 diff --git a/requirements.txt b/requirements.txt index dc42941..a60cf30 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,49 +1,15 @@ -bleach>=2.1.1 -cycler>=0.10.0 -decorator>=4.1.2 -entrypoints>=0.2.3 -html5lib>=1.0b10 -ipykernel>=4.6.1 -ipython>=6.2.1 -ipython-genutils>=0.2.0 -ipywidgets>=7.0.3 -jedi>=0.11.0 -Jinja2>=2.9.6 -jsonschema>=2.6.0 -jupyter>=1.0.0 -jupyter-client>=5.1.0 -jupyter-console>=5.2.0 -jupyter-core>=4.3.0 -MarkupSafe>=1.0 -matplotlib>=2.1.0 -mistune>=0.7.4 -nbconvert>=5.3.1 -nbformat>=4.4.0 -nose>=1.3.7 -notebook>=5.7.2 -numpy>=1.13.3 -pandas>=0.20.3 -pandocfilters>=1.4.2 -parso>=0.1.0 -pexpect>=4.2.1 -pickleshare>=0.7.4 -prompt-toolkit>=1.0.15 -ptyprocess>=0.5.2 -Pygments>=2.2.0 -pyparsing>=2.2.0 -python-dateutil>=2.6.1 -pytz>=2017.2 -pyzmq>=16.0.2 -qtconsole>=4.3.1 -scikit-learn>=0.19.1 -scipy>=0.19.1 -seaborn>=0.8.1 -simplegeneric>=0.8.1 -six>=1.11.0 -terminado>=0.6 -testpath>=0.3.1 -tornado>=4.5.2 -traitlets>=4.3.2 -wcwidth>=0.1.7 -webencodings>=0.5.1 -widgetsnbextension>=3.0.6 +colorama==0.4.6 +exceptiongroup==1.1.3 +iniconfig==2.0.0 +joblib==1.3.2 +numpy==1.25.2 +packaging==23.1 +pip==23.2.1 +pluggy==1.3.0 +pytest==7.4.2 +scikit-learn==1.3.0 +scipy==1.11.2 +setuptools==68.2.2 +threadpoolctl==3.2.0 +tomli==2.0.1 +wheel==0.41.2 diff --git a/setup.cfg b/setup.cfg new file mode 100644 index 0000000..2f581be --- /dev/null +++ b/setup.cfg @@ -0,0 +1,52 @@ +[bdist_wheel] +universal = true + +[metadata] +name = COPAC +version = attr: copac.__version__ +author = Roman Feldbauer +author_email = sci@feldbauer.org +url = https://github.com/VarIr/copac +description = Correlation partition clustering +long_description = file: README.rst +long_description_content_type = text/restructured +license = GPLv3 +keywords = "machine learning" "data science" "data mining" +platform = any +classifiers = + Development Status :: 4 - Beta + Environment :: Console + Intended Audience :: Science/Research + Programming Language :: Python + Programming Language :: Python :: 3", + Programming Language :: Python :: 3.6 + Programming Language :: Python :: 3.7 + Programming Language :: Python :: 3.8 + Programming Language :: Python :: 3.9 + Programming Language :: Python :: 3.10 + Programming Language :: Python :: 3.11 + Topic :: Scientific/Engineering +project_urls = + Bug Tracker = https://github.com/VarIr/copac/issues + +[options] +package_dir= + =copac +python_requires = >= 3.6 +packages = find: +# The following plus setuptools-scm include all version-controlled files in the package. +include_package_data = True +install_requires = + numpy + scikit-learn + scipy + pytest + +[options.packages.find] +where = copac + +# Setup requirements also here for legacy packaging tools; pyproject.toml is the preferred place +setup_requires = + setuptools + setuptools_scm + wheel diff --git a/setup.py b/setup.py deleted file mode 100644 index f0b8629..0000000 --- a/setup.py +++ /dev/null @@ -1,66 +0,0 @@ -#!/usr/bin/env python3 - -""" -Installation: -------------- -In the console change to the folder containing this file. -To build the package copac: -python3 setup.py build -To install the package: -python3 setup.py install -To test the installation: -python3 setup.py test -If this succeeds with an 'OK' message, you are ready to go. -""" -import sys -if sys.version_info < (3, 6): - sys.stdout.write("COPAC requires Python 3.6\n" - "Please try to run as python3 setup.py or\n" - "update your Python environment.\n" - "Consider using Anaconda for easy package handling.\n") - sys.exit(1) - -try: - import numpy - import scipy - import sklearn -except ImportError: - sys.stdout.write("COPAC requires numpy, scipy and scikit-learn. " - "Please make sure these packages are available locally. " - "Consider using Anaconda for easy package handling.\n") - -setup_options = {} - -try: - from setuptools import setup - setup_options['test_suite'] = 'copac/tests/test_copac.py' -except ImportError: - from distutils.core import setup - import warnings - warnings.warn("setuptools not found, resorting to distutils. " - "Unit tests won't be discovered automatically.") - -setup( - name="copac", - version="0.2", - author="Roman Feldbauer", - author_email="roman.feldbauer@ofai.at", - maintainer="Roman Feldbauer", - maintainer_email="roman.feldbauer@ofai.at", - description="Correlation clustering", - license="", - keywords=["machine learning", "data science", "data mining"], - url="https://github.com/VarIr/copac", - # packages=['copac'], - # package_data={'...': ['example_datasets/*']}, - classifiers=[ - "Development Status :: 3 - Alpha", - "Environment :: Console", - "Intended Audience :: Science/Research", - "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.6", - "Programming Language :: Python :: 3.7", - "Topic :: Scientific/Engineering" - ], - **setup_options -) From 53c4979dd7e57ff54904c58973d1d19badf2fcba Mon Sep 17 00:00:00 2001 From: Roman Feldbauer Date: Fri, 15 Sep 2023 11:41:01 +0200 Subject: [PATCH 2/2] Remove travis CI --- .travis.yml | 30 ------------------------------ 1 file changed, 30 deletions(-) delete mode 100644 .travis.yml diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 6b66a44..0000000 --- a/.travis.yml +++ /dev/null @@ -1,30 +0,0 @@ -language: python -sudo: true -dist: xenial # Required for 3.7 as of 2018/12 -python: -- '3.7' -- '3.6' -install: -- sudo apt-get update -- wget https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh -O miniconda.sh; -- bash miniconda.sh -b -p $HOME/miniconda; -- export PATH="$HOME/miniconda/bin:$PATH" -- hash -r -- conda config --set always_yes yes --set changeps1 no -- conda update -q conda -- conda info -a -- conda create -q -n test-environment python=$TRAVIS_PYTHON_VERSION numpy scipy scikit-learn pytest - coverage -- source activate test-environment -- pip install coveralls nose -- python -m pip install . -script: -- pytest . -- coverage -- coverage combine # required for multiprocessing -after_success: -- coveralls -cache: -- apt -- directories: - - "$HOME/.cache/pip"