diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml deleted file mode 100644 index 13e39b9..0000000 --- a/.github/workflows/lint.yml +++ /dev/null @@ -1,32 +0,0 @@ -# This workflow will install Python dependencies, run tests and lint with a variety of Python versions -# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions - -name: Lint - -on: - push: - branches: [ master ] - pull_request: - branches: [ master ] - -jobs: - build: - - runs-on: ubuntu-latest - strategy: - matrix: - python-version: ["3.12"] - - steps: - - uses: actions/checkout@v4 - - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v5 - with: - python-version: ${{ matrix.python-version }} - - name: Install dependencies - run: | - python -m pip install --upgrade pip - pip install -r requirements-test.txt - - name: Lint - run: | - ruff check pynws diff --git a/.github/workflows/pytest.yml b/.github/workflows/pytest.yml index 60bfd5e..8d9b59a 100644 --- a/.github/workflows/pytest.yml +++ b/.github/workflows/pytest.yml @@ -26,6 +26,7 @@ jobs: - name: Install dependencies run: | python -m pip install --upgrade pip + pip install . pip install -r requirements-test.txt - name: Test with pytest run: | diff --git a/.github/workflows/pythonpublish.yml b/.github/workflows/pythonpublish.yml index c41ab79..48b2af2 100644 --- a/.github/workflows/pythonpublish.yml +++ b/.github/workflows/pythonpublish.yml @@ -25,9 +25,8 @@ jobs: - name: Install dependencies run: | python -m pip install --upgrade pip - pip install setuptools wheel twine - - name: Build - run: | - python setup.py sdist bdist_wheel + pip install build + - name: Build package + run: python -m build - name: Publish package distributions to PyPI uses: pypa/gh-action-pypi-publish@release/v1 diff --git a/.github/workflows/typing.yml b/.github/workflows/typing.yml index 9415da9..27c8308 100644 --- a/.github/workflows/typing.yml +++ b/.github/workflows/typing.yml @@ -25,4 +25,4 @@ jobs: pip install -r requirements-test.txt - name: mypy run: | - mypy pynws + mypy src/pynws diff --git a/.gitignore b/.gitignore index 34e402b..2a1f75a 100644 --- a/.gitignore +++ b/.gitignore @@ -14,4 +14,5 @@ lib64 .out venv .direnv -.envrc \ No newline at end of file +.envrc +**/_version.py diff --git a/.mypy.ini b/.mypy.ini deleted file mode 100644 index 7018e63..0000000 --- a/.mypy.ini +++ /dev/null @@ -1,4 +0,0 @@ -[mypy] - -[mypy-metar.*] -ignore_missing_imports = True diff --git a/pynws/version.py b/pynws/version.py deleted file mode 100644 index ce0fbfa..0000000 --- a/pynws/version.py +++ /dev/null @@ -1,3 +0,0 @@ -"""Version number.""" - -__version__ = "1.6.0" diff --git a/pyproject.toml b/pyproject.toml index 20e0b76..dd36143 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,3 +1,57 @@ +[build-system] +requires = ["setuptools>=45", "setuptools_scm[toml]>=6.2"] +build-backend = "setuptools.build_meta" + +[project] +dynamic = ["version"] +name = "pynws" +requires-python = ">=3.8" +dependencies = [ + "aiohttp", + "metar" +] +description = "Python library to retrieve observations and forecasts from NWS/NOAA" +readme = {file = "README.md", content-type = "text/markdown"} +keywords = ["nws", "weather"] +license = {text = "MIT License"} +classifiers = [ + "License :: OSI Approved :: MIT License", + "Programming Language :: Python :: 3.8", + "Programming Language :: Python :: 3.9", + "Programming Language :: Python :: 3.10", + "Programming Language :: Python :: 3.11", + "Programming Language :: Python :: 3.12", +] +authors = [ + {name = "Matthew Flamm", email = "matthewhflamm0@gmail.com"} +] + +[project.optional-dependencies] +retry = ["tenacity"] + +[project.urls] +"Repository" = "https://github.com/MatthewFlamm/pynws" +"Bug Tracker" = "https://github.com/MatthewFlamm/pynws/issues" + +[tool.setuptools_scm] +write_to = "src/pynws/_version.py" + +[tool.setuptools.packages.find] +where = ["src"] +namespaces = false + +[tool.mypy] +files = ["src"] + +[[tool.mypy.overrides]] +module = "metar" +ignore_missing_imports = true + +[tool.pytest.ini_options] +testpaths = ["tests"] +asyncio_mode = "auto" +log_level = "DEBUG" + [tool.ruff] required-version = ">=0.3.7" target-version = "py38" diff --git a/pytest.ini b/pytest.ini deleted file mode 100644 index 12fcc46..0000000 --- a/pytest.ini +++ /dev/null @@ -1,3 +0,0 @@ -[pytest] -asyncio_mode = auto -log_level = DEBUG diff --git a/requirements.txt b/requirements.txt deleted file mode 100644 index 6e1e348..0000000 --- a/requirements.txt +++ /dev/null @@ -1,3 +0,0 @@ -aiohttp -metar -tenacity diff --git a/setup.cfg b/setup.cfg deleted file mode 100644 index c76db01..0000000 --- a/setup.cfg +++ /dev/null @@ -1,2 +0,0 @@ -[isort] -profile = black diff --git a/setup.py b/setup.py deleted file mode 100644 index 858b5d0..0000000 --- a/setup.py +++ /dev/null @@ -1,36 +0,0 @@ -import os - -from setuptools import find_packages, setup - -exec(open("pynws/version.py").read()) - -with open("README.md", "r") as fh: - long_description = fh.read() - -setup( - name="pynws", - version=__version__, - license="MIT License", - long_description=long_description, - long_description_content_type="text/markdown", - url="https://github.com/MatthewFlamm/pynws", - author="Matthew Flamm", - author_email="matthewflamm0@gmail.com", - description="Python library to retrieve observations and forecasts from NWS/NOAA", - packages=find_packages(exclude=["tests", "tests.*"]), - include_package_data=True, - install_requires=[ - "aiohttp", - "metar", - ], - extras_require={"retry": ["tenacity"]}, - python_requires=">=3.8", - classifiers=[ - "License :: OSI Approved :: MIT License", - "Programming Language :: Python :: 3.8", - "Programming Language :: Python :: 3.9", - "Programming Language :: Python :: 3.10", - "Programming Language :: Python :: 3.11", - "Programming Language :: Python :: 3.12", - ], -) diff --git a/pynws/__init__.py b/src/pynws/__init__.py similarity index 89% rename from pynws/__init__.py rename to src/pynws/__init__.py index ed35971..f8832c3 100644 --- a/pynws/__init__.py +++ b/src/pynws/__init__.py @@ -3,13 +3,11 @@ asynchronously and organizing the data in an easier to use manner """ -from .const import version from .forecast import DetailedForecast from .nws import Nws, NwsError from .simple_nws import SimpleNWS, call_with_retry __all__ = [ - "version", "DetailedForecast", "Nws", "NwsError", diff --git a/pynws/backports/__init__.py b/src/pynws/backports/__init__.py similarity index 100% rename from pynws/backports/__init__.py rename to src/pynws/backports/__init__.py diff --git a/pynws/backports/enum.py b/src/pynws/backports/enum.py similarity index 100% rename from pynws/backports/enum.py rename to src/pynws/backports/enum.py diff --git a/pynws/const.py b/src/pynws/const.py similarity index 98% rename from pynws/const.py rename to src/pynws/const.py index 007aff8..9e93279 100644 --- a/pynws/const.py +++ b/src/pynws/const.py @@ -7,8 +7,6 @@ import sys from typing import Final -from .version import __version__ - if sys.version_info >= (3, 11): from enum import StrEnum else: @@ -16,8 +14,6 @@ file_dir = os.path.join(os.path.dirname(__file__), "..") -version = __version__ - API_URL: Final = "https://api.weather.gov/" API_GRIDPOINTS_STATIONS: Final = "gridpoints/{}/{},{}/stations" API_STATIONS_OBSERVATIONS: Final = "stations/{}/observations/" diff --git a/pynws/forecast.py b/src/pynws/forecast.py similarity index 100% rename from pynws/forecast.py rename to src/pynws/forecast.py diff --git a/pynws/nws.py b/src/pynws/nws.py similarity index 100% rename from pynws/nws.py rename to src/pynws/nws.py diff --git a/pynws/raw_data.py b/src/pynws/raw_data.py similarity index 100% rename from pynws/raw_data.py rename to src/pynws/raw_data.py diff --git a/pynws/simple_nws.py b/src/pynws/simple_nws.py similarity index 100% rename from pynws/simple_nws.py rename to src/pynws/simple_nws.py diff --git a/pynws/units.py b/src/pynws/units.py similarity index 100% rename from pynws/units.py rename to src/pynws/units.py diff --git a/pynws/urls.py b/src/pynws/urls.py similarity index 100% rename from pynws/urls.py rename to src/pynws/urls.py