diff --git a/.circleci/config.yml b/.circleci/config.yml index e1dfa4f5b..bcef5d4d6 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -41,8 +41,8 @@ jobs: name: Get Python running command: | python -m pip install --user --upgrade --progress-bar off pip - python -m pip install --user --upgrade --progress-bar off -r doc/doc-requirements.txt python -m pip install --user -e . + python -m pip install --user .[doc] - save_cache: key: pip-cache diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index d4708b464..656344f52 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -17,13 +17,14 @@ jobs: uses: actions/setup-python@v3 with: python-version: 3.8 - - name: Install dependencies + - name: Install package and testing tools run: | python -m pip install --upgrade pip - pip install celer - pip install pytest - pip install numpydoc pip install . + pip install .[test] + - name: Install other dependencies + run: | + pip install celer pip install statsmodels cvxopt pip install git+https://github.com/jolars/pyslope.git # for testing Cox estimator diff --git a/doc/conf.py b/doc/conf.py index b55eb433a..1941a92aa 100644 --- a/doc/conf.py +++ b/doc/conf.py @@ -15,16 +15,18 @@ import os import sys import warnings -# import os + import sphinx_gallery # noqa -import sphinx_bootstrap_theme +import sphinx_bootstrap_theme # noqa from numpydoc import numpydoc, docscrape # noqa -from doc.github_link import make_linkcode_resolve from skglm import __version__ as version -curdir = os.path.dirname(__file__) -sys.path.append(os.path.abspath(os.path.join(curdir, 'sphinxext'))) +# include custom extension +curdir = os.path.dirname(__file__) # noqa +sys.path.append(os.path.abspath(os.path.join(curdir, 'sphinxext'))) # noqa + +from github_link import make_linkcode_resolve # Mathurin: disable agg warnings in doc diff --git a/doc/contribute.rst b/doc/contribute.rst index efb241f48..b97258013 100644 --- a/doc/contribute.rst +++ b/doc/contribute.rst @@ -19,7 +19,7 @@ Your contribution is welcome and highly valuable. It can be You can use the `the issue section `_ to make suggestions. **pull request** - you may have fixed a bug, added a feature, or even fixed a small typo in the documentation, ... + you may have fixed a bug, added a feature, or even fixed a small typo in the documentation, ... You can submit a `pull request `_ to integrate your changes and we will reach out to you shortly. @@ -56,5 +56,5 @@ contribute with code or documentation. .. code-block:: shell $ cd doc - $ pip install -r doc-requirements.txt + $ pip install .[doc] $ make html diff --git a/doc/doc-requirements.txt b/doc/doc-requirements.txt deleted file mode 100644 index 9eb2bf951..000000000 --- a/doc/doc-requirements.txt +++ /dev/null @@ -1,12 +0,0 @@ -benchopt -libsvmdata>=0.2 -matplotlib>=2.0.0 -myst_parser -numpydoc -pillow -sphinx-bootstrap-theme -sphinx_copybutton -sphinx-gallery -pytest -furo -lifelines diff --git a/doc/github_link.py b/doc/sphinxext/github_link.py similarity index 100% rename from doc/github_link.py rename to doc/sphinxext/github_link.py diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 000000000..b94f99e77 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,56 @@ +[build-system] +requires = ["setuptools"] +build-backend = "setuptools.build_meta" + +[project] +name = "skglm" +description = "A fast and modular scikit-learn replacement for generalized linear models" +authors = [ + {name = "Mathurin Massias", email = "mathurin.massias@gmail.com"}, + {name = "Badr Moufad", email = "badr.moufad@emines.um6p.ma"}, + {name = "Pierre-Antoine Bannier", email = "pierreantoine.bannier@gmail.com"}, + {name = "Quentin Bertrand", email = "quentin.bertrand@mila.quebec"}, + {name = "Quentin Klopfenstein", email = "quentin.klopfenstein@uni.lu"} +] +license = {text = "BSD (3-Clause)"} +readme = {file = "README.md", content-type = "text/markdown"} +dependencies = [ + "numpy>=1.12", + "numba", + "scikit-learn>=1.0", + "scipy>=0.18.0", +] +dynamic = ["version"] + + +[tool.setuptools.dynamic] +version = {attr = "skglm.__version__"} + + +[project.urls] +Homepage = "https://contrib.scikit-learn.org/skglm" +Source = "https://github.com/scikit-learn-contrib/skglm.git" + + +[project.optional-dependencies] +test = [ + "pytest", + "flake8", + "coverage", + "numpydoc", +] + +doc = [ + "benchopt", + "libsvmdata>=0.2", + "matplotlib>=2.0.0", + "myst_parser", + "numpydoc", + "pillow", + "sphinx-bootstrap-theme", + "sphinx_copybutton", + "sphinx-gallery", + "pytest", + "furo", + "lifelines", +] diff --git a/setup.py b/setup.py deleted file mode 100644 index 47c4687b8..000000000 --- a/setup.py +++ /dev/null @@ -1,37 +0,0 @@ -import os -from setuptools import setup, find_packages - - -version = None -with open(os.path.join('skglm', '__init__.py'), 'r') as fid: - for line in (line.strip() for line in fid): - if line.startswith('__version__'): - version = line.split('=')[1].strip().strip('\'') - break -if version is None: - raise RuntimeError('Could not determine version') - -DISTNAME = 'skglm' -DESCRIPTION = 'A fast and modular scikit-learn replacement for generalized linear models' -with open('README.md', 'r', encoding='utf-8') as f: - LONG_DESCRIPTION = f.read() -MAINTAINER = 'Mathurin Massias' -MAINTAINER_EMAIL = 'mathurin.massias@gmail.com' -LICENSE = 'BSD (3-clause)' -DOWNLOAD_URL = 'https://github.com/scikit-learn-contrib/skglm.git' -VERSION = version -URL = 'https://contrib.scikit-learn.org/skglm' - -setup(name=DISTNAME, - version=version, - description=DESCRIPTION, - long_description=LONG_DESCRIPTION, - long_description_content_type='text/markdown', - maintainer=MAINTAINER, - maintainer_email=MAINTAINER_EMAIL, - url=URL, - download_url=DOWNLOAD_URL, - packages=find_packages(), - install_requires=['numpy>=1.12', 'numba', - 'scipy>=0.18.0', 'scikit-learn>=1.0'] - )