Skip to content

Commit

Permalink
Merge pull request #54 from MeteoSwiss/develop
Browse files Browse the repository at this point in the history
v0.2.0.dev0
  • Loading branch information
fpavogt authored Jan 21, 2022
2 parents e306bf3 + f08b80f commit 0719191
Show file tree
Hide file tree
Showing 67 changed files with 958 additions and 423 deletions.
3 changes: 2 additions & 1 deletion .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ Please tag them using `#`, e.g. `Fixed #42`.
- [ ] New code includes dedicated tests.
- [ ] New code has been linted.
- [ ] New code follows the project's style.
- [ ] New code is compatible with a 3-Clause BSD license.
- [ ] New code is compatible with the 3-Clause BSD license.
- [ ] CHANGELOG has been updated.
- [ ] AUTHORS has been updated.
- [ ] Copyright years in module docstrings have been updated.
2 changes: 1 addition & 1 deletion .github/workflows/CI_changelog.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ name: CI_changelog

on:
pull_request:
branches: [ master, develop ]
branches: [ master, develop, develop_vof ]

jobs:
changelog:
Expand Down
55 changes: 55 additions & 0 deletions .github/workflows/CI_check_version.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
# This workflow will check that the code version was increased.
#
# It is triggered for any PR to the master branch.
#
# Warning: the code version must *absolutely* follow a semantic approach, i.e.:
# 10.0.1, 10.0.2.dev0 is valid
# 10.0, 10, is NOT valid !
#
# Copyright (c) 2022 fpavogt; [email protected]

name: CI_check_version

on:
pull_request:
branches: [ master ]

jobs:
version:

runs-on: ubuntu-latest
steps:

- name: Checkout current repository
uses: actions/checkout@v2

- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.10'

- name: Install dependancies
run: |
python -m pip install --upgrade pip
pip install setuptools
shell: bash

- name: wget/cp the BASE and HEAD version files
# Here, I could get both the BASE and HEAD files with wget, but cp-ing the HEAD is safer,
# since we have cloned the repo anyway.
run: |
export VERSION_LOC=src/ampycloud/version.py
echo $GITHUB_HEAD_REF
echo $GITHUB_BASE_REF
wget -O base_version.tmp https://raw.githubusercontent.com/$GITHUB_REPOSITORY/$GITHUB_BASE_REF/$VERSION_LOC
cp ./$VERSION_LOC head_version.tmp
shell: bash

- name: Check if the version was increased
run: |
HEAD_VERSION="$(grep VERSION head_version.tmp | grep -o '[[:alnum:]]*\.[[:alnum:]]*\.[[:alnum:]]*\.\?[[:alnum:]]*')"
echo "HEAD_VERSION:" $HEAD_VERSION
BASE_VERSION="$(grep VERSION base_version.tmp | grep -o '[[:alnum:]]*\.[[:alnum:]]*\.[[:alnum:]]*\.\?[[:alnum:]]*')"
echo "BASE_VERSION:" $BASE_VERSION
python ./.github/workflows/check_version.py $HEAD_VERSION $BASE_VERSION
shell: bash
2 changes: 1 addition & 1 deletion .github/workflows/CI_docs_build_and_check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ on:
push:
branches: [ master ]
pull_request:
branches: [ master, develop ]
branches: [ master, develop, develop_vof ]

jobs:
docs:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/CI_pylinter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ on:
#push:
# branches: [ master ]
pull_request:
branches: [ master, develop ]
branches: [ master, develop, develop_vof ]

jobs:
pylinter:
Expand Down
57 changes: 57 additions & 0 deletions .github/workflows/CI_pypi.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
# This workflow will push the code onto pypi.
# It assumes that TESTPYPI_API_TOKEN and PYPI_API_TOKEN secrets from GITHUB have been defined
# at the repo or organization levels to upload the package via API authentification.
#
# It will trigger the moment a new release or pre-release is being published.
#
# Copyright (c) 2022 fpavogt; [email protected]

name: CI_pypi

on:
release:
types: [published]

jobs:
pypi:

runs-on: ubuntu-latest
steps:

- name: Checkout current repository
uses: actions/checkout@v2

- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.10'

- name: Install dependancies
run: |
python -m pip install --upgrade pip
pip install setuptools
pip install wheel
pip install twine
shell: bash

- name: Build the wheels
run: |
python setup.py sdist bdist_wheel
shell: bash

