Skip to content

Commit

Permalink
feat: modernize
Browse files Browse the repository at this point in the history
  • Loading branch information
gadomski committed Dec 22, 2023
1 parent db9e892 commit 53da4ed
Show file tree
Hide file tree
Showing 8 changed files with 67 additions and 95 deletions.
23 changes: 7 additions & 16 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,28 +7,19 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.7, 3.8, 3.9]
python-version: ["3.9", "3.10", "3.11"]

steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Get pip cache dir
id: pip-cache
run: echo "::set-output name=dir::$(pip cache dir)"
- name: pip cache
uses: actions/cache@v2
with:
path: ${{ steps.pip-cache.outputs.dir }}
key: ${{ runner.os }}-pip-${{ hashFiles('setup.cfg', 'requirements-dev.txt') }}
restore-keys: ${{ runner.os }}-pip-
cache: pip
- name: Install package and dependencies
run: |
python -m pip install --upgrade pip
pip install .
pip install -r requirements-dev.txt
pip install '.[dev,examples]'
- name: Lint
run: pre-commit run --all-files
- name: Test
Expand All @@ -45,7 +36,7 @@ jobs:
with:
fetch-depth: 0
- name: Set up Python 3.9
uses: actions/setup-python@v1
uses: actions/setup-python@v5
with:
python-version: 3.9
- name: Install pypa/build
Expand All @@ -58,8 +49,8 @@ jobs:
with:
user: __token__
password: ${{ secrets.TEST_PYPI_API_TOKEN }}
repository_url: https://test.pypi.org/legacy/
skip_existing: true
repository-url: https://test.pypi.org/legacy/
skip-existing: true
- name: Publish to PyPI
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
uses: pypa/gh-action-pypi-publish@release/v1
Expand Down
33 changes: 17 additions & 16 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,17 +1,18 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.0.1
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-yaml
- id: check-added-large-files
args: ['--maxkb=1000']
- repo: https://github.com/Zac-HD/shed
rev: 0.5.3
hooks:
- id: shed
- repo: https://github.com/pre-commit/mirrors-mypy
rev: v0.910-1
hooks:
- id: mypy
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.5.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-yaml
- id: check-added-large-files
args: ["--maxkb=1000"]
- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.8.0
hooks:
- id: mypy
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.1.9
hooks:
- id: ruff
- id: ruff-format
8 changes: 7 additions & 1 deletion .readthedocs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,14 @@ version: 2
sphinx:
configuration: docs/conf.py

build:
os: ubuntu-22.04
tools:
python: "3.12"

python:
install:
- method: pip
path: .
- requirements: requirements-dev.txt
extra_requirements:
- docs
24 changes: 10 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
# pyisd

Reads NOAA [Integrated Surface Database (ISD)](https://www.ncei.noaa.gov/products/land-based-station/integrated-surface-database) data.

[![CI](https://github.com/gadomski/pyisd/actions/workflows/ci.yaml/badge.svg)](https://github.com/gadomski/pyisd/actions/workflows/ci.yaml)
![PyPI](https://img.shields.io/pypi/v/isd)
[![Documentation Status](https://readthedocs.org/projects/isd/badge/?version=latest)](https://isd.readthedocs.io/en/latest/?badge=latest)

Reads NOAA [Integrated Surface Database (ISD)](https://www.ncei.noaa.gov/products/land-based-station/integrated-surface-database) data.

## Installation

```shell
$ pip install isd
pip install isd
```

## Usage
Expand All @@ -18,7 +18,7 @@ There is a simple command line interface.
The `isd record` command prints a single record in JSON format:

```shell
$ isd record 720538-00164-2021
isd record 720538-00164-2021
```

The Python API allows reading compressed and uncompressed ISD files:
Expand All @@ -32,32 +32,28 @@ with isd.io.open("isd-file") as records_iterator:

There is currently no parsing of the `additional_data` section, but all mandatory fields are parsed out into appropriately-typed fields on a `Record`.


## Development

Install the development requirements and the package in editable mode:

```shell
$ pip install -e .
$ pip install -r requirements-dev.txt
pip install -e '.[dev]'
```

To run the unit tests:

```shell
$ pytest
pytest
```

## Release

To cut a new release of **pyisd** (assuming you have the appropriate permissions):

1. Create a new branch, e.g. `release/v0.1.4`.
2. Update the [CHANGELOG](CHANGELOG.md).
2. Update the [CHANGELOG](CHANGELOG.md) and [pyproject.toml](./pyproject.toml).
3. Open a pull request with the changes.
4. Merge the pull request once all required checks pass.
5. Create an annotated tag.
- The tag **must** be named the same as the semver, e.g. `git tag -a v0.1.4`.
We use [setuptools-scm](https://github.com/pypa/setuptools_scm) to manage the package version so the tag name is very important.
- The tag's contents should probably be the same information that was in the CHANGELOG for this version.
6. Push the annotated tag to github. This will trigger a new pypi release.
5. Create an annotated tag, e.g. `git tag -a v0.1.4`.
6. Push the annotated tag to github.
This will trigger a new pypi release.
2 changes: 0 additions & 2 deletions mypy.ini

This file was deleted.

34 changes: 26 additions & 8 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,11 +1,29 @@
[build-system]
requires = [
"setuptools>=45",
"wheel",
"setuptools_scm>=6.2"
[project]
name = "isd"
version = "0.2.0"
description = "Reads and archives NOAA Integrated Surface Database (ISD) files"
readme = "README.md"
authors = [{ name = "Pete Gadomski", email = "[email protected]" }]
license = { text = "Apache-2.0" }
classifiers = [
"Programming Language :: Python :: 3",
"License :: OSI Approved :: Apache Software License",
"Operating System :: OS Independent",
]
requires-python = ">=3.9"
dependencies = ["click~=8.0", "pandas~=1.3"]

[project.scripts]
isd = "isd.cli:main"

[project.optional-dependencies]
dev = ["mypy~=1.2", "pre-commit~=3.2", "pytest~=7.4", "ruff~=0.1.9"]
examples = ["tqdm~=4.66"]
docs = ["sphinx~=7.2"]

[build-system]
requires = ["setuptools>=45", "wheel"]
build-backend = "setuptools.build_meta"

[tool.setuptools_scm]
write_to = "src/isd/_version.py"
local_scheme = "no-local-version"
[tool.mypy]
strict = true
7 changes: 0 additions & 7 deletions requirements-dev.txt

This file was deleted.

31 changes: 0 additions & 31 deletions setup.cfg

This file was deleted.

0 comments on commit 53da4ed

Please sign in to comment.