Repository: ASFHyP3/asf-tools (language: python)

Issue:
update changelog
<!--
If this is a pull request for a new release, please use the release template:
   https://github.com/ASFHyP3/asf-tools/compare/main...develop?template=release.md
 
NOTE: Pull requests should only be opened for merges to protected branches (required) and any 
changes which you'd like reviewed. Do not open a pull request to update a feature or personal
branch -- simply merge with `git`.
-->


Discussion / hints:

Fix patch:
diff --git a/.github/workflows/changelog.yml b/.github/workflows/changelog.yml
index 7d822a64..158e6cc8 100644
--- a/.github/workflows/changelog.yml
+++ b/.github/workflows/changelog.yml
@@ -11,6 +11,6 @@ on:
       - develop
 jobs:
   call-changelog-check-workflow:
-    uses: ASFHyP3/actions/.github/workflows/reusable-changelog-check.yml@v0.4.0
+    uses: ASFHyP3/actions/.github/workflows/reusable-changelog-check.yml@v0.6.0
     secrets:
       USER_TOKEN: ${{ secrets.GITHUB_TOKEN }}
diff --git a/.github/workflows/distribute.yml b/.github/workflows/distribute.yml
index b479ad4f..b4e7c60c 100644
--- a/.github/workflows/distribute.yml
+++ b/.github/workflows/distribute.yml
@@ -6,50 +6,47 @@ on:
       - v*
 
 jobs:
+  call-version-info-workflow:
+    uses: ASFHyP3/actions/.github/workflows/reusable-version-info.yml@v0.6.0
+    with:
+      conda_env_name: asf-tools
+
   distribute:
     runs-on: ubuntu-latest
-    outputs:
-      SDIST_VERSION: ${{ steps.build.outputs.version }}
+    defaults:
+      run:
+        shell: bash -l {0}
     steps:
       - uses: actions/checkout@v3
-
-      - uses: actions/setup-python@v4
         with:
-          python-version: 3.8
+          fetch-depth: 0
 
-      - name: Install dependencies
-        run: |
-          python -m pip install --upgrade pip
-          python -m pip install --upgrade setuptools wheel "setuptools-scm[toml]"
+      - uses: mamba-org/provision-with-micromamba@v14
 
-      - name: Build distribuion
+      - name: Build distribution
         id: build
         run: |
