Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Trusted Publishing #244

Merged
merged 9 commits into from
Mar 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
85 changes: 54 additions & 31 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,11 @@ on:
- master
pull_request:

permissions:
contents: read

jobs:
black:
lint:
name: Black (Python${{ matrix.python-version }})
runs-on: ubuntu-latest
strategy:
Expand All @@ -20,43 +23,63 @@ jobs:
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install black
- name: Install flake8 and black
run: |
python -m pip install flake8 black
- name: Check formatting with flake8 and black ⚙️
run: |
make lint

docs:
name: Build docs 🏗️
runs-on: ubuntu-latest
strategy:
matrix:
python-version:
- "3.9"
steps:
- uses: actions/checkout@v4
- name: Install pandoc
run: |
sudo apt-get -y install pandoc
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install requirements 📦
run: |
pip install black
- name: Check formatting with black ⚙️
python -m pip install --upgrade pip
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
if [ -f requirements_dev.txt ]; then pip install -r requirements_dev.txt; fi
if [ -f requirements_extra.txt ]; then pip install -r requirements_extra.txt; fi
- name: Build docs 🏗️
run: |
black --check --target-version py39 birdy tests
make docs

build:
name: Testing with Python${{ matrix.python-version }}
needs: black
needs:
- lint
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.9", "3.10", "3.11"]
steps:
- uses: actions/checkout@v4
- name: Install packages
run: |
sudo apt-get -y install pandoc
if: matrix.python-version == 3.9
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install requirements 📦
run: |
python -m pip install --upgrade pip
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
if [ -f requirements_dev.txt ]; then pip install -r requirements_dev.txt; fi
if [ -f requirements_extra.txt ]; then pip install -r requirements_extra.txt; fi
- name: Test with pytest ⚙️
run: |
make test
- name: Lint with flake8 ⚙️
run: |
make lint
- name: Build docs 🏗️
if: matrix.python-version == 3.9
run: |
make docs
- name: Harden Runner
uses: step-security/harden-runner@63c24ba6bd7ba022e95695ff85de572c04a18142 # v2.7.0
with:
egress-policy: audit
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install requirements 📦
run: |
python -m pip install --upgrade pip
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
if [ -f requirements_dev.txt ]; then pip install -r requirements_dev.txt; fi
if [ -f requirements_extra.txt ]; then pip install -r requirements_extra.txt; fi
- name: Test with pytest ⚙️
run: |
make test
13 changes: 10 additions & 3 deletions .github/workflows/publish-pypi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,21 @@ on:
types:
- published

permissions:
contents: read

jobs:
build-n-publish-pypi:
name: Build and publish Python 🐍 distributions 📦 to PyPI
runs-on: ubuntu-latest
environment: production
permissions:
id-token: write
steps:
- name: Harden Runner
uses: step-security/harden-runner@63c24ba6bd7ba022e95695ff85de572c04a18142 # v2.7.0
with:
egress-policy: audit
- uses: actions/checkout@v3
- name: Set up Python3
uses: actions/setup-python@v4
Expand All @@ -23,6 +33,3 @@ jobs:
python setup.py sdist bdist_wheel
- name: Publish distribution 📦 to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}
16 changes: 12 additions & 4 deletions .github/workflows/tag-testpypi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,21 @@ on:
tags:
- '*'

permissions:
contents: read

jobs:
build-n-publish-testpypi:
name: Build and publish Python 🐍 distributions 📦 to TestPyPI
runs-on: ubuntu-latest
environment: staging
permissions:
id-token: write
steps:
- name: Harden Runner
uses: step-security/harden-runner@63c24ba6bd7ba022e95695ff85de572c04a18142 # v2.7.0
with:
egress-policy: audit
- uses: actions/checkout@v3
- name: Set up Python3
uses: actions/setup-python@v4
Expand All @@ -24,7 +34,5 @@ jobs:
- name: Publish distribution 📦 to Test PyPI
uses: pypa/gh-action-pypi-publish@release/v1
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
115 changes: 57 additions & 58 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,64 +2,63 @@ default_language_version:
python: python3

repos:
- repo: https://github.com/asottile/pyupgrade
rev: v3.15.0
hooks:
- id: pyupgrade
args: ['--py37-plus']
- 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: debug-statements
- repo: https://github.com/kynan/nbstripout
rev: 0.6.1
hooks:
- id: nbstripout
files: '.ipynb'
- repo: https://github.com/psf/black
rev: 23.12.1
hooks:
- id: black
args: [ '--target-version=py37' ]
- repo: https://github.com/pycqa/flake8
rev: 6.1.0
hooks:
- id: flake8
args: [ '--config=setup.cfg' ]
- repo: https://github.com/PyCQA/isort
rev: 5.13.2
hooks:
- id: isort
args: [ '--profile=black' ]
- repo: https://github.com/nbQA-dev/nbQA
rev: 1.7.1
hooks:
- id: nbqa-black
args: [ '--target-version=py37' ]
additional_dependencies: [ 'black==23.9.1' ]
- id: nbqa-pyupgrade
args: [ '--py37-plus' ]
additional_dependencies: [ 'pyupgrade==v3.14.0' ]
- id: nbqa-isort
args: [ '--profile=black' ]
additional_dependencies: [ 'isort==5.12.0' ]
- repo: https://github.com/pycqa/pydocstyle
rev: 6.3.0
hooks:
- id: pydocstyle
args: [ '--convention=numpy' ]
- repo: https://github.com/asottile/pyupgrade
rev: v3.15.0
hooks:
- id: pyupgrade
- repo: meta
hooks:
- id: check-hooks-apply
- id: check-useless-excludes

