Skip to content

Commit

Permalink
Merge pull request #152 from openspyrit/pyproject
Browse files Browse the repository at this point in the history
Transfer all information from setup.py to pyproject.toml
  • Loading branch information
nducros committed May 3, 2024
2 parents 743c241 + 3436375 commit a203dfe
Show file tree
Hide file tree
Showing 11 changed files with 80 additions and 73 deletions.
37 changes: 17 additions & 20 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,27 +23,27 @@ jobs:

steps:
- name: Checkout github repo
uses: actions/checkout@v2
uses: actions/checkout@v4
- name: Checkout submodules
run: git submodule update --init --recursive
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
architecture: 'x64'
- name: Create Wheel
run: |
pip install wheel
python setup.py sdist bdist_wheel
pip install build
python -m build
mkdir wheelhouse
cp dist/spyrit-* wheelhouse/
ls wheelhouse
rm -r dist
mv wheelhouse dist
- name: Upload wheels
uses: actions/upload-artifact@v1
uses: actions/upload-artifact@v4
with:
name: dist
name: dist-${{ matrix.os }}-${{ matrix.python-version }}
path: dist/

test_install:
Expand All @@ -56,11 +56,11 @@ jobs:

steps:
- name: Checkout github repo
uses: actions/checkout@v2
uses: actions/checkout@v4
- name: Checkout submodules
run: git submodule update --init --recursive
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
architecture: 'x64'
Expand All @@ -86,17 +86,18 @@ jobs:

steps:
- name: Checkout github repo
uses: actions/checkout@v2
uses: actions/checkout@v4
- name: Checkout submodules
run: git submodule update --init --recursive
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
architecture: 'x64'
- uses: actions/download-artifact@v2
- uses: actions/download-artifact@v4
with:
name: dist
pattern: dist-*
merge-multiple: true
path: dist/
- name: Run tests on Mac and Linux
if: matrix.os != 'windows-latest'
Expand All @@ -105,11 +106,6 @@ jobs:
pip install spyrit-*.whl
cd ..
python spyrit/test/run_tests.py
- name: Upload wheels
uses: actions/upload-artifact@v1
with:
name: dist
path: dist/
- name: Run the tests on Windows
if: matrix.os == 'windows-latest'
run: |
Expand All @@ -125,12 +121,13 @@ jobs:
needs: [build_wheel, test_wheel, test_install]
steps:
- name: Checkout github repo
uses: actions/checkout@v2
uses: actions/checkout@v4
- name: Checkout submodules
run: git submodule update --init --recursive
- uses: actions/download-artifact@v1
- uses: actions/download-artifact@v4
with:
name: dist
pattern: dist-*
merge-multiple: true
path: dist/
- name: Publish to PyPI
if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags/')
Expand Down
51 changes: 50 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,55 @@
[build-system]
requires = [
"setuptools>=42",
"setuptools>=67",
"wheel",
]
build-backend = "setuptools.build_meta"

[tool.setuptools]
include-package-data = true
zip-safe = false
script-files = [
"tutorial/tuto_01_acquisition_operators.py",
"tutorial/tuto_02_pseudoinverse_linear.py",
"tutorial/tuto_03_pseudoinverse_cnn_linear.py",
"tutorial/tuto_04_train_pseudoinverse_cnn_linear.py",
"tutorial/tuto_05_acquisition_split_measurements.py",
"tutorial/tuto_06_dcnet_split_measurements.py"
]

[tool.setuptools.dynamic]
readme = {file = ["README.md"]}

[tool.setuptools.packages]
find = {} # Scanning implicit namespaces is active by default

[project]
name = "spyrit"
version = "2.2.0"
dynamic = ["readme"]
authors = [{name = "Nicolas Ducros", email = "Nicolas.Ducros@insa-lyon.fr"}]
description = "Toolbox for deep image reconstruction"
license = {file = "LICENSE.md"}
classifiers = [
"Programming Language :: Python",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: Implementation :: PyPy",
"Operating System :: OS Independent",
]
dependencies = [
"numpy",
"matplotlib",
"scipy",
"torch",
"torchvision",
"Pillow",
"PyWavelets",
"wget",
"sympy",
"imageio",
"astropy",
]
requires-python = ">=3.6"
46 changes: 0 additions & 46 deletions setup.py

This file was deleted.

12 changes: 6 additions & 6 deletions spyrit/external/drunet.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,21 +42,21 @@ def __init__(
ResBlock(nc[0], nc[0], bias=False, mode="C" + act_mode + "C")
for _ in range(nb)
],
downsample_block(nc[0], nc[1], bias=False, mode="2")
downsample_block(nc[0], nc[1], bias=False, mode="2"),
)
self.m_down2 = sequential(
*[
ResBlock(nc[1], nc[1], bias=False, mode="C" + act_mode + "C")
for _ in range(nb)
],
downsample_block(nc[1], nc[2], bias=False, mode="2")
downsample_block(nc[1], nc[2], bias=False, mode="2"),
)
self.m_down3 = sequential(
*[
ResBlock(nc[2], nc[2], bias=False, mode="C" + act_mode + "C")
for _ in range(nb)
],
downsample_block(nc[2], nc[3], bias=False, mode="2")
downsample_block(nc[2], nc[3], bias=False, mode="2"),
)

self.m_body = sequential(
Expand All @@ -83,21 +83,21 @@ def __init__(
*[
ResBlock(nc[2], nc[2], bias=False, mode="C" + act_mode + "C")
for _ in range(nb)
]
],
)
self.m_up2 = sequential(
upsample_block(nc[2], nc[1], bias=False, mode="2"),
*[
ResBlock(nc[1], nc[1], bias=False, mode="C" + act_mode + "C")
for _ in range(nb)
]
],
)
self.m_up1 = sequential(
upsample_block(nc[1], nc[0], bias=False, mode="2"),
*[
ResBlock(nc[0], nc[0], bias=False, mode="C" + act_mode + "C")
for _ in range(nb)
]
],
)

self.m_tail = conv(nc[0], out_nc, bias=False, mode="C")
Expand Down
1 change: 1 addition & 0 deletions tutorial/tuto_01_acquisition_operators.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#!/usr/bin/env python3
r"""
01. Acquisition operators
==========================
Expand Down
1 change: 1 addition & 0 deletions tutorial/tuto_02_pseudoinverse_linear.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#!/usr/bin/env python3
r"""
02. Pseudoinverse solution from linear measurements
===================================================
Expand Down
1 change: 1 addition & 0 deletions tutorial/tuto_03_pseudoinverse_cnn_linear.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#!/usr/bin/env python3
r"""
03. Pseudoinverse solution + CNN denoising
==========================================
Expand Down
1 change: 1 addition & 0 deletions tutorial/tuto_04_train_pseudoinverse_cnn_linear.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#!/usr/bin/env python3
r"""
04. Train pseudoinverse solution + CNN denoising
================================================
Expand Down
1 change: 1 addition & 0 deletions tutorial/tuto_05_acquisition_split_measurements.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#!/usr/bin/env python3
r"""
05. Acquisition operators (advanced) - Split measurements and subsampling
=========================================================================
Expand Down
1 change: 1 addition & 0 deletions tutorial/tuto_06_dcnet_split_measurements.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#!/usr/bin/env python3
r"""
06. DCNet solution for split measurements
=========================================
Expand Down
1 change: 1 addition & 0 deletions tutorial/tuto_bonus_advanced_methods_colab.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#!/usr/bin/env python3
r"""
Bonus. Advanced methods - Colab
===============================
Expand Down

0 comments on commit a203dfe

Please sign in to comment.