-          git fetch origin +refs/tags/*:refs/tags/*
-          export SDIST_VERSION=$(python setup.py --version)
-          echo "::set-output name=version::${SDIST_VERSION}"
-          python setup.py sdist bdist_wheel
+          python -m build
 
       - name: upload to PyPI.org
-        uses: pypa/gh-action-pypi-publish@master
+        uses: pypa/gh-action-pypi-publish@v1.6.4
         with:
           user: __token__
           password: ${{ secrets.TOOLS_PYPI_PAK }}
 
   verify-distribution:
     runs-on: ubuntu-latest
-    needs: distribute
+    needs:
+      - call-version-info-workflow
+      - distribute
+    defaults:
+      run:
+        shell: bash -l {0}
     steps:
-      - uses: actions/checkout@v3
+      - uses: actions/checkout@v2
 
-      - uses: conda-incubator/setup-miniconda@v2
-        with:
-          mamba-version: "*"
-          python-version: 3.8
-          activate-environment: asf-tools
-          environment-file: environment.yml
+      - uses: mamba-org/provision-with-micromamba@v14
 
-      - name: Pip install ${{ needs.distribute.outputs.SDIST_VERSION }}
-        shell: bash -l {0}
+      - name: Ensure asf_tools v${{ needs.call-version-info-workflow.outputs.version }}} is pip installable
         run: |
-          python -m pip install asf_tools==${{ needs.distribute.outputs.SDIST_VERSION }}
+          python -m pip install asf_tools==${{ needs.call-version-info-workflow.outputs.version_tag }}
diff --git a/.github/workflows/labeled-pr.yml b/.github/workflows/labeled-pr.yml
index a0a3ecf8..0471f4a6 100644
--- a/.github/workflows/labeled-pr.yml
+++ b/.github/workflows/labeled-pr.yml
@@ -12,4 +12,4 @@ on:
 
 jobs:
   call-labeled-pr-check-workflow:
-    uses: ASFHyP3/actions/.github/workflows/reusable-labeled-pr-check.yml@v0.4.0
+    uses: ASFHyP3/actions/.github/workflows/reusable-labeled-pr-check.yml@v0.6.0
diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml
index fef586ca..daef3956 100644
--- a/.github/workflows/release.yml
+++ b/.github/workflows/release.yml
@@ -36,10 +36,9 @@ jobs:
             ${{ steps.release_assets.outputs.ARC_FILE }}
 
       - name: Bump ASF Tools version in HyP3 docs
-        uses: benc-uk/workflow-dispatch@v1.1
+        uses: benc-uk/workflow-dispatch@v1.2
         with:
-          workflow: Update ASF Tools version
-          token: ${{ secrets.TOOLS_BOT_PAK }}
+          workflow: update_asf_tools_version.yml
           repo: ASFHyP3/hyp3-docs
           ref: main
           inputs: '{"asf_tools_version": "${{ steps.release_assets.outputs.version_tag }}"}'
diff --git a/.github/workflows/static-analysis.yml b/.github/workflows/static-analysis.yml
index 542c1faf..1cd9d40b 100644
--- a/.github/workflows/static-analysis.yml
+++ b/.github/workflows/static-analysis.yml
@@ -10,7 +10,7 @@ jobs:
 
       - uses: actions/setup-python@v4
         with:
-          python-version: 3.8
+          python-version: "3.10"
 
       - name: Install dependencies
         run: |
@@ -20,31 +20,8 @@ jobs:
       - name: Lint with flake8
         run: |
           flake8 --max-line-length=120 --import-order-style=pycharm --statistics \
-              --application-import-names asf_tools ArcGIS-toolbox/ASF_Tools.pyt asf_tools
+              --application-import-names asf_tools ArcGIS-toolbox/ASF_Tools.pyt src/asf_tools
 
 
   call-secrets-analysis-workflow:
-    uses: ASFHyP3/actions/.github/workflows/reusable-secrets-analysis.yml@v0.4.0
-
-
-  trufflehog:
-    runs-on: ubuntu-latest
-    steps:
-      - uses: actions/checkout@v3
-        with:
-          fetch-depth: 0
-
-      - uses: actions/setup-python@v4
-        with:
-          python-version: 3.8
-
-      - name: Install dependencies
-        run: |
-          python -m pip install trufflehog gitdb2=='2.*'
-
-      - name: Scan for secrets with trufflehog
-        run: |
-          git fetch origin +refs/tags/*:refs/tags/*
-          export LAST_TAG_HASH=$(git show-ref --hash -- $(git describe --abbrev=0))
-          trufflehog --regex --entropy True --since_commit '${LAST_TAG_HASH}' \
-              --exclude_paths .trufflehog.txt file://'${PWD}'
+    uses: ASFHyP3/actions/.github/workflows/reusable-secrets-analysis.yml@v0.6.0
diff --git a/.github/workflows/tag-version.yml b/.github/workflows/tag-version.yml
index 20a3194c..7aa92a33 100644
--- a/.github/workflows/tag-version.yml
+++ b/.github/workflows/tag-version.yml
@@ -7,6 +7,6 @@ on:
 
 jobs:
   call-bump-version-workflow:
-    uses: ASFHyP3/actions/.github/workflows/reusable-bump-version.yml@v0.4.0
+    uses: ASFHyP3/actions/.github/workflows/reusable-bump-version.yml@v0.6.0
     secrets:
       USER_TOKEN: ${{ secrets.TOOLS_BOT_PAK }}
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 3360e285..a3c38c20 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -6,6 +6,14 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
 and this project adheres to [PEP 440](https://www.python.org/dev/peps/pep-0440/) 
 and uses [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
 
+## [0.4.5]
+
+### Changed
+* `asf-tools` now uses a `src` layout per this [recommendation](https://packaging.python.org/en/latest/discussions/src-layout-vs-flat-layout/).
+* `asf-tools` now only uses `pyproject.toml` for package creation now that `setuptools` recommends [not using setup.py](https://setuptools.pypa.io/en/latest/userguide/quickstart.html#setuppy-discouraged).
+* Temporarily pin `numpy` to `<1.2.4`; See: [#160](https://github.com/ASFHyP3/asf-tools/pull/160)```
+
+
 ## [0.4.4]
 
 ### Changed
@@ -68,7 +76,7 @@ and uses [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
 ## [0.3.1](https://github.com/ASFHyP3/asf-tools/compare/v0.3.0...v0.3.1)
 
 ### Added
-* We now provide an ASF Tools docker image: `ghcr.io/asfhyp3/asf-tools`. For usage, see the `asf_tools` [README](asf_tools/README.md).
+* We now provide an ASF Tools docker image: `ghcr.io/asfhyp3/asf-tools`. For usage, see the `asf_tools` [README](src/asf_tools/README.md).
 
 ### Changed
 * `asf_tools.water_map` will raise a `ValueError` error if the HAND data is all zero
@@ -95,7 +103,7 @@ and uses [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
 
 ### Added
 * The `asf_tools` python package for working with Synthetic Aperture Radar (SAR) data. 
-  See the [README](asf_tools/README.md)
+  See the [README](src/asf_tools/README.md)
 * `asf_tools.composite` and an associated `make_composite` entrypoint for making
   mosaics using local resolution weighting (à la [David Smalls, 2012](https://doi.org/10.1109/IGARSS.2012.6350465))
 
diff --git a/MANIFEST.in b/MANIFEST.in
index 2c3efa9c..fd98aea5 100644
--- a/MANIFEST.in
+++ b/MANIFEST.in
@@ -1,6 +1,4 @@
-include LICENSE
-include asf_tools/README.md
-
-graft asf_tools
-
 global-exclude *.py[cod] __pycache__ *.so
+
+prune ArcGIS-toolbox
+prune prototype
diff --git a/README.md b/README.md
index 74b27369..e1e15f26 100644
--- a/README.md
+++ b/README.md
@@ -25,7 +25,7 @@ be accessible to ArcGIS.
 
 ## ASF Tools for Python
 
-[asf_tools](asf_tools) is a Python package for working with Synthetic Aperture Radar (SAR) data.
+[asf_tools](src/asf_tools) is a Python package for working with Synthetic Aperture Radar (SAR) data.
 It was designed for working with datasets generated by
 [HyP3](https://hyp3-docs.asf.alaska.edu/), but several of the tools have the
 potential to be used with a variety of rasters, including non-SAR datasets.
diff --git a/environment.yml b/environment.yml
index 290681f7..4c1cf717 100644
--- a/environment.yml
+++ b/environment.yml
@@ -8,13 +8,13 @@ dependencies:
   - pip
   # For packaging, and testing
   # - arcpy  # windows only
+  - build
   - flake8
   - flake8-import-order
   - flake8-blind-except
   - flake8-builtins
-  - setuptools
-  - setuptools_scm
-  - wheel
+  - setuptools>=61
+  - setuptools_scm>=6.2
   - pytest
   - pytest-console-scripts
   - pytest-cov
@@ -22,7 +22,7 @@ dependencies:
   - astropy
   - fiona
   - gdal>=3.3
-  - numpy
+  - numpy<1.24.0
   - pysheds>=0.3
   - rasterio
   - scikit-fuzzy
diff --git a/pyproject.toml b/pyproject.toml
index 51000e45..34a26c53 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -1,2 +1,68 @@
 [build-system]
-requires = ["setuptools>=42", "wheel", "setuptools_scm[toml]>=3.4"]
+requires = ["setuptools>=61.0", "setuptools_scm[toml]>=6.2"]
+build-backend = "setuptools.build_meta"
+
+[project]
+name = "asf_tools"
+requires-python = ">=3.8"
+authors = [
+    {name="ASF APD/Tools Team", email="uaf-asf-apd@alaska.edu"},
+]
+description = "Tools developed by ASF for working with SAR data"
+readme = "src/asf_tools/README.md"
+license = {text = "BSD-3-Clause"}
+classifiers=[
+    "Intended Audience :: Science/Research",
+    "License :: OSI Approved :: BSD License",
+    "Natural Language :: English",
+    "Operating System :: OS Independent",
+    "Programming Language :: Python :: 3",
+    "Programming Language :: Python :: 3.8",
+    "Programming Language :: Python :: 3.9",
+    "Programming Language :: Python :: 3.10",
+]
+dependencies = [
+    "astropy",
+    "fiona",
+    "gdal>=3.3",
+    "numpy",
+    "pysheds>=0.3",
+    "rasterio",
+    "scikit-fuzzy",
+    "scikit-image",
+    "scipy",
+    "shapely",
+    "tqdm",
+]
+dynamic = ["version"]
+
+[project.scripts]
+make_composite = "asf_tools.composite:main"
+water_map = "asf_tools.water_map:main"
+calculate_hand = "asf_tools.hand.calculate:main"
+flood_map = "asf_tools.flood_map:main"
+
+[project.optional-dependencies]
+develop = [
+    "flake8",
+    "flake8-import-order",
+    "flake8-blind-except",
+    "flake8-builtins",
+    "gdal-utils",
+    "pytest",
+    "pytest-cov",
+    "pytest-console-scripts",
+]
+
+[project.urls]
+Homepage = "https://github.com/ASFHyP3/asf-tools"
+"Bug Tracker" = "https://github.com/ASFHyP3/asf-tools/issues"
+
+[tool.setuptools]
+include-package-data = true
+zip-safe = false
+
+[tool.setuptools.packages.find]
+where = ["src"]
+
+[tool.setuptools_scm]
diff --git a/setup.py b/setup.py
deleted file mode 100644
index 723dcac2..00000000
--- a/setup.py
+++ /dev/null
@@ -1,72 +0,0 @@
-from pathlib import Path
-
-from setuptools import find_packages, setup
-
-readme = Path(__file__).parent / 'asf_tools' / 'README.md'
-
-setup(
-    name='asf_tools',
-    use_scm_version=True,
-    description='Tools developed by ASF for working with SAR data',
-    long_description=readme.read_text(),
-    long_description_content_type='text/markdown',
-
-    url='https://github.com/ASFHyP3/asf-tools',
-
-    author='ASF APD/Tools Team',
-    author_email='uaf-asf-apd@alaska.edu',
-
-    license='BSD',
-    include_package_data=True,
-
-    classifiers=[
-        'Intended Audience :: Science/Research',
-        'License :: OSI Approved :: BSD License',
-        'Natural Language :: English',
-        'Programming Language :: Python :: 3',
-        'Programming Language :: Python :: 3.8',
-        'Programming Language :: Python :: 3.9',
-    ],
-
-    python_requires='~=3.8',
-
-    install_requires=[
-        'astropy',
-        'fiona',
-        'gdal>=3.3',
-        'numpy',
-        'pysheds>=0.3',
-        'rasterio',
-        'scikit-fuzzy',
-        'scikit-image',
-        'scipy',
-        'shapely',
-        'tqdm',
-    ],
-
-    extras_require={
-        'develop': [
-            'flake8',
-            'flake8-import-order',
-            'flake8-blind-except',
-            'flake8-builtins',
-            'gdal-utils',
-            'pytest',
-            'pytest-cov',
-            'pytest-console-scripts',
-        ]
-    },
-
-    packages=find_packages(),
-
-    entry_points={
-        'console_scripts': [
-            'make_composite = asf_tools.composite:main',
-            'water_map = asf_tools.water_map:main',
-            'calculate_hand = asf_tools.hand.calculate:main',
-            'flood_map = asf_tools.flood_map:main',
-        ]
-    },
-
-    zip_safe=False,
-)
diff --git a/asf_tools/README.md b/src/asf_tools/README.md
similarity index 100%
rename from asf_tools/README.md
rename to src/asf_tools/README.md
diff --git a/asf_tools/__init__.py b/src/asf_tools/__init__.py
similarity index 100%
rename from asf_tools/__init__.py
rename to src/asf_tools/__init__.py
diff --git a/asf_tools/composite.py b/src/asf_tools/composite.py
similarity index 100%
rename from asf_tools/composite.py
rename to src/asf_tools/composite.py
diff --git a/asf_tools/data/water_extent.vrt b/src/asf_tools/data/water_extent.vrt
similarity index 100%
rename from asf_tools/data/water_extent.vrt
rename to src/asf_tools/data/water_extent.vrt
diff --git a/asf_tools/dem.py b/src/asf_tools/dem.py
similarity index 100%
rename from asf_tools/dem.py
rename to src/asf_tools/dem.py
diff --git a/asf_tools/flood_map.py b/src/asf_tools/flood_map.py
similarity index 100%
rename from asf_tools/flood_map.py
rename to src/asf_tools/flood_map.py
diff --git a/asf_tools/hand/__init__.py b/src/asf_tools/hand/__init__.py
similarity index 100%
rename from asf_tools/hand/__init__.py
rename to src/asf_tools/hand/__init__.py
diff --git a/asf_tools/hand/calculate.py b/src/asf_tools/hand/calculate.py
similarity index 97%
rename from asf_tools/hand/calculate.py
rename to src/asf_tools/hand/calculate.py
index a965acb3..8b7836f1 100644
--- a/asf_tools/hand/calculate.py
+++ b/src/asf_tools/hand/calculate.py
@@ -70,9 +70,9 @@ def calculate_hand(dem_array, dem_affine: rasterio.Affine, dem_crs: rasterio.crs
         * Filling depressions (regions of cells lower than their surrounding neighbors)
             in the Digital Elevation Model (DEM)
         * Resolving un-drainable flats
-        * Determine the flow direction using the ESRI D8 routing scheme
-        * Determine flow accumulation (number of upstream cells)
-        * Create a drainage mask using the accumulation threshold `acc_thresh`
+        * Determining the flow direction using the ESRI D8 routing scheme
+        * Determining flow accumulation (number of upstream cells)
+        * Creating a drainage mask using the accumulation threshold `acc_thresh`
         * Calculating HAND
 
     In the HAND calculation, NaNs inside the basin filled using `fill_hand`
diff --git a/asf_tools/hand/prepare.py b/src/asf_tools/hand/prepare.py
similarity index 100%
rename from asf_tools/hand/prepare.py
rename to src/asf_tools/hand/prepare.py
diff --git a/asf_tools/raster.py b/src/asf_tools/raster.py
similarity index 100%
rename from asf_tools/raster.py
rename to src/asf_tools/raster.py
diff --git a/asf_tools/threshold.py b/src/asf_tools/threshold.py
similarity index 100%
rename from asf_tools/threshold.py
rename to src/asf_tools/threshold.py
diff --git a/asf_tools/tile.py b/src/asf_tools/tile.py
similarity index 100%
rename from asf_tools/tile.py
rename to src/asf_tools/tile.py
diff --git a/asf_tools/util.py b/src/asf_tools/util.py
similarity index 100%
rename from asf_tools/util.py
rename to src/asf_tools/util.py
diff --git a/asf_tools/vector.py b/src/asf_tools/vector.py
similarity index 100%
rename from asf_tools/vector.py
rename to src/asf_tools/vector.py
diff --git a/asf_tools/water_map.py b/src/asf_tools/water_map.py
similarity index 100%
rename from asf_tools/water_map.py
rename to src/asf_tools/water_map.py


Test patch:
diff --git a/.github/workflows/test-and-build.yml b/.github/workflows/test-and-build.yml
index 7ade1d3f..f951b589 100644
--- a/.github/workflows/test-and-build.yml
+++ b/.github/workflows/test-and-build.yml
@@ -12,19 +12,19 @@ on:
 
 jobs:
   call-pytest-workflow:
-    uses: ASFHyP3/actions/.github/workflows/reusable-pytest.yml@v0.4.0
+    uses: ASFHyP3/actions/.github/workflows/reusable-pytest.yml@v0.6.0
     with:
       local_package_name: asf_tools
       conda_env_name: asf-tools
 
   call-version-info-workflow:
-    uses: ASFHyP3/actions/.github/workflows/reusable-version-info.yml@v0.4.0
+    uses: ASFHyP3/actions/.github/workflows/reusable-version-info.yml@v0.6.0
     with:
       conda_env_name: asf-tools
 
   call-docker-ghcr-workflow:
     needs: call-version-info-workflow
-    uses: ASFHyP3/actions/.github/workflows/reusable-docker-ghcr.yml@v0.4.0
+    uses: ASFHyP3/actions/.github/workflows/reusable-docker-ghcr.yml@v0.6.0
     with:
       version_tag: ${{ needs.call-version-info-workflow.outputs.version_tag }}
     secrets: