Skip to content

Commit

Permalink
testing github actions
Browse files Browse the repository at this point in the history
  • Loading branch information
Daniel Santiago committed Jul 3, 2024
1 parent 41866d6 commit e696367
Show file tree
Hide file tree
Showing 5 changed files with 97 additions and 6 deletions.
41 changes: 41 additions & 0 deletions .github/workflows/python-package.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# This workflow will install Python dependencies, run tests and lint with a
# variety of Python versions For more information see:
# https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python

name: Python package

on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]

jobs:
build:

runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: ["3.9", "3.10", "3.11"]

steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v3
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install flake8 pytest
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
- name: Lint with flake8
run: |
# stop the build if there are Python syntax errors or undefined names
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
- name: Test with pytest
run: |
pytest
40 changes: 40 additions & 0 deletions .github/workflows/python-publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# This workflow will upload a Python Package using Twine when a release is
# created For more information see:
# https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python#publishing-to-package-registries

# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.

name: Upload Python Package

on:
release:
types: [published]

permissions:
contents: read

jobs:
deploy:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v3
with:
python-version: '3.x'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install build
- name: Build package
run: python -m build
- name: Publish package
uses: pypa/gh-action-pypi-publish@27b31702a0e7fc50959f5ad993c78deac1bdfc29
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}
10 changes: 5 additions & 5 deletions ewdm/sources.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,18 +15,18 @@


class SpotterBuoysDataSource(object):
"""Class to handle Spotter buoy data from SDCard"""
"""Class to handle Spotter buoy data from SD Card"""

def __init__(
self,
fname: str ="displacement.csv",
fname: str ="displacements.csv",
):
if os.path.isfile(fname):
self.fname = Path(fname)
else:
raise FileNotFoundError(
"File not found. The name of the file in the SDCard is "
"likely `displacement.csv`. Please provide "
"File not found. The name of the file in the SD Card is "
"likely `displacements.csv`. Please provide "
"the full path to this file."
)

Expand Down Expand Up @@ -55,7 +55,7 @@ def read_dataset(self):
# load data
data = pd.read_csv(
self.fname, names=columns, header=None, skiprows=1,
parse_dates={"time": columns[:7]}, date_parser=parser
parse_dates={"time": columns[:7]}, date_format=parser
)

# convert to xarray and add metadata
Expand Down
9 changes: 9 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
numpy
scipy
pandas
xarray
matplotlib
bottleneck
pydap
netCDF4
tqdm
3 changes: 2 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

setup(
name="ewdm",
version="0.1",
version="0.2",
author="Daniel Peláez-Zapata",
author_email="[email protected]",
description="EWDM: A package for a wavelet-based directional wave spectra",
Expand All @@ -20,6 +20,7 @@
install_requires=[
"numpy",
"scipy",
"pandas",
"xarray",
"matplotlib",
"bottleneck",
Expand Down

0 comments on commit e696367

Please sign in to comment.