diff --git a/.github/workflows/ci-build.yml b/.github/workflows/ci-build.yml index c4ba28a0..88129d45 100644 --- a/.github/workflows/ci-build.yml +++ b/.github/workflows/ci-build.yml @@ -44,7 +44,7 @@ jobs: python -m pip install -r develop.txt python -m pip install -r docs/requirements.txt python -m pip install astropy "scikit-image<0.20" scikit-learn matplotlib - python -m pip install tensorflow>=2.4.1 + python -m pip install tensorflow>=2.4.1 torch python -m pip install twine python -m pip install . diff --git a/.pylintrc b/.pylintrc deleted file mode 100644 index 3ac9aef9..00000000 --- a/.pylintrc +++ /dev/null @@ -1,2 +0,0 @@ -[MASTER] -ignore-patterns=**/docs/**/*.py diff --git a/.pyup.yml b/.pyup.yml deleted file mode 100644 index 8fdac7ff..00000000 --- a/.pyup.yml +++ /dev/null @@ -1,14 +0,0 @@ -# autogenerated pyup.io config file -# see https://pyup.io/docs/configuration/ for all available options - -schedule: '' -update: all -label_prs: update -assignees: sfarrens -requirements: - - requirements.txt: - pin: False - - develop.txt: - pin: False - - docs/requirements.txt: - pin: True diff --git a/MANIFEST.in b/MANIFEST.in deleted file mode 100644 index 9a2f374e..00000000 --- a/MANIFEST.in +++ /dev/null @@ -1,5 +0,0 @@ -include requirements.txt -include develop.txt -include docs/requirements.txt -include README.rst -include LICENSE.txt diff --git a/develop.txt b/develop.txt deleted file mode 100644 index 6ff665eb..00000000 --- a/develop.txt +++ /dev/null @@ -1,12 +0,0 @@ -coverage>=5.5 -pytest>=6.2.2 -pytest-raises>=0.10 -pytest-cases>= 3.6 -pytest-xdist>= 3.0.1 -pytest-cov>=2.11.1 -pytest-emoji>=0.2.0 -pydocstyle==6.1.1 -pytest-pydocstyle>=2.2.0 -black -isort -pytest-black diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 00000000..71bdce82 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,56 @@ +[project] +name="modopt" +description = 'Modular Optimisation tools for soliving inverse problems.' +version = "1.7.1" +requires-python= ">=3.8" + +authors = [{name="Samuel Farrens", email="samuel.farrens@cea.fr"}, +{name="Chaithya GR", email="chaithyagr@gmail.com"}, +{name="Pierre-Antoine Comby", email="pierre-antoine.comby@cea.fr"} +] +readme="README.md" +license={file="LICENCE.txt"} + +dependencies = ["numpy", "scipy", "tqdm"] + +[project.optional-dependencies] +gpu=["torch", "ptwt"] +doc=["myst-parser==0.16.1", +"nbsphinx==0.8.7", +"nbsphinx-link==1.3.0", +"sphinx-gallery==0.11.1", +"sphinxawesome-theme==3.2.1", +"sphinxcontrib-bibtex"] +dev=["black", "pytest<8.0.0", "pytest-cases", "pytest-cov", "pytest-sugar", "ruff"] + +[build-system] +requires=["setuptools", "setuptools-scm[toml]", "wheel"] + +[tool.setuptools] +packages=["modopt"] + +[tool.coverage.run] +omit = ["*tests*", "*__init__*", "*setup.py*", "*_version.py*", "*example*"] + +[tool.coverage.report] +precision = 2 +exclude_lines = ["pragma: no cover", "raise NotImplementedError"] + +[tool.black] + +[tool.ruff] + +src=["modopt"] +select = ["E", "F", "B", "Q", "UP", "D", "NPY", "RUF"] + +[tool.ruff.pydocstyle] +convention="numpy" + +[tool.isort] +profile="black" + +[tool.pytest.ini_options] +minversion = "6.0" +norecursedirs = ["tests/helpers"] +testpaths=["modopt"] +addopts = ["--verbose", "--cov=modopt", "--cov-report=term-missing", "--cov-report=xml", "--junitxml=pytest.xml"] diff --git a/requirements.txt b/requirements.txt deleted file mode 100644 index 1f44de13..00000000 --- a/requirements.txt +++ /dev/null @@ -1,4 +0,0 @@ -importlib_metadata>=3.7.0 -numpy>=1.19.5 -scipy>=1.5.4 -tqdm>=4.64.0 diff --git a/setup.cfg b/setup.cfg deleted file mode 100644 index 100adb40..00000000 --- a/setup.cfg +++ /dev/null @@ -1,97 +0,0 @@ -[aliases] -test=pytest - -[metadata] -description_file = README.rst - -[darglint] -docstring_style = numpy -strictness = short - -[flake8] -ignore = - D107, #Justification: Don't need docstring for __init__ in numpydoc style - RST304, #Justification: Need to use :cite: role for citations - RST210, #Justification: RST210, RST213 Inconsistent with numpydoc - RST213, # documentation for handling *args and **kwargs - W503, #Justification: Have to choose one multiline operator format - WPS202, #Todo: Rethink module size, possibly split large modules - WPS337, #Todo: Consider simplifying multiline conditions. - WPS338, #Todo: Consider changing method order - WPS403, #Todo: Rethink no cover lines - WPS421, #Todo: Review need for print statements - WPS432, #Justification: Mathematical codes require "magic numbers" - WPS433, #Todo: Rethink conditional imports - WPS463, #Todo: Rename get_ methods - WPS615, #Todo: Rename get_ methods -per-file-ignores = - #Justification: Needed for keeping package version and current API - *__init__.py*: F401,F403,WPS347,WPS410,WPS412 - #Todo: Rethink conditional imports - #Todo: How can we bypass mutable constants? - modopt/base/backend.py: WPS229, WPS420, WPS407 - #Todo: Rethink conditional imports - modopt/base/observable.py: WPS420,WPS604 - #Todo: Check string for log formatting - modopt/interface/log.py: WPS323 - #Todo: Rethink conditional imports - modopt/math/convolve.py: WPS301,WPS420 - #Todo: Rethink conditional imports - modopt/math/matrix.py: WPS420 - #Todo: import has bad parenthesis - modopt/opt/algorithms/__init__.py: F401,F403,WPS318, WPS319, WPS412, WPS410 - #Todo: x is a too short name. - modopt/opt/algorithms/forward_backward.py: WPS111 - #Todo: u,v , A is a too short name. - modopt/opt/algorithms/admm.py: WPS111, N803 - #Todo: Check need for del statement - modopt/opt/algorithms/primal_dual.py: WPS111, WPS420 - #multiline parameters bug with tuples - modopt/opt/algorithms/gradient_descent.py: WPS111, WPS420, WPS317 - #Todo: Consider changing costObj name - modopt/opt/cost.py: N801, - #Todo: - # - Rethink subscript slice assignment - # - Reduce complexity of KSupportNorm - # - Check bitwise operations - modopt/opt/proximity.py: WPS220,WPS231,WPS352,WPS362,WPS465,WPS506,WPS508 - #Todo: Consider changing cwbReweight name - modopt/opt/reweight.py: N801 - #Justification: Needed to import matplotlib.pyplot - modopt/plot/cost_plot.py: N802,WPS301 - #Todo: Investigate possible bug in find_n_pc function - #Todo: Investigate darglint error - modopt/signal/svd.py: WPS345, DAR000 - #Todo: Check security of using system executable call - modopt/signal/wavelet.py: S404,S603 - #Todo: Clean up tests - modopt/tests/*.py: E731,F401,WPS301,WPS420,WPS425,WPS437,WPS604 - #Todo: Import has bad parenthesis - modopt/tests/test_base.py: WPS318,WPS319,E501,WPS301 -#WPS Settings -max-arguments = 25 -max-attributes = 40 -max-cognitive-score = 20 -max-function-expressions = 20 -max-line-complexity = 30 -max-local-variables = 10 -max-methods = 20 -max-module-expressions = 20 -max-string-usages = 20 -max-raises = 5 - -[tool:pytest] -norecursedirs=tests/test_helpers -testpaths = - modopt -addopts = - --verbose - --cov=modopt - --cov-report=term-missing - --cov-report=xml - --junitxml=pytest.xml - --pydocstyle - -[pydocstyle] -convention=numpy -add-ignore=D107 diff --git a/setup.py b/setup.py deleted file mode 100644 index e6a8a9e6..00000000 --- a/setup.py +++ /dev/null @@ -1,73 +0,0 @@ -#! /usr/bin/env python -# -*- coding: utf-8 -*- - -from setuptools import setup, find_packages -import os - -# Set the package release version -major = 1 -minor = 7 -patch = 1 - -# Set the package details -name = 'modopt' -version = '.'.join(str(value) for value in (major, minor, patch)) -author = 'Samuel Farrens' -email = 'samuel.farrens@cea.fr' -gh_user = 'cea-cosmic' -url = 'https://github.com/{0}/{1}'.format(gh_user, name) -description = 'Modular Optimisation tools for soliving inverse problems.' -license = 'MIT' - -# Set the package classifiers -python_versions_supported = ['3.7', '3.8', '3.9', '3.10', '3.11'] -os_platforms_supported = ['Unix', 'MacOS'] - -lc_str = 'License :: OSI Approved :: {0} License' -ln_str = 'Programming Language :: Python' -py_str = 'Programming Language :: Python :: {0}' -os_str = 'Operating System :: {0}' - -classifiers = ( - [lc_str.format(license)] - + [ln_str] - + [py_str.format(ver) for ver in python_versions_supported] - + [os_str.format(ops) for ops in os_platforms_supported] -) - -# Source package description from README.md -this_directory = os.path.abspath(os.path.dirname(__file__)) -with open(os.path.join(this_directory, 'README.md'), encoding='utf-8') as f: - long_description = f.read() - -# Source package requirements from requirements.txt -with open('requirements.txt') as open_file: - install_requires = open_file.read() - -# Source test requirements from develop.txt -with open('develop.txt') as open_file: - tests_require = open_file.read() - -# Source doc requirements from docs/requirements.txt -with open('docs/requirements.txt') as open_file: - docs_require = open_file.read() - - -setup( - name=name, - author=author, - author_email=email, - version=version, - license=license, - url=url, - description=description, - long_description=long_description, - long_description_content_type='text/markdown', - packages=find_packages(), - install_requires=install_requires, - python_requires='>=3.6', - setup_requires=['pytest-runner'], - tests_require=tests_require, - extras_require={'develop': tests_require + docs_require}, - classifiers=classifiers, -)