Skip to content

Commit

Permalink
Migrate setup.cfg to pyproject.toml (NOAA-OWP#263)
Browse files Browse the repository at this point in the history
* ci: test w/ python 3.11 and 3.12

* chore: migrate setup.cfg -> pyproject.toml

* test: provide loop explicitly; aiohttp >= 3.10 reqs a running event loop

* fix: pin 1.20.0<=numpy<2 for python<3.10; see NOAA-OWP#263

* fix: pin numpy<2 for python<3.10; see NOAA-OWP#263

* docs: add Jason as nwis_client co-author

* chore: bump subpackage patch versions (sans metrics)
  • Loading branch information
aaraney authored Nov 19, 2024
1 parent 32d87fb commit 45a2d18
Show file tree
Hide file tree
Showing 34 changed files with 379 additions and 464 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/deploy-gh-pages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Python 3.8
uses: actions/setup-python@v2
- name: Set up Python 3.9
uses: actions/setup-python@v5
with:
python-version: '3.8'
python-version: '3.9'
- name: Install dependencies
run: |
python -m pip install --upgrade pip Sphinx furo
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/run_caches.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,14 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.8", "3.9", "3.10"]
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/run_events.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,14 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.8", "3.9", "3.10"]
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/run_metrics.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,14 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.9", "3.10", "3.11"]
python-version: ["3.9", "3.10", "3.11", "3.12"]

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/run_nwis_client.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,14 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.8", "3.9", "3.10"]
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/run_nwm_client.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,14 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.8", "3.9", "3.10"]
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/run_nwm_client_new.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,14 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.8", "3.9", "3.10", "3.12"]
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/run_rest_client.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,14 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.8", "3.9", "3.10"]
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/run_slow_unit_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,13 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.8", "3.9", "3.10"]
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/run_svi_client.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,14 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.8", "3.9", "3.10"]
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
Expand Down
48 changes: 43 additions & 5 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,45 @@
[build-system]
requires = [
"setuptools>=42",
"wheel",
"pip"
]
requires = ["setuptools>=70"]
build-backend = "setuptools.build_meta"

[project]
name = "hydrotools"
authors = [
{ name = "Jason A. Regina", email = "jason.regina@noaa.gov" },
{ name = "Austin Raney", email = "austin.raney@noaa.gov" },
]
description = "Suite of tools for retrieving USGS NWIS observations and evaluating National Water Model (NWM) data."
readme = "README.md"
requires-python = ">=3.8"
license = { file = "LICENSE" }
classifiers = [
"Development Status :: 5 - Production/Stable",
"Intended Audience :: Education",
"Intended Audience :: Science/Research",
"License :: Free To Use But Restricted",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Topic :: Scientific/Engineering :: Hydrology",
"Operating System :: OS Independent",
]
dependencies = [
"hydrotools.nwis_client>=3.2.1",
"hydrotools.nwm_client[gcp]>=5.0.3",
"hydrotools.events>=1.1.5",
"hydrotools.metrics>=1.2.3",
]
dynamic = ["version"]

[tool.setuptools.dynamic]
version = { attr = "hydrotools._version.__version__" }

[project.optional-dependencies]
develop = ["pytest"]

[project.urls]
Homepage = "https://github.com/NOAA-OWP/hydrotools"
Documentation = "https://noaa-owp.github.io/hydrotools"
Repository = "https://github.com/NOAA-OWP/hydrotools"
"Bug Tracker" = "https://github.com/NOAA-OWP/hydrotools/issues"
43 changes: 40 additions & 3 deletions python/_restclient/pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,43 @@
[build-system]
requires = ["setuptools>=70"]
build-backend = "setuptools.build_meta"
requires = [
"setuptools>=42",
"wheel",

[project]
name = "hydrotools._restclient"
authors = [{ name = "Austin Raney", email = "aaraney@protonmail.com" }]
description = "General REST api client with built in request caching and retries."
readme = "README.md"
requires-python = ">=3.8"
license = { file = "LICENSE" }
classifiers = [
"Development Status :: 5 - Production/Stable",
"Intended Audience :: Education",
"Intended Audience :: Science/Research",
"License :: Free To Use But Restricted",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Topic :: Scientific/Engineering :: Hydrology",
"Operating System :: OS Independent",
]
dependencies = [
"aiohttp",
"aiohttp_client_cache[sqlite]>=0.9.0",
"python-forge",
"aiosqlite",
"pandas",
]
dynamic = ["version"]

[tool.setuptools.dynamic]
version = { attr = "hydrotools._restclient._version.__version__" }

[project.optional-dependencies]
develop = ["pytest", "pytest-aiohttp"]

[project.urls]
Homepage = "https://github.com/NOAA-OWP/hydrotools"
Documentation = "https://noaa-owp.github.io/hydrotools/hydrotools._restclient.html"
Repository = "https://github.com/NOAA-OWP/hydrotools/tree/main/python/_restclient"
"Bug Tracker" = "https://github.com/NOAA-OWP/hydrotools/issues"
47 changes: 0 additions & 47 deletions python/_restclient/setup.cfg

This file was deleted.

2 changes: 1 addition & 1 deletion python/_restclient/src/hydrotools/_restclient/_version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "3.1.0"
__version__ = "3.1.1"
12 changes: 5 additions & 7 deletions python/_restclient/tests/test_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,13 +82,11 @@ async def test_get_check_cache(basic_test_server):
assert r2.from_cache is True


def test_get_non_async(basic_test_server, loop):
with pytest.warns(DeprecationWarning):
# throws DeprecationWarning b.c. session not create in async func
session = ClientSession()
resp_coro = session.get(basic_test_server["uri"])
resp = loop.run_until_complete(resp_coro)
assert loop.run_until_complete(resp.json()) == basic_test_server["data"]
def test_get_non_async(basic_test_server, event_loop):
session = ClientSession(loop=event_loop)
resp_coro = session.get(basic_test_server["uri"])
resp = event_loop.run_until_complete(resp_coro)
assert event_loop.run_until_complete(resp.json()) == basic_test_server["data"]


@pytest.fixture
Expand Down
40 changes: 35 additions & 5 deletions python/caches/pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,37 @@
[build-system]
requires = [
"setuptools>=42",
"wheel",
"pip"
]
requires = ["setuptools>=70"]
build-backend = "setuptools.build_meta"

[project]
name = "hydrotools.caches"
authors = [{ name = "Jason A. Regina", email = "jason.regina@noaa.gov" }]
description = "Variety of object caching utilities for OWPHydroTools."
readme = "README.md"
requires-python = ">=3.8"
license = { file = "LICENSE" }
classifiers = [
"Development Status :: 5 - Production/Stable",
"Intended Audience :: Education",
"Intended Audience :: Science/Research",
"License :: Free To Use But Restricted",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Topic :: Scientific/Engineering :: Hydrology",
"Operating System :: OS Independent",
]
dependencies = ["numpy<2; python_version<'3.10'", "pandas", "tables"]
dynamic = ["version"]

[tool.setuptools.dynamic]
version = { attr = "hydrotools.caches._version.__version__" }

[project.optional-dependencies]
develop = ["pytest"]

[project.urls]
Homepage = "https://github.com/NOAA-OWP/hydrotools"
Documentation = "https://noaa-owp.github.io/hydrotools/hydrotools.caches.html"
Repository = "https://github.com/NOAA-OWP/hydrotools/tree/main/python/caches"
"Bug Tracker" = "https://github.com/NOAA-OWP/hydrotools/issues"
Loading

0 comments on commit 45a2d18

Please sign in to comment.