-
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.
- Loading branch information
Showing
8 changed files
with
206 additions
and
1 deletion.
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,89 @@ | ||
# This workflow will upload a Python Package using Twine when a release is created | ||
# For more information see: https://help.github.com/en/actions/language-and-framework-guides/using-python-with-github-actions#publishing-to-package-registries | ||
|
||
name: Upload Python Package | ||
|
||
on: | ||
|
||
push: {} | ||
|
||
release: | ||
types: [created] | ||
|
||
jobs: | ||
quality: | ||
name: Code QA | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- run: pip install black flake8 isort | ||
- run: black --version | ||
- run: isort --version | ||
- run: flake8 --version | ||
- run: isort --check . | ||
- run: black --check . | ||
- run: flake8 . | ||
|
||
checks: | ||
if: ${{ github.event_name == 'release' }} | ||
|
||
strategy: | ||
fail-fast: false | ||
matrix: | ||
platform: ["ubuntu-latest", "macos-latest"] | ||
python-version: ["3.10"] | ||
|
||
name: Python ${{ matrix.python-version }} on ${{ matrix.platform }} | ||
runs-on: ${{ matrix.platform }} | ||
needs: quality | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
|
||
- uses: actions/setup-python@v2 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
|
||
- name: Install | ||
run: | | ||
pip install pytest | ||
pip install -e . | ||
pip install -r tests/requirements.txt | ||
pip freeze | ||
- name: Tests | ||
run: pytest | ||
|
||
deploy: | ||
|
||
if: ${{ github.event_name == 'release' }} | ||
runs-on: ubuntu-latest | ||
needs: checks | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
|
||
- name: Set up Python | ||
uses: actions/setup-python@v2 | ||
with: | ||
python-version: '3.x' | ||
|
||
- name: Check that tag version matches code version | ||
run: | | ||
tag=${GITHUB_REF#refs/tags/} | ||
version=$(python setup.py --version) | ||
echo 'tag='$tag | ||
echo "version file="$version | ||
test "$tag" == "$version" | ||
- name: Install dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install setuptools wheel twine | ||
- name: Build and publish | ||
env: | ||
TWINE_USERNAME: __token__ | ||
TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }} | ||
run: | | ||
python setup.py sdist | ||
twine upload dist/* |
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 |
---|---|---|
@@ -1 +1,3 @@ | ||
# ecml-tools | ||
# ecml-tools | ||
|
||
A package to hold various functions to support training of ML models on ECMWF data. |
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,8 @@ | ||
# (C) Copyright 2023 European Centre for Medium-Range Weather Forecasts. | ||
# This software is licensed under the terms of the Apache Licence Version 2.0 | ||
# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. | ||
# In applying this licence, ECMWF does not waive the privileges and immunities | ||
# granted to it by virtue of its status as an intergovernmental organisation | ||
# nor does it submit to any jurisdiction. | ||
|
||
__version__ = "0.0.1" |
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,66 @@ | ||
#!/usr/bin/env python | ||
# (C) Copyright 2023 ECMWF. | ||
# | ||
# This software is licensed under the terms of the Apache Licence Version 2.0 | ||
# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. | ||
# In applying this licence, ECMWF does not waive the privileges and immunities | ||
# granted to it by virtue of its status as an intergovernmental organisation | ||
# nor does it submit to any jurisdiction. | ||
# | ||
|
||
|
||
import io | ||
import os | ||
|
||
import setuptools | ||
|
||
|
||
def read(fname): | ||
file_path = os.path.join(os.path.dirname(__file__), fname) | ||
return io.open(file_path, encoding="utf-8").read() | ||
|
||
|
||
version = None | ||
for line in read("ecml_tools/__init__.py").split("\n"): | ||
if line.startswith("__version__"): | ||
version = line.split("=")[-1].strip()[1:-1] | ||
|
||
|
||
assert version | ||
|
||
|
||
setuptools.setup( | ||
name="ecml-tools", | ||
version=version, | ||
description="A package to hold various functions to support training of ML models on ECMWF data.", | ||
long_description=read("README.md"), | ||
long_description_content_type="text/markdown", | ||
author="European Centre for Medium-Range Weather Forecasts (ECMWF)", | ||
author_email="software.support@ecmwf.int", | ||
license="Apache License Version 2.0", | ||
url="https://github.com/ecmwf-lab/ecml-tools", | ||
packages=setuptools.find_packages(), | ||
include_package_data=True, | ||
install_requires=[ | ||
"zarr", | ||
], | ||
extras_require={ | ||
|
||
}, | ||
zip_safe=True, | ||
keywords="tool", | ||
entry_points={ | ||
}, | ||
classifiers=[ | ||
"Development Status :: 3 - Alpha", | ||
"Intended Audience :: Developers", | ||
"License :: OSI Approved :: Apache Software License", | ||
"Programming Language :: Python :: 3", | ||
"Programming Language :: Python :: 3.9", | ||
"Programming Language :: Python :: 3.10", | ||
"Programming Language :: Python :: 3.11", | ||
"Programming Language :: Python :: Implementation :: CPython", | ||
"Programming Language :: Python :: Implementation :: PyPy", | ||
"Operating System :: OS Independent", | ||
], | ||
) |
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 @@ | ||
# Empty for now |
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,10 @@ | ||
# (C) Copyright 2023 European Centre for Medium-Range Weather Forecasts. | ||
# This software is licensed under the terms of the Apache Licence Version 2.0 | ||
# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. | ||
# In applying this licence, ECMWF does not waive the privileges and immunities | ||
# granted to it by virtue of its status as an intergovernmental organisation | ||
# nor does it submit to any jurisdiction. | ||
|
||
|
||
def test_code(): | ||
pass # Empty for now |
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,13 @@ | ||
[isort] | ||
profile = black | ||
|
||
[flake8] | ||
; ignore = E226,E302,E41 | ||
max-line-length = 120 | ||
; exclude = tests/* | ||
; See https://black.readthedocs.io/en/stable/the_black_code_style.html | ||
exclude = | ||
dev/* | ||
experiments | ||
?.py | ||
extend-ignore = E203 |