-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #10 from roocs/modernize
Modern Packaging
- Loading branch information
Showing
16 changed files
with
278 additions
and
126 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
name: First Pull Request | ||
|
||
on: | ||
pull_request_target: | ||
types: | ||
- opened | ||
|
||
jobs: | ||
welcome: | ||
name: Welcome | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/github-script@v6 | ||
with: | ||
script: | | ||
// Get a list of all issues created by the PR opener | ||
// See: https://octokit.github.io/rest.js/#pagination | ||
const creator = context.payload.sender.login | ||
const opts = github.rest.issues.listForRepo.endpoint.merge({ | ||
...context.issue, | ||
creator, | ||
state: 'all' | ||
}) | ||
const issues = await github.paginate(opts) | ||
for (const issue of issues) { | ||
if (issue.number === context.issue.number) { | ||
continue | ||
} | ||
if (issue.pull_request) { | ||
return // Creator is already a contributor. | ||
} | ||
} | ||
await github.rest.issues.createComment({ | ||
issue_number: context.issue.number, | ||
owner: context.repo.owner, | ||
repo: context.repo.repo, | ||
body: `**Welcome**, new contributor! | ||
It appears that this is your first Pull Request. To give credit where it's due, we ask that you add your information to the \`AUTHORS.rst\`: | ||
- [ ] The relevant author information has been added to \`AUTHORS.rst\` | ||
Please make sure you've read our [contributing guide](CONTRIBUTING.rst). We look forward to reviewing your Pull Request shortly ✨` | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
name: roocs-grids Testing Suite | ||
|
||
on: | ||
push: | ||
branches: | ||
- master | ||
pull_request: | ||
|
||
jobs: | ||
black: | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
tox-env: | ||
- black | ||
steps: | ||
- name: Cancel previous runs | ||
uses: styfle/[email protected] | ||
with: | ||
access_token: ${{ github.token }} | ||
- uses: actions/checkout@v3 | ||
- uses: actions/setup-python@v4 | ||
with: | ||
python-version: "3.8" | ||
- name: Install linters | ||
run: | | ||
pip install black ruff | ||
- name: Run linting suite | ||
run: | | ||
black --check roocs_grids | ||
ruff roocs_grids | ||
test: | ||
name: Pip with Python${{ matrix.python-version }} | ||
needs: black | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
python-version: ["3.8", "3.9", "3.10", "3.11"] | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Set up Python${{ matrix.python-version }} | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
- name: Install roocs-grids | ||
run: | | ||
pip install -e ".[dev]" | ||
- name: Run tests | ||
run: | | ||
pytest |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
======= | ||
Credits | ||
======= | ||
|
||
Development Leads | ||
----------------- | ||
|
||
* Ag Stephens <[email protected]> `@agstephens <https://github.com/agstephens>`_ | ||
* Martin Schupfner <[email protected]> `@sol1105 <https://github.com/sol1105>`_ | ||
|
||
Contributors | ||
------------- | ||
|
||
* Carsten Ehbrecht <[email protected]> `@cehbrecht <https://github.com/cehbrecht>`_ | ||
* Trevor James Smith <[email protected]> `@Zeitsperre <https://github.com/Zeitsperre>`_ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,93 @@ | ||
[build-system] | ||
build-backend = "flit_core.buildapi" | ||
requires = ["flit_core >=3.8,<4"] | ||
|
||
[project] | ||
name = "roocs_grids" | ||
keywords = ["roocs_grids", "regrid", "grid", "interpolate", "cmip"] | ||
authors = [ | ||
{name = "Ag Stephens", email = "[email protected]"}, | ||
{name = "Martin Schupfner", email = "[email protected]"} | ||
] | ||
maintainers = [ | ||
{name = "Carsten Ehbrecht", email = "[email protected]"}, | ||
{name = "Trevor James Smith", email = "[email protected]"} | ||
] | ||
license = {file = "LICENSE"} | ||
python_requires = ">=3.8.0" | ||
dynamic = ["description", "version"] | ||
dependencies = [] | ||
classifiers = [ | ||
"Development Status :: 5 - Production/Stable", | ||
"Intended Audience :: Developers", | ||
"Intended Audience :: Science/Research", | ||
"License :: OSI Approved :: BSD License", | ||
"Natural Language :: English", | ||
"Operating System :: OS Independent", | ||
"Programming Language :: Python", | ||
"Programming Language :: Python :: 3", | ||
"Programming Language :: Python :: 3.8", | ||
"Programming Language :: Python :: 3.9", | ||
"Programming Language :: Python :: 3.10", | ||
"Programming Language :: Python :: 3.11", | ||
"Topic :: Scientific/Engineering :: Atmospheric Science", | ||
"Topic :: Scientific/Engineering :: GIS", | ||
"Topic :: Software Development :: Libraries :: Python Modules" | ||
] | ||
|
||
[project.optional-dependencies] | ||
dev = [ | ||
"black", | ||
"bump2version", | ||
"clisops", | ||
"isort", | ||
"pytest>=7.0.0", | ||
"ruff>=0.1.0", | ||
"xarray" | ||
] | ||
|
||
[project.urls] | ||
"Source" = "https://github.com/roocs/roocs-grids/" | ||
"Changelog" = "https://github.com/roocs/roocs-grids/blob/main/HISTORY.rst" | ||
"Issue tracker" = "https://github.com/roocs/roocs-grids/issues" | ||
"About ROOCS" = "https://roocs.github.io/" | ||
|
||
[tool.black] | ||
target-version = [ | ||
"py38", | ||
"py39", | ||
"py310", | ||
"py311" | ||
] | ||
|
||
[tool.flit.sdist] | ||
include = [ | ||
"AUTHORS.rst", | ||
"HISTORY.rst", | ||
"LICENSE", | ||
"README.rst", | ||
"tests/*.py" | ||
] | ||
exclude = [ | ||
"**/*.py[co]", | ||
"**/__pycache__", | ||
".*", | ||
"scripts/*" | ||
] | ||
|
||
[tool.isort] | ||
profile = "black" | ||
py_version = 38 | ||
|
||
[tool.ruff] | ||
src = ["roocs_grids"] | ||
line-length = 88 | ||
target-version = "py38" | ||
ignore = ["E501"] | ||
|
||
[tool.ruff.format] | ||
line-ending = "auto" | ||
|
||
[tool.ruff.isort] | ||
known-first-party = ["roocs_grids"] | ||
lines-after-imports = 1 |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,12 @@ | ||
import os | ||
"""Grid definitions for the roocs regridder.""" | ||
import pathlib | ||
|
||
pkg_dir = os.path.dirname(__file__) | ||
__author__ = "Martin Schupfner" | ||
__email__ = "[email protected]" | ||
__copyright__ = "Copyright 2018 United Kingdom Research and Innovation" | ||
__version__ = "0.1.2" | ||
|
||
pkg_dir = pathlib.Path(__file__).parent.absolute() | ||
|
||
grid_dict = { | ||
"0pt25deg": "cmip6_720x1440_scrip.20181001.nc", | ||
|
@@ -76,11 +82,11 @@ | |
" 384x768 nlatxnlon. Associated to a T255 spectral grid representation.", | ||
} | ||
|
||
grids_dir = os.path.join(pkg_dir, "grids") | ||
grids_dir = pathlib.Path(pkg_dir).joinpath("grids") | ||
|
||
|
||
def get_grid_file(grid_id): | ||
def get_grid_file(grid_id: str) -> pathlib.Path: | ||
if grid_id not in grid_dict: | ||
raise Exception(f"Unknown grid id: {grid_id}") | ||
raise FileNotFoundError(f"Unknown grid id: {grid_id}") | ||
|
||
return os.path.join(grids_dir, grid_dict[grid_id]) | ||
return pathlib.Path(grids_dir).joinpath(grid_dict[grid_id]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
[bumpversion] | ||
current_version = 0.1.2 | ||
commit = True | ||
tag = False | ||
parse = (?P<major>\d+)\.(?P<minor>\d+).(?P<patch>\d+) | ||
serialize = | ||
{major}.{minor}.{patch} | ||
|
||
[bumpversion:file:roocs_grids/__init__.py] | ||
search = __version__ = "{current_version}" | ||
replace = __version__ = "{new_version}" |
Oops, something went wrong.