From df2d9e0d4fc441452d67548c5ac0359b880ac013 Mon Sep 17 00:00:00 2001 From: Badr-MOUFAD Date: Thu, 2 Nov 2023 11:17:18 +0100 Subject: [PATCH 1/7] use pyproject --- pyproject.toml | 55 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) create mode 100644 pyproject.toml diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 000000000..1c58fd62d --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,55 @@ +[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", +] + +doc = [ + "benchopt", + "libsvmdata>=0.2", + "matplotlib>=2.0.0", + "myst_parser", + "numpydoc", + "pillow", + "sphinx-bootstrap-theme", + "sphinx_copybutton", + "sphinx-gallery", + "pytest", + "furo", + "lifelines" +] From 3081c03e0cb48c99af15c0149f860b1ce7adbcb7 Mon Sep 17 00:00:00 2001 From: Badr-MOUFAD Date: Thu, 2 Nov 2023 11:17:42 +0100 Subject: [PATCH 2/7] rm ``setup.py`` --- setup.py | 37 ------------------------------------- 1 file changed, 37 deletions(-) delete mode 100644 setup.py 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'] - ) From 3ad1fde32aca1487ccfa86bfbb163aae26651bc2 Mon Sep 17 00:00:00 2001 From: Badr-MOUFAD Date: Thu, 2 Nov 2023 11:28:08 +0100 Subject: [PATCH 3/7] rm ``doc-requirements.txt`` --- doc/doc-requirements.txt | 12 ------------ 1 file changed, 12 deletions(-) delete mode 100644 doc/doc-requirements.txt 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 From f235942e22fafed54cc3ca6a8b036e1369326bfe Mon Sep 17 00:00:00 2001 From: Badr-MOUFAD Date: Thu, 2 Nov 2023 11:28:30 +0100 Subject: [PATCH 4/7] update workflows --- .circleci/config.yml | 2 +- .github/workflows/main.yml | 9 +++++---- pyproject.toml | 1 + 3 files changed, 7 insertions(+), 5 deletions(-) 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/pyproject.toml b/pyproject.toml index 1c58fd62d..d8f9ea06c 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -37,6 +37,7 @@ test = [ "pytest", "flake8", "coverage", + "numpydoc," ] doc = [ From 50c126283c273319ba641ae5d319575f37985a16 Mon Sep 17 00:00:00 2001 From: Badr-MOUFAD Date: Thu, 2 Nov 2023 11:28:52 +0100 Subject: [PATCH 5/7] update docs --- doc/contribute.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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 From 5cc40644736350b6c11be57df509efb8130b1a3d Mon Sep 17 00:00:00 2001 From: Badr-MOUFAD Date: Thu, 2 Nov 2023 11:42:42 +0100 Subject: [PATCH 6/7] fix trailing comma --- pyproject.toml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index d8f9ea06c..b94f99e77 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -37,7 +37,7 @@ test = [ "pytest", "flake8", "coverage", - "numpydoc," + "numpydoc", ] doc = [ @@ -52,5 +52,5 @@ doc = [ "sphinx-gallery", "pytest", "furo", - "lifelines" + "lifelines", ] From 04b175b5d1db986a1e73fae12e1365b53714bd5d Mon Sep 17 00:00:00 2001 From: Badr-MOUFAD Date: Thu, 2 Nov 2023 13:33:52 +0100 Subject: [PATCH 7/7] fix sphinx extension imports --- doc/conf.py | 12 +++++++----- doc/{ => sphinxext}/github_link.py | 0 2 files changed, 7 insertions(+), 5 deletions(-) rename doc/{ => sphinxext}/github_link.py (100%) 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/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