From 2e207c1edd571de92737b535d6f59eff96c0c196 Mon Sep 17 00:00:00 2001 From: David-Elias Kuenstle Date: Wed, 9 Sep 2020 16:30:30 +0200 Subject: [PATCH] Add basic package structure --- .coveragerc | 14 ++++++++ .flake8 | 5 +++ .github/workflows/python-package.yml | 9 +++-- .mypy.ini | 6 ++++ ordcomp/__init__.py | 3 ++ ordcomp/_version.py | 1 + pyproject.toml | 5 +++ setup.cfg | 51 ++++++++++++++++++++++++++++ setup.py | 13 +++++++ 9 files changed, 102 insertions(+), 5 deletions(-) create mode 100644 .coveragerc create mode 100644 .flake8 create mode 100644 .mypy.ini create mode 100644 ordcomp/__init__.py create mode 100644 ordcomp/_version.py create mode 100644 pyproject.toml create mode 100644 setup.cfg create mode 100644 setup.py diff --git a/.coveragerc b/.coveragerc new file mode 100644 index 0000000..2c95286 --- /dev/null +++ b/.coveragerc @@ -0,0 +1,14 @@ +[run] +cover_pylib = false +omit = + */site-packages/* + */tests/* + +[report] +exclude_lines = + pragma: no cover + def __repr__ + RuntimeError + NotImplementedError + FileNotFoundError + ImportError diff --git a/.flake8 b/.flake8 new file mode 100644 index 0000000..241d9d7 --- /dev/null +++ b/.flake8 @@ -0,0 +1,5 @@ +[flake8] +max-line-length = 127 +exclude = .git,__pycache__,doc/,docs/,build/,dist/,archive/ +per-file-ignores = + __init__.py:F401 diff --git a/.github/workflows/python-package.yml b/.github/workflows/python-package.yml index e1e678f..a3cb28e 100644 --- a/.github/workflows/python-package.yml +++ b/.github/workflows/python-package.yml @@ -23,20 +23,19 @@ jobs: uses: actions/setup-python@v2 with: python-version: ${{ matrix.python-version }} - - name: Install dependencies + - name: Install package with dependencies run: | python -m pip install --upgrade pip - pip install flake8 pytest pytest-cov - if [ -f requirements.txt ]; then pip install -r requirements.txt; fi + pip install -e .[bridge, tests, docs] - name: Lint with flake8 run: | # stop the build if there are Python syntax errors or undefined names flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics # exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide - flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics + flake8 . --count --exit-zero --max-complexity=10 --statistics - name: Test with pytest and measure coverage run: | - pytest --cov=./ --cov-report=xml + pytest --cov --cov-report=xml - name: Upload coverage to Codecov uses: codecov/codecov-action@v1 with: diff --git a/.mypy.ini b/.mypy.ini new file mode 100644 index 0000000..5457c7e --- /dev/null +++ b/.mypy.ini @@ -0,0 +1,6 @@ +[mypy] +ignore_missing_imports = True +strict_optional = False +allow_redefinition = True +show_error_context = False +show_column_numbers = True \ No newline at end of file diff --git a/ordcomp/__init__.py b/ordcomp/__init__.py new file mode 100644 index 0000000..f686221 --- /dev/null +++ b/ordcomp/__init__.py @@ -0,0 +1,3 @@ +from ._version import __version__ + +__all__ = ['__version__'] \ No newline at end of file diff --git a/ordcomp/_version.py b/ordcomp/_version.py new file mode 100644 index 0000000..3aa0d7b --- /dev/null +++ b/ordcomp/_version.py @@ -0,0 +1 @@ +__version__ = "0.0.0" \ No newline at end of file diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..e521993 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,5 @@ +[build-system] +requires = ["setuptools", "wheel"] + +[tool.pytest.ini_options] +addopts = "--doctest-modules -ra -v" \ No newline at end of file diff --git a/setup.cfg b/setup.cfg new file mode 100644 index 0000000..ddeed37 --- /dev/null +++ b/setup.cfg @@ -0,0 +1,51 @@ +# Static configuration of the distribution package, as defined by setuptools +[metadata] +name = ordcomp +description = Machine Learning Toolkit for Ordinal Comparison in Python. +long_description = file: README.md, LICENSE +author = 'David-Elias Künstle' +author_email = 'david-elias dot kuenstle at uni-tuebingen dot de' +url = 'https://github.com/dekuenstle/ordcomp' +classifierts = + Development Status :: 1 - Planning + Environment :: GPU :: NVIDIA CUDA + Intended Audience :: Science/Research + Intended Audience :: Developers + License :: OSI Approved :: GNU Lesser General Public License v2 or later (LGPLv2+) + Programming Language :: Python + Topic :: Software Development + Topic :: Scientific/Engineering + Operating System :: Microsoft :: Windows + Operating System :: POSIX + Operating System :: Unix + Operating System :: MacOS + Programming Language :: Python :: 3.7 + Programming Language :: Python :: 3.8 + Typing :: Typed +description-file = README.md +license_files = LICENSE + +[options] +python_requires = >=3.7 +packages = find: +zip_safe = False +install_requires = + numpy + scipy + scikit-learn + +[options.extras_require] +bridge = + rpy2 + oct2py +tests = + pytest + pytest-cov + flake8 + mypy +docs = + sphinx + sphinx-gallery + sphinx_rtd_theme + numpydoc + matplotlib diff --git a/setup.py b/setup.py new file mode 100644 index 0000000..e1d9d3c --- /dev/null +++ b/setup.py @@ -0,0 +1,13 @@ +#! /usr/bin/env python +""" Dynamic configuration of distribution package. """ + +import os + +from setuptools import find_packages, setup + +# get __version__ from _version.py +ver_file = os.path.join('ordcomp', '_version.py') +with open(ver_file) as f: + exec(f.read()) + +setup(version=__version__) \ No newline at end of file