From b2ecf6b1c786215996f483e673c7e073a4fd6c95 Mon Sep 17 00:00:00 2001 From: mrava87 Date: Sun, 1 Oct 2023 20:33:00 +0300 Subject: [PATCH 01/10] build: switch from setup.py to pyproject.toml --- .github/workflows/build.yaml | 2 +- .../workflows/codacy-coverage-reporter.yaml | 2 +- .readthedocs.yaml | 2 +- azure-pipelines.yml | 8 +-- pyproject.toml | 3 ++ setup.cfg | 54 ++++++++++++++++++- setup.py | 54 ------------------- 7 files changed, 63 insertions(+), 62 deletions(-) create mode 100644 pyproject.toml delete mode 100755 setup.py diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index f6852e4c..63b4a4e3 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -7,7 +7,7 @@ jobs: strategy: matrix: platform: [ ubuntu-latest, macos-latest ] - python-version: ["3.7", "3.8", "3.9", "3.10"] + python-version: ["3.8", "3.9", "3.10"] runs-on: ${{ matrix.platform }} steps: diff --git a/.github/workflows/codacy-coverage-reporter.yaml b/.github/workflows/codacy-coverage-reporter.yaml index b0a8f90d..837e1478 100644 --- a/.github/workflows/codacy-coverage-reporter.yaml +++ b/.github/workflows/codacy-coverage-reporter.yaml @@ -13,7 +13,7 @@ jobs: - name: Set up Python uses: actions/setup-python@v4 with: - python-version: 3.9 + python-version: 3.8 - name: Install dependencies run: | python -m pip install --upgrade pip diff --git a/.readthedocs.yaml b/.readthedocs.yaml index 146206bb..a74e3480 100644 --- a/.readthedocs.yaml +++ b/.readthedocs.yaml @@ -19,5 +19,5 @@ sphinx: python: install: - requirements: requirements-dev.txt - - method: setuptools + - method: pip path: . diff --git a/azure-pipelines.yml b/azure-pipelines.yml index d778e70a..ef5306bb 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -55,7 +55,7 @@ jobs: steps: - task: UsePythonVersion@0 inputs: - versionSpec: '3.7' + versionSpec: '3.8' architecture: 'x64' - script: | @@ -65,7 +65,7 @@ jobs: displayName: 'Install prerequisites and library' - script: | - python setup.py test + pytest condition: succeededOrFailed() displayName: 'Run tests' @@ -84,7 +84,7 @@ jobs: steps: - task: UsePythonVersion@0 inputs: - versionSpec: '3.7' + versionSpec: '3.8' architecture: 'x64' - script: | @@ -94,6 +94,6 @@ jobs: displayName: 'Install prerequisites and library' - script: | - python setup.py test + pytest condition: succeededOrFailed() displayName: 'Run tests' diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 00000000..8fd8d67e --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,3 @@ +[build-system] +requires = ["setuptools", "setuptools-scm"] +build-backend = "setuptools.build_meta" diff --git a/setup.cfg b/setup.cfg index 1691b3bc..67636c69 100755 --- a/setup.cfg +++ b/setup.cfg @@ -1,3 +1,56 @@ +[metadata] +name = pylops +fullname = PyLops +description = Python library implementing linear operators to allow solving large-scale optimization problems +long_description = file: README.md +long_description_content_type = text/markdown +author = The PyLops Development Team +author_email = matteoravasi@gmail.com +maintainer = "Matteo Ravasi" +maintainer_email = matteoravasi@gmail.com +license = LGPL-3.0 License +license_file = LICENSE.md +platform = any +keywords = algebra, inverse problems, large-scale optimization +classifiers = + Development Status :: 5 - Production/Stable + Intended Audience :: Developers + Intended Audience :: Science/Research + Intended Audience :: Education + License :: OSI Approved :: GNU Lesser General Public License v3 (LGPLv3), + Natural Language :: English + Operating System :: OS Independent + Programming Language :: Python :: 3 :: Only + Programming Language :: Python :: 3.8 + Programming Language :: Python :: 3.9 + Programming Language :: Python :: 3.10 + Topic :: Scientific/Engineering : Mathematics +url = https://github.com/pylops/pylops + +project_urls = + Documentation = https://pylops.readthedocs.io/ + Release Notes = https://github.com/pylops/pylops/releases + Bug Tracker = https://github.com/pylops/pylops/issues + Source Code = https://github.com/pylops/pylops + +[options] +zip_safe = True +include_package_data = True +packages = find: +python_requires = >=3.8 +install_requires = + numpy >= 1.21.0 + scipy >= 1.4.0 + +[options.extras_require] +advanced = + llvmlite + numba + pyfftw + PyWavelets + scikit-fmm + spgl1 + [aliases] test=pytest @@ -11,7 +64,6 @@ per-file-ignores = __init__.py: F401, F403, F405 max-line-length = 88 - # mypy global options [mypy] plugins = numpy.typing.mypy_plugin diff --git a/setup.py b/setup.py deleted file mode 100755 index 8b82afa2..00000000 --- a/setup.py +++ /dev/null @@ -1,54 +0,0 @@ -import os - -from setuptools import find_packages, setup - - -def src(pth): - return os.path.join(os.path.dirname(__file__), pth) - - -# Project description -descr = ( - "Python library implementing linear operators to allow solving large-scale optimization " - "problems without requiring to explicitly create a dense (or sparse) matrix." -) - -# Setup -setup( - name="pylops", - description=descr, - long_description=open(src("README.md")).read(), - long_description_content_type="text/markdown", - keywords=["algebra", "inverse problems", "large-scale optimization"], - classifiers=[ - "Development Status :: 5 - Production/Stable", - "Intended Audience :: Developers", - "Intended Audience :: Science/Research", - "License :: OSI Approved :: GNU Lesser General Public License v2 or later (LGPLv2+)", - "Natural Language :: English", - "Programming Language :: Python :: 3.8", - "Programming Language :: Python :: 3.9", - "Topic :: Scientific/Engineering :: Mathematics", - ], - author="mrava", - author_email="matteoravasi@gmail.com", - install_requires=["numpy >= 1.21.0", "scipy >= 1.4.0"], - extras_require={ - "advanced": [ - "llvmlite", - "numba", - "pyfftw", - "PyWavelets", - "scikit-fmm", - "spgl1", - ] - }, - packages=find_packages(exclude=["pytests"]), - use_scm_version=dict( - root=".", relative_to=__file__, write_to=src("pylops/version.py") - ), - setup_requires=["pytest-runner", "setuptools_scm"], - test_suite="pytests", - tests_require=["pytest"], - zip_safe=True, -) From 58e73cf835568555935c33490c1de0083fa08300 Mon Sep 17 00:00:00 2001 From: mrava87 Date: Sun, 1 Oct 2023 20:46:45 +0300 Subject: [PATCH 02/10] minor: fix coveragfe --- .github/workflows/codacy-coverage-reporter.yaml | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/.github/workflows/codacy-coverage-reporter.yaml b/.github/workflows/codacy-coverage-reporter.yaml index 837e1478..ef08f129 100644 --- a/.github/workflows/codacy-coverage-reporter.yaml +++ b/.github/workflows/codacy-coverage-reporter.yaml @@ -6,18 +6,22 @@ on: [push, pull_request_target] jobs: build: + strategy: + matrix: + platform: [ ubuntu-latest, ] + python-version: ["3.8", ] - runs-on: ubuntu-latest + runs-on: ${{ matrix.platform }} steps: - uses: actions/checkout@v3 - - name: Set up Python + - name: Set up Python ${{ matrix.python-version }} uses: actions/setup-python@v4 with: - python-version: 3.8 + python-version: ${{ matrix.python-version }} - name: Install dependencies run: | python -m pip install --upgrade pip - pip install flake8 pytest coverage + pip install flake8 pytest if [ -f requirements.txt ]; then pip install -r requirements-dev.txt; fi - name: Install pylops run: | From bfab9a43f7a66c5f9cad5783955f7bbdef3c063d Mon Sep 17 00:00:00 2001 From: mrava87 Date: Sun, 1 Oct 2023 20:52:17 +0300 Subject: [PATCH 03/10] minor: fix coveragfe --- .github/workflows/codacy-coverage-reporter.yaml | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/.github/workflows/codacy-coverage-reporter.yaml b/.github/workflows/codacy-coverage-reporter.yaml index ef08f129..42c07b0b 100644 --- a/.github/workflows/codacy-coverage-reporter.yaml +++ b/.github/workflows/codacy-coverage-reporter.yaml @@ -26,12 +26,6 @@ jobs: - name: Install pylops run: | pip install . - - name: Code coverage with coverage + - name: Test with pytest run: | - coverage run -m pytest - coverage xml - - name: Run codacy-coverage-reporter - uses: codacy/codacy-coverage-reporter-action@v1 - with: - project-token: ${{ secrets.CODACY_PROJECT_TOKEN }} - coverage-reports: coverage.xml + pytest From 42af4989b377e87b6e546fd9aa8672e45dd1f045 Mon Sep 17 00:00:00 2001 From: mrava87 Date: Sun, 1 Oct 2023 20:57:11 +0300 Subject: [PATCH 04/10] minor: fix coveragfe --- .github/workflows/codacy-coverage-reporter.yaml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/codacy-coverage-reporter.yaml b/.github/workflows/codacy-coverage-reporter.yaml index 42c07b0b..3093e5d4 100644 --- a/.github/workflows/codacy-coverage-reporter.yaml +++ b/.github/workflows/codacy-coverage-reporter.yaml @@ -2,14 +2,14 @@ # For more information see: https://github.com/codacy/codacy-coverage-reporter-action name: PyLops-coverage -on: [push, pull_request_target] +on: [push, pull_request] jobs: build: strategy: matrix: - platform: [ ubuntu-latest, ] - python-version: ["3.8", ] + platform: [ ubuntu-latest, macos-latest ] + python-version: ["3.8", "3.9", "3.10"] runs-on: ${{ matrix.platform }} steps: From 53054f5eef1d5e067eb4dfde29ca08763834ac91 Mon Sep 17 00:00:00 2001 From: mrava87 Date: Sun, 1 Oct 2023 21:03:49 +0300 Subject: [PATCH 05/10] minor: fix coveragfe --- .github/workflows/codacy-coverage-reporter.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/codacy-coverage-reporter.yaml b/.github/workflows/codacy-coverage-reporter.yaml index 3093e5d4..99fa9c80 100644 --- a/.github/workflows/codacy-coverage-reporter.yaml +++ b/.github/workflows/codacy-coverage-reporter.yaml @@ -21,7 +21,7 @@ jobs: - name: Install dependencies run: | python -m pip install --upgrade pip - pip install flake8 pytest + pip install flake8 pytest coverage if [ -f requirements.txt ]; then pip install -r requirements-dev.txt; fi - name: Install pylops run: | From 634cefc8659ac7795713dd29f94b1df4adca1afd Mon Sep 17 00:00:00 2001 From: mrava87 Date: Sun, 1 Oct 2023 21:09:06 +0300 Subject: [PATCH 06/10] minor: fix coveragfe --- .github/workflows/codacy-coverage-reporter.yaml | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/.github/workflows/codacy-coverage-reporter.yaml b/.github/workflows/codacy-coverage-reporter.yaml index 99fa9c80..092fb57f 100644 --- a/.github/workflows/codacy-coverage-reporter.yaml +++ b/.github/workflows/codacy-coverage-reporter.yaml @@ -21,11 +21,9 @@ jobs: - name: Install dependencies run: | python -m pip install --upgrade pip - pip install flake8 pytest coverage + pip install flake8 pytest if [ -f requirements.txt ]; then pip install -r requirements-dev.txt; fi - name: Install pylops run: | pip install . - - name: Test with pytest - run: | - pytest + pip install coverage From 5c0c8f5fcaaf23db5b9ca6e3e6b2f7a9c93705de Mon Sep 17 00:00:00 2001 From: mrava87 Date: Sun, 1 Oct 2023 21:13:34 +0300 Subject: [PATCH 07/10] minor: fix coveragfe --- .github/workflows/codacy-coverage-reporter.yaml | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/.github/workflows/codacy-coverage-reporter.yaml b/.github/workflows/codacy-coverage-reporter.yaml index 092fb57f..f1a3f95a 100644 --- a/.github/workflows/codacy-coverage-reporter.yaml +++ b/.github/workflows/codacy-coverage-reporter.yaml @@ -27,3 +27,12 @@ jobs: run: | pip install . pip install coverage + - name: Code coverage with coverage + run: | + coverage run -m pytest + coverage xml + - name: Run codacy-coverage-reporter + uses: codacy/codacy-coverage-reporter-action@v1 + with: + project-token: ${{ secrets.CODACY_PROJECT_TOKEN }} + coverage-reports: coverage.xml From 9c3eef3f744e5734098d1638e82c8215ef059a9b Mon Sep 17 00:00:00 2001 From: mrava87 Date: Sun, 1 Oct 2023 21:25:14 +0300 Subject: [PATCH 08/10] minor: fix coveragfe --- .github/workflows/codacy-coverage-reporter.yaml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/codacy-coverage-reporter.yaml b/.github/workflows/codacy-coverage-reporter.yaml index f1a3f95a..b16411b4 100644 --- a/.github/workflows/codacy-coverage-reporter.yaml +++ b/.github/workflows/codacy-coverage-reporter.yaml @@ -2,14 +2,14 @@ # For more information see: https://github.com/codacy/codacy-coverage-reporter-action name: PyLops-coverage -on: [push, pull_request] +on: [push, pull_request_target] jobs: build: strategy: matrix: - platform: [ ubuntu-latest, macos-latest ] - python-version: ["3.8", "3.9", "3.10"] + platform: [ ubuntu-latest, ] + python-version: ["3.8", ] runs-on: ${{ matrix.platform }} steps: From eb2204279ebd3d107fcc1096ccab55a0256cb316 Mon Sep 17 00:00:00 2001 From: mrava87 Date: Sun, 1 Oct 2023 21:37:12 +0300 Subject: [PATCH 09/10] minor: fix coveragfe --- .github/workflows/codacy-coverage-reporter.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/codacy-coverage-reporter.yaml b/.github/workflows/codacy-coverage-reporter.yaml index b16411b4..5e3ed9fe 100644 --- a/.github/workflows/codacy-coverage-reporter.yaml +++ b/.github/workflows/codacy-coverage-reporter.yaml @@ -8,8 +8,8 @@ jobs: build: strategy: matrix: - platform: [ ubuntu-latest, ] - python-version: ["3.8", ] + platform: [ ubuntu-latest, macos-latest ] + python-version: ["3.8", "3.9", "3.10"] runs-on: ${{ matrix.platform }} steps: From a4925581c4f1406fc9d6c0af70dbcf8aa8b2cd52 Mon Sep 17 00:00:00 2001 From: mrava87 Date: Tue, 3 Oct 2023 20:38:43 +0300 Subject: [PATCH 10/10] fix: change make rule for tests --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 0ac4b3d5..2db298d1 100755 --- a/Makefile +++ b/Makefile @@ -31,7 +31,7 @@ dev-install_conda: tests: make pythoncheck - $(PYTHON) setup.py test + pytest doc: cd docs && rm -rf source/api/generated && rm -rf source/gallery &&\