Skip to content

Commit 8529e73

Browse files
bluerror2710Copilot
andcommitted
Improve package quality and user-readiness
- Fix .github/wokflows/ typo -> .github/workflows/ - Fix publish.yml YAML indentation (was unparseable) - Add CI test workflow across Python 3.8-3.12 - Remove redundant setup.py (pyproject.toml is the standard) - Add tqdm to pyproject.toml dependencies (was missing) - Add Python version classifiers and dev dependencies - Add setuptools package discovery config - Fix hardcoded end date default to use today's date dynamically - Fix LICENSE copyright holder (was Pangeo Data -> Shahab Shojaee) - Fix README clone URL (was NWIS_Data_Downloader -> NWIS-Data-Downloader) - Add test suite with 20 unit tests (mocked, no network) - Add CHANGELOG.md - Add py.typed marker for type checker support Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent 69db080 commit 8529e73

13 files changed

Lines changed: 367 additions & 89 deletions

File tree

.github/wokflows/publish.yml

Lines changed: 0 additions & 39 deletions
This file was deleted.

.github/workflows/publish.yml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
name: Publish to PyPI
2+
3+
on:
4+
release:
5+
types: [published]
6+
7+
jobs:
8+
publish:
9+
runs-on: ubuntu-latest
10+
11+
steps:
12+
- name: Checkout repository
13+
uses: actions/checkout@v4
14+
15+
- name: Set up Python
16+
uses: actions/setup-python@v5
17+
with:
18+
python-version: "3.11"
19+
20+
- name: Install build tools
21+
run: |
22+
python -m pip install --upgrade pip
23+
pip install build twine
24+
25+
- name: Build package
26+
run: python -m build
27+
28+
- name: Publish to PyPI
29+
env:
30+
TWINE_USERNAME: __token__
31+
TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }}
32+
run: twine upload dist/*

.github/workflows/tests.yml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
name: Tests
2+
3+
on:
4+
push:
5+
branches: [master, main]
6+
pull_request:
7+
branches: [master, main]
8+
9+
jobs:
10+
test:
11+
runs-on: ubuntu-latest
12+
strategy:
13+
matrix:
14+
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
15+
16+
steps:
17+
- name: Checkout repository
18+
uses: actions/checkout@v4
19+
20+
- name: Set up Python ${{ matrix.python-version }}
21+
uses: actions/setup-python@v5
22+
with:
23+
python-version: ${{ matrix.python-version }}
24+
25+
- name: Install dependencies
26+
run: |
27+
python -m pip install --upgrade pip
28+
pip install -e ".[dev]"
29+
30+
- name: Run tests
31+
run: pytest tests/ -v --tb=short

CHANGELOG.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# Changelog
2+
3+
All notable changes to this project will be documented in this file.
4+
5+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
6+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7+
8+
## [0.1.0] - 2024-12-12
9+
10+
### Added
11+
- Initial release
12+
- `fetch_usgs_daily` — Fetch raw NWIS daily JSON data with retry and rate-limit handling
13+
- `usgs_json_to_df` — Convert USGS JSON responses into tidy Pandas DataFrames
14+
- `fetch_batch_usgs_data` — Multi-site batch fetch with progress bars and filtering
15+
- `get_usgs_parameters` — Dynamic USGS parameter code discovery
16+
- `search_parameters` — Keyword search across parameter catalogs
17+
- PyPI publishing workflow
18+
- Example usage script

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
MIT License
22

3-
Copyright (c) 2020 Pangeo Data
3+
Copyright (c) 2024 Shahab Shojaee
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,8 @@ pip install nwis-data-downloader
2727
Or install from source:
2828

2929
```bash
30-
git clone https://github.com/bluerrror/NWIS_Data_Downloader.git
31-
cd NWIS_Data_Downloader
30+
git clone https://github.com/Bluerrror/NWIS-Data-Downloader.git
31+
cd NWIS-Data-Downloader
3232
pip install -e .
3333
```
3434

pyproject.toml

Lines changed: 25 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2,36 +2,48 @@
22
requires = ["setuptools>=61.0", "wheel"]
33
build-backend = "setuptools.build_meta"
44

5-
65
[project]
76
name = "nwis-data-downloader"
87
version = "0.1.0"
9-
description = "A Python package for downloading USGS NWIS hydrological data"
8+
description = "A lightweight Python toolkit for downloading, processing, and filtering USGS NWIS daily water data"
109
readme = "README.md"
1110
requires-python = ">=3.8"
1211
license = { text = "MIT" }
1312
authors = [
14-
{ name = "Shahab Shojaee" }
13+
{ name = "Shahab Shojaee" }
1514
]
1615

17-
18-
keywords = ["hydrology", "USGS", "NWIS", "water", "data"]
19-
16+
keywords = ["hydrology", "USGS", "NWIS", "water", "data", "streamflow", "sediment"]
2017

2118
classifiers = [
22-
"Programming Language :: Python :: 3",
23-
"License :: OSI Approved :: MIT License",
24-
"Operating System :: OS Independent"
19+
"Programming Language :: Python :: 3",
20+
"Programming Language :: Python :: 3.8",
21+
"Programming Language :: Python :: 3.9",
22+
"Programming Language :: Python :: 3.10",
23+
"Programming Language :: Python :: 3.11",
24+
"Programming Language :: Python :: 3.12",
25+
"License :: OSI Approved :: MIT License",
26+
"Operating System :: OS Independent",
27+
"Intended Audience :: Science/Research",
28+
"Topic :: Scientific/Engineering :: Hydrology",
2529
]
2630

27-
2831
dependencies = [
29-
"requests",
30-
"pandas"
32+
"requests>=2.25.0",
33+
"pandas>=1.3.0",
34+
"tqdm>=4.62.0",
3135
]
3236

37+
[project.optional-dependencies]
38+
dev = [
39+
"pytest>=7.0",
40+
"pytest-cov",
41+
]
3342

3443
[project.urls]
3544
Homepage = "https://github.com/Bluerrror/NWIS-Data-Downloader"
3645
Repository = "https://github.com/Bluerrror/NWIS-Data-Downloader"
37-
Issues = "https://github.com/Bluerrror/NWIS-Data-Downloader/issues"
46+
Issues = "https://github.com/Bluerrror/NWIS-Data-Downloader/issues"
47+
48+
[tool.setuptools.packages.find]
49+
include = ["usgs_data_fetcher*"]

setup.py

Lines changed: 0 additions & 30 deletions
This file was deleted.

tests/__init__.py

Whitespace-only changes.

0 commit comments

Comments
 (0)