- name: Deploy to testpypi
# Let's make use of Github secrets to avoid spelling out secret stuff
env:
TESTPYPI_TOKEN: ${{ secrets.TESTPYPI_API_TOKEN }}
# We first go to testpypi to make sure nothing blows up.
run: |
twine upload -r testpypi dist/* --verbose --skip-existing -u __token__ -p "$TESTPYPI_TOKEN"
shell: bash

- name: Deploy to pypi
# Let's make use of Github secrets to avoid spelling out secret stuff
env:
PYPI_TOKEN: ${{ secrets.PYPI_API_TOKEN }}
run: |
twine upload dist/* --verbose --skip-existing -u __token__ -p "$PYPI_TOKEN"
shell: bash
2 changes: 1 addition & 1 deletion .github/workflows/CI_pytest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ on:
#push:
# branches: [ master ]
pull_request:
branches: [ master, develop ]
branches: [ master, develop, develop_vof ]

jobs:
pytest:
Expand Down
49 changes: 49 additions & 0 deletions .github/workflows/check_version.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
# -*- coding: utf-8 -*-
'''
Copyright (c) 2022 MeteoSwiss, contributors listed in AUTHORS.
Distributed under the terms of the 3-Clause BSD License.
SPDX-License-Identifier: BSD-3-Clause
This script can be used together with a Github Action to check whether a code version has been
properly incremented.
Created January 2022; F.P.A. Vogt; [email protected]
'''

import argparse
from pkg_resources import parse_version

def main():
''' The main function. '''

# Use argparse to allow feeding parameters to this script
parser = argparse.ArgumentParser(description='''Compare the versions between the head and base
branches of the PR. Fails is Head <= Base.''',
epilog='Feedback, questions, comments: \
[email protected] \n',
formatter_class=argparse.RawTextHelpFormatter)

parser.add_argument('head', action='store', metavar='version',
help='Head version.')

parser.add_argument('base', action='store', metavar='version',
help='Base version.')

# What did the user type in ?
args = parser.parse_args()

# Print the versions fed by the user, for monitoring
print("Head:", args.head)
print("Base:", args.base)

if parse_version(args.head) > parse_version(args.base):
print("Version was increased. Well done.")
return True

raise Exception('Ouch ! Version was not increased ?!')

if __name__ == '__main__':

main()
4 changes: 2 additions & 2 deletions .github/workflows/docs_check.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
'''
Copyright (c) 2020-2021 MeteoSwiss, contributors listed in AUTHORS.
Distributed under the terms of the GNU General Public License v3.0 or later.
Distributed under the terms of the 3-Clause BSD License.
SPDX-License-Identifier: GPL-3.0-or-later
SPDX-License-Identifier: BSD-3-Clause
This script can be used together with a Github Action to build the docs, and check for errors and
warnings. This script assumes that it is being executed from within the "docs" folder.
Expand Down
7 changes: 4 additions & 3 deletions .github/workflows/pylinter.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,18 @@
'''
Copyright (c) 2020-2021 MeteoSwiss, created by F.P.A. Vogt; [email protected]
Distributed under the terms of the GNU General Public License v3.0 or later.
Distributed under the terms of the 3-Clause BSD License.
SPDX-License-Identifier: GPL-3.0-or-later
SPDX-License-Identifier: BSD-3-Clause
This script can be used together with a Github Action to run pylint on all the .py files in a
repository. Command line arguments can be used to search for a specific subset of errors (if any are
found, this script will raise an Exception), or to ignore some errors in a generic search (which
will print all the errors found, but will not raise any Exception). If a score is specified, the
script will raise an Exception if it is not met.
Created May 2020; F.P.A. Vogt; [email protected]
Created May 2020; fpavogt; [email protected]
Adapted Jan 2022; fpavogt; [email protected]
'''

import argparse
Expand Down
2 changes: 1 addition & 1 deletion .pylintrc
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@
[BASIC]

# Good variable names which should always be accepted, separated by a comma.
good-names=a, ax, b, c, fn, i, j, k, _, w, x, y, z
good-names=a, ax, b, c, dt, fn, i, j, k, _, w, x, y, z
19 changes: 18 additions & 1 deletion CHANGELOG
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,31 @@ The format is inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0
This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).


## [Unreleased]
## [v0.3.0]
### Added:
### Fixed:
### Changed:
### Deprecated:
### Removed:
### Security:

## [v0.2.0.dev]
### Added:
- [fpavogt, 2022-01-21] New CI Actions to automate the pypi releases.
- [fpavogt, 2022-01-17] Added new utils.utils.temp_seed() function to set random seed temporarily only.
- [fpavogt, 2022-01-13] New icao module, for easy/clean access to the significant_cloud() function.
- [fpavogt, 2022-01-13] Doc cleanup/improvement, and use of :py:func: (etc...) function to ease user navigation.
### Fixed:
- [fpavogt, 2022-01-17] Fix #49 - mock cloud layers now have proper type values.
- [fpavogt, 2022-01-10] Fix issues #40 and #41.
### Changed:
- [fpavogt, 2022-01-14] Fix #47.
- [fpavogt, 2022-01-10] Update copyright years.
### Deprecated:
### Removed:
- [fpavogt, 2022-01-14] ampycloud.core.synop(), and all synop references.
### Security:

## [v0.1.0]
### Added:
- [fpavogt, 2021-12-21] Add tests to check real data for scientific stability (fixes #33).
Expand Down
Loading

0 comments on commit 0719191

Please sign in to comment.