Repository: ASFHyP3/hyp3-sdk (language: python)

Issue:
fix tag in reusable workflow
<!--
If this is a pull request for a new release, please use the release template:
   https://github.com/ASFHyP3/hyp3-sdk/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/distribute.yml b/.github/workflows/distribute.yml
index c96d9e5..5483c09 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: hyp3-sdk
+
   distribute:
     runs-on: ubuntu-latest
-    outputs:
-      SDIST_VERSION: ${{ steps.build.outputs.version }}
+    defaults:
+      run:
+        shell: bash -l {0}
     steps:
-      - uses: actions/checkout@v2
-
-      - uses: actions/setup-python@v1
+      - uses: actions/checkout@v3
         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@v2
 
-      - uses: conda-incubator/setup-miniconda@v2
-        with:
-          mamba-version: "*"
-          python-version: 3.8
-          activate-environment: hyp3-sdk
-          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 hyp3_sdk v${{ needs.call-version-info-workflow.outputs.version }}} is pip installable
         run: |
-          python -m pip install hyp3_sdk==${{ needs.distribute.outputs.SDIST_VERSION }}
+          python -m pip install hyp3_sdk==${{ needs.call-version-info-workflow.outputs.version_tag }}
diff --git a/.github/workflows/static-analysis.yml b/.github/workflows/static-analysis.yml
index 2c543d3..333f6f2 100644
--- a/.github/workflows/static-analysis.yml
+++ b/.github/workflows/static-analysis.yml
@@ -6,11 +6,11 @@ jobs:
   flake8:
     runs-on: ubuntu-latest
     steps:
-      - uses: actions/checkout@v2
+      - uses: actions/checkout@v3
 
-      - uses: actions/setup-python@v1
+      - uses: actions/setup-python@v4
         with:
-          python-version: 3.8
+          python-version: "3.10"
 
       - name: Install dependencies
         run: |
@@ -23,4 +23,4 @@ jobs:
               --application-import-names hyp3_sdk
 
   call-secrets-analysis-workflow:
-    uses: ASFHyP3/actions/.github/workflows/reusable-secrets-analysis.yml@main
+    uses: ASFHyP3/actions/.github/workflows/reusable-secrets-analysis.yml@v0.6.0
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 593c25e..7c1111f 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -7,6 +7,12 @@ 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).
 
 
+## [1.7.4]
+### Changed
+* `hyp3-sdk` now uses a `src` layout per this [recommendation](https://packaging.python.org/en/latest/discussions/src-layout-vs-flat-layout/).
+* `hyp3-sdk` 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).
+* `hyp3_sdk.util` is now included in the main `hyp3_sdk` API and does not need to be imported separately
+
 ## [1.7.3]
 ### Added
 * 10 m can now be provided to the `resolution` keyword argument of `hyp3.submit_rtc_job` and `hyp3.prepare_rtc_job`.
diff --git a/MANIFEST.in b/MANIFEST.in
index 7043374..1b33785 100644
--- a/MANIFEST.in
+++ b/MANIFEST.in
@@ -1,6 +1,1 @@
-include LICENSE
-include README.md
-
-graft hyp3_sdk
-
 global-exclude *.py[cod] __pycache__ *.so
diff --git a/environment.yml b/environment.yml
index 633e178..2445ab7 100644
--- a/environment.yml
+++ b/environment.yml
@@ -6,14 +6,14 @@ dependencies:
   - python>=3.8
   - pip
   # For packaging, and testing
+  - build
   - flake8
   - flake8-import-order
   - flake8-blind-except
   - flake8-builtins
   - jupyter
-  - setuptools
-  - setuptools_scm
-  - wheel
+  - setuptools>=61
+  - setuptools_scm>=6.2
   - pytest
   - pytest-cov
   - responses
@@ -22,4 +22,3 @@ dependencies:
   - requests
   - tqdm
   - urllib3
-
diff --git a/hyp3_sdk/__init__.py b/hyp3_sdk/__init__.py
deleted file mode 100644
index fbeab6e..0000000
--- a/hyp3_sdk/__init__.py
+++ /dev/null
@@ -1,25 +0,0 @@
-"""A python wrapper around the HyP3 API"""
-
-from importlib.metadata import PackageNotFoundError, version
-
-from .config import TESTING  # noqa
-from .hyp3 import HyP3, PROD_API, TEST_API
-from .jobs import Batch, Job
-
-try:
-    __version__ = version(__name__)
-except PackageNotFoundError:
-    print('package is not installed!\n'
-          'Install in editable/develop mode via (from the top of this repo):\n'
-          '   python -m pip install -e .\n'
-          'Or, to just get the version number use:\n'
-          '   python setup.py --version')
-
-__all__ = [
-    'Batch',
-    'HyP3',
-    'PROD_API',
-    'TEST_API',
-    'Job',
-    '__version__',
-]
diff --git a/postBuild b/postBuild
index 5b0aba6..68e0c6e 100644
--- a/postBuild
+++ b/postBuild
@@ -1,6 +1,6 @@
 #!/bin/bash
 # This file is used by Binder to install this repo into the binder environment
 #    https://mybinder.readthedocs.io/en/latest/using/config_files.html#postbuild-run-code-after-installing-the-environment
