From b33836d4372680540f590aa02fcbaf9c65fd56d7 Mon Sep 17 00:00:00 2001 From: dylanagreen Date: Fri, 12 Sep 2025 10:51:08 -0700 Subject: [PATCH 1/9] Add pyproject.toml and migrate most info from setup.py. --- pyproject.toml | 14 ++++++++++++++ setup.py | 10 +--------- 2 files changed, 15 insertions(+), 9 deletions(-) create mode 100644 pyproject.toml diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..dd75822 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,14 @@ +[build-system] +requires = ["setuptools"] +build-backend = "setuptools.build_meta" + +[project] +name = "quasarnp" +description = "Numpy Implementation of QuasarNet" +dynamic = ["version"] +authors = [{name = "Dylan Green", email = "dylangreen@lbl.gov"}] +license = "MIT" +dependencies = ["numpy", + "fitsio", + "h5py"] +readme = "README.md" \ No newline at end of file diff --git a/setup.py b/setup.py index 1515c37..b4d779f 100644 --- a/setup.py +++ b/setup.py @@ -1,4 +1,4 @@ -import os, sys, glob, re +import re from setuptools import setup, find_packages def _get_version(): @@ -13,16 +13,8 @@ def _get_version(): return version setup_keywords = dict( - name='quasarnp', version=_get_version(), - description='Numpy Implementation of QuasarNet', - url='https://github.com/dylanagreen/QuasarNP', - author='Dylan Green', - author_email='dylanag@uci.edu', - license='MIT', packages=find_packages(), - install_requires=['numpy', 'fitsio', 'h5py'], - zip_safe=False, ) setup(**setup_keywords) \ No newline at end of file From a0a93c09bbf283f88598db8444e2f45384e4c05b Mon Sep 17 00:00:00 2001 From: dylanagreen Date: Fri, 12 Sep 2025 10:56:14 -0700 Subject: [PATCH 2/9] Update github workflow to latest action and python versions. --- .github/workflows/ci.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 5fdb079..dc5fb5a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -17,15 +17,15 @@ jobs: fail-fast: true matrix: os: [ubuntu-latest] - python-version: [3.7, 3.8] + python-version: [3.10, 3.11, 3.12] steps: - name: Checkout code - uses: actions/checkout@v2 + uses: actions/checkout@v5 with: fetch-depth: 0 - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v2 + uses: actions/setup-python@v6 with: python-version: ${{ matrix.python-version }} - name: Install Python dependencies From fbd6d2cacfc3f1ef6fdb530b3fa73d0b0660bf60 Mon Sep 17 00:00:00 2001 From: dylanagreen Date: Fri, 12 Sep 2025 11:03:09 -0700 Subject: [PATCH 3/9] Remove Python 3.10 from testing and replace with 3.13. --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index dc5fb5a..bab97e0 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -17,7 +17,7 @@ jobs: fail-fast: true matrix: os: [ubuntu-latest] - python-version: [3.10, 3.11, 3.12] + python-version: [3.11, 3.12, 3.13] steps: - name: Checkout code From 4d5db74c306c654ed3ba3a91fc54f037013b799e Mon Sep 17 00:00:00 2001 From: dylanagreen Date: Fri, 12 Sep 2025 11:52:08 -0700 Subject: [PATCH 4/9] First attempt at coveralls integration. --- .github/workflows/ci.yml | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index bab97e0..ab25005 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -31,9 +31,13 @@ jobs: - name: Install Python dependencies run: | python -m pip install --upgrade pip wheel - python -m pip install pytest + python -m pip install pytest coverage coveralls pip install . - - name: Run the test - run: pytest + - name: Test + run: coverage run -m pytest + - name: Coveralls + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: coveralls From 01c937516386676f1aafa004d9ba5725900940d8 Mon Sep 17 00:00:00 2001 From: dylanagreen Date: Fri, 12 Sep 2025 11:59:45 -0700 Subject: [PATCH 5/9] Coverage badge in README. --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 15065e7..e2b3b57 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,6 @@ # QuasarNP [![Documentation Status](https://readthedocs.org/projects/quasarnp/badge/?version=latest)](https://quasarnp.readthedocs.io/en/latest/?badge=latest) +[![Coverage Status](https://coveralls.io/repos/github/desihub/QuasarNP/badge.svg?branch=technical_debt)](https://coveralls.io/github/desihub/QuasarNP?branch=technical_debt) QuasarNP is a pure numpy implementation of [QuasarNet](https://github.com/ngbusca/QuasarNET) that is designed to work on the default DESI environment at NERSC without any additional dependencies. From 323e407b3d6a055e80b914a717ca15137387b962 Mon Sep 17 00:00:00 2001 From: dylanagreen Date: Mon, 15 Sep 2025 15:19:44 -0700 Subject: [PATCH 6/9] Resolve a warning due to an esacpe sequence. --- quasarnp/layers.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/quasarnp/layers.py b/quasarnp/layers.py index 51ad192..7c91729 100644 --- a/quasarnp/layers.py +++ b/quasarnp/layers.py @@ -65,7 +65,7 @@ def dense(x, w, b, phi): # This has same behavior as: # https://www.tensorflow.org/api_docs/python/tf/nn/batch_normalization def batch_normalization(x, mean, var, beta, gamma, epsilon): - """Computes the batch normalized version of the input. + r"""Computes the batch normalized version of the input. This function implements a batch normalization layer. Batch normalization renormalizes the input to the layer to a more parsable data range. From d1079b1b6cd69ba6cf0aa86041b64d9eee769d86 Mon Sep 17 00:00:00 2001 From: dylanagreen Date: Mon, 15 Sep 2025 16:02:58 -0700 Subject: [PATCH 7/9] Test on variety of different numpy versions. --- .github/workflows/ci.yml | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ab25005..a2c7a21 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -16,8 +16,24 @@ jobs: strategy: fail-fast: true matrix: - os: [ubuntu-latest] - python-version: [3.11, 3.12, 3.13] + include: + - os: ubuntu-latest + python-version: '3.13' + numpy-version: '<3' + astropy-version: '<8' + - os: ubuntu-latest + python-version: '3.12' + numpy-version: '<2.3' + astropy-version: '<7.1' + - os: ubuntu-latest + python-version: '3.11' + numpy-version: '<2.1' + astropy-version: '<7' + # Similar to NERSC but with last NumPy < 2. + - os: ubuntu-latest + python-version: '3.10' + numpy-version: '<2' + astropy-version: '<6.1' steps: - name: Checkout code From b5c11c712fcd297dc7f85f42731584b19cd4fdcf Mon Sep 17 00:00:00 2001 From: dylanagreen Date: Mon, 15 Sep 2025 16:07:42 -0700 Subject: [PATCH 8/9] Only run coverage on one test run. --- .github/workflows/ci.yml | 31 ++++++++++++++++++++++++++++++- 1 file changed, 30 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a2c7a21..737ae39 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -35,6 +35,35 @@ jobs: numpy-version: '<2' astropy-version: '<6.1' + steps: + - name: Checkout code + uses: actions/checkout@v5 + with: + fetch-depth: 0 + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v6 + with: + python-version: ${{ matrix.python-version }} + - name: Install Python dependencies + run: | + python -m pip install --upgrade pip wheel + pip install . + - name: Test + run: pytest + + coverage: + name: Test coverage + runs-on: ${{ matrix.os }} + strategy: + fail-fast: true + matrix: + include: + # Similar to NERSC but with last NumPy < 2. + - os: ubuntu-latest + python-version: '3.10' + numpy-version: '<2' + astropy-version: '<6.1' + steps: - name: Checkout code uses: actions/checkout@v5 @@ -54,6 +83,6 @@ jobs: - name: Coveralls env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - run: coveralls + run: coveralls --service=github From c336a2c044f7ee84c342f30a5f6d129ea2d36d69 Mon Sep 17 00:00:00 2001 From: dylanagreen Date: Mon, 15 Sep 2025 16:09:44 -0700 Subject: [PATCH 9/9] Actually install pytest... --- .github/workflows/ci.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 737ae39..6e6a4cb 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -47,6 +47,7 @@ jobs: - name: Install Python dependencies run: | python -m pip install --upgrade pip wheel + python -m pip install pytest pip install . - name: Test run: pytest