- repo: https://github.com/asottile/pyupgrade
rev: v3.15.1
hooks:
- id: pyupgrade
args: ['--py39-plus']
- 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: debug-statements
- repo: https://github.com/kynan/nbstripout
rev: 0.7.1
hooks:
- id: nbstripout
files: '.ipynb'
- repo: https://github.com/pycqa/flake8
rev: 7.0.0
hooks:
- id: flake8
args: [ '--config=setup.cfg' ]
- repo: https://github.com/psf/black
rev: 24.2.0
hooks:
- id: black
args: [ '--target-version=py37' ]
- repo: https://github.com/PyCQA/isort
rev: 5.13.2
hooks:
- id: isort
args: [ '--profile=black' ]
- repo: https://github.com/nbQA-dev/nbQA
rev: 1.8.4
hooks:
- id: nbqa-black
args: [ '--target-version=py37' ]
additional_dependencies: [ 'black==24.2.0' ]
- id: nbqa-pyupgrade
args: [ '--py37-plus' ]
additional_dependencies: [ 'pyupgrade==v3.15.1' ]
- id: nbqa-isort
args: [ '--profile=black' ]
additional_dependencies: [ 'isort==5.13.2' ]
- repo: https://github.com/pycqa/pydocstyle
rev: 6.3.0
hooks:
- id: pydocstyle
args: [ '--convention=numpy' ]
- repo: https://github.com/asottile/pyupgrade
rev: v3.15.1
hooks:
- id: pyupgrade
- repo: meta
hooks:
- id: check-hooks-apply
- id: check-useless-excludes

ci:
autofix_commit_msg: |
Expand Down
8 changes: 5 additions & 3 deletions CHANGES.rst
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
Change History
**************

0.8.5 (2024-03-13)
0.8.5 (2024-03-14)
==================

Changes:

* Update how TIFF files are converted to xarray datasets because `open_rasterio` is deprecated. See issue `239`.
* Remove `GeotiffRasterioConverter`
* Remove Python 3.7 and 3.8 from CI test suite
* Remove `GeotiffRasterioConverter`.
* Remove Python 3.7 and 3.8 from CI test suite.
* Now using Trusted Publisher for TestPyPI/PyPI releases.
* Update `black` to v24.2.0 and code formatting conventions to Python3.9+.

0.8.4 (2023-05-24)
==================
Expand Down
1 change: 1 addition & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ clean-test: ## remove test and coverage artifacts

lint: ## check style with flake8
flake8 birdy tests
black --check --target-version py39 birdy tests

test: ## run tests quickly with the default Python
# py.test
Expand Down
10 changes: 3 additions & 7 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
Birdy
=====

|PyPI| |Docs| |Build| |Codacy| |License| |Gitter|
|PyPI| |Docs| |Build| |License| |Gitter|

Birdy (the bird)
*Birdy is not a bird but likes to play with them.*
Expand Down Expand Up @@ -31,14 +31,10 @@ Full `documentation <http://birdy.readthedocs.org/en/latest/>`_ is on ReadTheDoc
:target: http://birdy.readthedocs.io/en/latest/?badge=latest
:alt: Documentation Status

.. |Build| image:: https://github.com/bird-house/birdy/workflows/build/badge.svg
:target: https://github.com/bird-house/birdy/actions
.. |Build| image:: https://github.com/bird-house/birdy/actions/workflows/main.yml/badge.svg
:target: https://github.com/bird-house/birdy/actions/workflows/main.yml
:alt: Build Status

.. |Codacy| image:: https://api.codacy.com/project/badge/Grade/da14405a9a6d4c2e9c405d9c0c8babe7
:target: https://www.codacy.com/app/cehbrecht/birdy?utm_source=github.com&amp;utm_medium=referral&amp;utm_content=bird-house/birdy&amp;utm_campaign=Badge_Grade
:alt: Codacy Code Checks

.. |License| image:: https://img.shields.io/github/license/bird-house/birdy.svg
:target: https://github.com/bird-house/birdy/blob/master/LICENSE.txt
:alt: GitHub license
Expand Down
3 changes: 2 additions & 1 deletion birdy/client/converters.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
# noqa: D100

import tempfile
from collections.abc import Sequence
from distutils.version import StrictVersion
from importlib import import_module
from pathlib import Path
from typing import Sequence, Union
from typing import Union

from owslib.wps import Output

Expand Down
1 change: 1 addition & 0 deletions environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ dependencies:
- lxml
- owslib>=0.19
- packaging
- pyopenssl
- wrapt
# optional
- netcdf4
Expand Down
Loading