-# Notably, providing an environment.yml file means pip files (requirements.txt and setup.py) are ignored
+# Notably, providing an environment.yml file means pip files (requirements.txt and pyproject.toml) are ignored
 
 python -m pip install -e .[develop]
diff --git a/pyproject.toml b/pyproject.toml
index 51000e4..3aaf6cd 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -1,2 +1,50 @@
 [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 = "hyp3_sdk"
+requires-python = ">=3.8"
+authors = [
+    {name="ASF APD/Tools Team", email="uaf-asf-apd@alaska.edu"},
+]
+description = "A python wrapper around the HyP3 API"
+readme = "src/hyp3_sdk/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 = [
+    "python-dateutil",
+    "requests",
+    "urllib3",
+    "tqdm",
+]
+dynamic = ["version"]
+
+[project.optional-dependencies]
+develop = [
+    "pytest",
+    "pytest-cov",
+    "responses"
+]
+
+[project.urls]
+Homepage = "https://github.com/ASFHyP3/hyp3-sdk"
+"Bug Tracker" = "https://github.com/ASFHyP3/hyp3-sdk/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 c492af0..0000000
--- a/setup.py
+++ /dev/null
@@ -1,53 +0,0 @@
-import os
-
-from setuptools import find_packages, setup
-
-_HERE = os.path.abspath(os.path.dirname(__file__))
-with open(os.path.join(_HERE, 'README.md'), 'r') as f:
-    long_desc = f.read()
-
-setup(
-    name='hyp3_sdk',
-    use_scm_version=True,
-    description='A python wrapper around the HyP3 API',
-    long_description=long_desc,
-    long_description_content_type='text/markdown',
-
-    url='https://github.com/ASFHyP3/hyp3-sdk',
-
-    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=[
-        'python-dateutil',
-        'requests',
-        'urllib3',
-        'tqdm',
-    ],
-
-    extras_require={
-        'develop': [
-            'pytest',
-            'pytest-cov',
-            'responses',
-        ]
-    },
-
-    packages=find_packages(),
-
-    zip_safe=False,
-)
diff --git a/src/hyp3_sdk/__init__.py b/src/hyp3_sdk/__init__.py
new file mode 100644
index 0000000..0bc7645
--- /dev/null
+++ b/src/hyp3_sdk/__init__.py
@@ -0,0 +1,21 @@
+"""A python wrapper around the HyP3 API"""
+
+from importlib.metadata import version
+
+from . import util
+from .config import TESTING  # noqa
+from .hyp3 import HyP3, PROD_API, TEST_API
+from .jobs import Batch, Job
+
+
+__version__ = version(__name__)
+
+__all__ = [
+    '__version__',
+    'Batch',
+    'HyP3',
+    'Job',
+    'PROD_API',
+    'TEST_API',
+    'util',
+]
diff --git a/hyp3_sdk/config.py b/src/hyp3_sdk/config.py
similarity index 100%
rename from hyp3_sdk/config.py
rename to src/hyp3_sdk/config.py
diff --git a/hyp3_sdk/exceptions.py b/src/hyp3_sdk/exceptions.py
similarity index 100%
rename from hyp3_sdk/exceptions.py
rename to src/hyp3_sdk/exceptions.py
diff --git a/hyp3_sdk/hyp3.py b/src/hyp3_sdk/hyp3.py
similarity index 100%
rename from hyp3_sdk/hyp3.py
rename to src/hyp3_sdk/hyp3.py
diff --git a/hyp3_sdk/jobs.py b/src/hyp3_sdk/jobs.py
similarity index 100%
rename from hyp3_sdk/jobs.py
rename to src/hyp3_sdk/jobs.py
diff --git a/hyp3_sdk/util.py b/src/hyp3_sdk/util.py
similarity index 100%
rename from hyp3_sdk/util.py
rename to src/hyp3_sdk/util.py


Test patch:
diff --git a/.github/workflows/test-and-tag.yml b/.github/workflows/test-and-tag.yml
index ebf5e17..a2aead0 100644
--- a/.github/workflows/test-and-tag.yml
+++ b/.github/workflows/test-and-tag.yml
@@ -15,7 +15,7 @@ jobs:
     runs-on: ubuntu-latest
     strategy:
       matrix:
-        python-version: [3.8, 3.9]
+        python-version: ["3.8", "3.9", "3.10"]
 
     steps:
       - uses: actions/checkout@v2