Skip to content

Commit

Permalink
Use pyproject.toml and setuptools_scm (#183)
Browse files Browse the repository at this point in the history
* use pyproject.toml and setuptools_scm

* end on newline for .gitignore

* need to install pynws for tests now

* need editable install

* fix test paths

* remove unused pytest option
  • Loading branch information
MatthewFlamm authored Apr 29, 2024
1 parent 1f3b514 commit ea0ee5e
Show file tree
Hide file tree
Showing 22 changed files with 61 additions and 95 deletions.
32 changes: 0 additions & 32 deletions .github/workflows/lint.yml

This file was deleted.

1 change: 1 addition & 0 deletions .github/workflows/pytest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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: |
Expand Down
7 changes: 3 additions & 4 deletions .github/workflows/pythonpublish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 1 addition & 1 deletion .github/workflows/typing.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,4 @@ jobs:
pip install -r requirements-test.txt
- name: mypy
run: |
mypy pynws
mypy src/pynws
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,5 @@ lib64
.out
venv
.direnv
.envrc
.envrc
**/_version.py
4 changes: 0 additions & 4 deletions .mypy.ini

This file was deleted.

3 changes: 0 additions & 3 deletions pynws/version.py

This file was deleted.

54 changes: 54 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -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 = "[email protected]"}
]

[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"
Expand Down
3 changes: 0 additions & 3 deletions pytest.ini

This file was deleted.

3 changes: 0 additions & 3 deletions requirements.txt

This file was deleted.

2 changes: 0 additions & 2 deletions setup.cfg

This file was deleted.

36 changes: 0 additions & 36 deletions setup.py

This file was deleted.

2 changes: 0 additions & 2 deletions pynws/__init__.py → src/pynws/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
File renamed without changes.
File renamed without changes.
4 changes: 0 additions & 4 deletions pynws/const.py → src/pynws/const.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,13 @@
import sys
from typing import Final

from .version import __version__

if sys.version_info >= (3, 11):
from enum import StrEnum
else:
from .backports.enum import StrEnum

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/"
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 comments on commit ea0ee5e

Please sign in to comment.