Skip to content

Commit

Permalink
Explicit migration from Travis to Github actions + deps bump (#152)
Browse files Browse the repository at this point in the history
* Explicit Travis replacement with github actions

* Resolving config issues and linting

* Who looks at examples, eh?

* Bump version to 1.6.0
  • Loading branch information
laszukdawid committed Mar 16, 2024
1 parent 0e28c29 commit 9f42c57
Show file tree
Hide file tree
Showing 17 changed files with 145 additions and 162 deletions.
25 changes: 6 additions & 19 deletions .github/workflows/ci-lint.yml
@@ -1,26 +1,13 @@
name: Linter

on: [push]
on: [push, pull_request]

jobs:
build-n-lint:
lint:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- name: Set up Python 3.8
uses: actions/setup-python@v2
- uses: actions/checkout@v4
- uses: psf/black@stable
- uses: isort/isort-action@v1
with:
python-version: "3.8"

- name: Install test dependencies
run: |
pip install --upgrade pip
pip install --only-binary=numpy,scipy numpy scipy
pip install -e .[dev]
- name: Run ISort check
run: python -m isort --check PyEMD
- name: Run PyCodeStyle check
run: python -m pycodestyle PyEMD
- name: Run Black check
run: python -m black --check PyEMD
sort-paths: PyEMD
52 changes: 52 additions & 0 deletions .github/workflows/ci-main-build-test-deploy.yml
@@ -0,0 +1,52 @@
name: Upload Python Package

on:
push:
paths:
- PyEMD/__init__.py
branches:
- $default-branch

jobs:
build-n-test:
runs-on: ubuntu-latest

strategy:
matrix:
python-version: [3.8, 3.9, 3.10, 3.11, 3.12]

steps:
- uses: actions/checkout@v4
- name: Running Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install test dependencies
run: |
pip install --only-binary=numpy,scipy numpy scipy
pip install -e .[test]
- name: Run tests
run: |
python -m PyEMD.tests.test_all
deploy:
# Run 'deploy' job only if `PyEMD/__init__.py` is modified
if: github.event_name == 'push' && contains(github.event.head_commit.modified, 'PyEMD/__init__.py')
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
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.EMD_PYPI_API_TOKEN }}
37 changes: 37 additions & 0 deletions .github/workflows/ci-pr-test.yml
@@ -0,0 +1,37 @@
name: Test

on:
push:
branches-ignore:
- $default-branch
pull_request:
paths:
- 'PyEMD/**.py'

jobs:

build-n-test:
runs-on: ubuntu-latest

strategy:
matrix:
python-version:
- "3.8"
- "3.9"
- "3.10"
- "3.11"
- "3.12"

steps:
- uses: actions/checkout@v4
- name: Running Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install test dependencies
run: |
pip install --only-binary=numpy,scipy numpy scipy
pip install -e .[test]
- name: Run tests
run: |
python -m PyEMD.tests.test_all
48 changes: 0 additions & 48 deletions .github/workflows/ci-test.yml

This file was deleted.

31 changes: 0 additions & 31 deletions .github/workflows/python-publish.yml

This file was deleted.

20 changes: 0 additions & 20 deletions .travis.yml

This file was deleted.

8 changes: 6 additions & 2 deletions Makefile
@@ -1,3 +1,4 @@
LINT_TARGET_DIRS := PyEMD doc example

test:
python -m PyEMD.tests.test_all
Expand All @@ -10,8 +11,11 @@ doc:
cd doc && make html

format:
black PyEMD
python -m black $(LINT_TARGET_DIRS)

lint-check:
python -m isort --check PyEMD
python -m black --check PyEMD
python -m black --check $(LINT_TARGET_DIRS)

perf/build:
docker build -t pyemd-perf -f perf_test/Dockerfile .
2 changes: 1 addition & 1 deletion PyEMD/__init__.py
@@ -1,6 +1,6 @@
import logging

__version__ = "1.5.2"
__version__ = "1.6.0"
logger = logging.getLogger("pyemd")

from PyEMD.CEEMDAN import CEEMDAN # noqa
Expand Down
1 change: 1 addition & 0 deletions PyEMD/checks.py
@@ -1,4 +1,5 @@
"""Calculate the statistical Significance of IMFs."""

import logging
import math

Expand Down
1 change: 1 addition & 0 deletions PyEMD/tests/test_checks.py
@@ -1,4 +1,5 @@
"""Tests for checks.py."""

import unittest

import numpy as np
Expand Down
1 change: 0 additions & 1 deletion README.md
@@ -1,5 +1,4 @@
[![codecov](https://codecov.io/gh/laszukdawid/PyEMD/branch/master/graph/badge.svg)](https://codecov.io/gh/laszukdawid/PyEMD)
[![Build Status](https://app.travis-ci.com/laszukdawid/PyEMD.svg?branch=master)](https://app.travis-ci.com/laszukdawid/PyEMD)
[![DocStatus](https://readthedocs.org/projects/pyemd/badge/?version=latest)](https://pyemd.readthedocs.io/)
[![Codacy Badge](https://app.codacy.com/project/badge/Grade/f56b6fc3f855476dbaebd3c02ae88f3e)](https://www.codacy.com/gh/laszukdawid/PyEMD/dashboard?utm_source=github.com&utm_medium=referral&utm_content=laszukdawid/PyEMD&utm_campaign=Badge_Grade)
[![DOI](https://zenodo.org/badge/65324353.svg)](https://zenodo.org/badge/latestdoi/65324353)
Expand Down
18 changes: 9 additions & 9 deletions doc/conf.py
Expand Up @@ -65,25 +65,25 @@
master_doc = "index"

# General information about the project.
project = u"PyEMD"
copyright = u"2016-{year}, Dawid Laszuk".format(year=datetime.datetime.now().year)
author = u"Dawid Laszuk"
project = "PyEMD"
copyright = "2016-{year}, Dawid Laszuk".format(year=datetime.datetime.now().year)
author = "Dawid Laszuk"

# The version info for the project you're documenting, acts as replacement for
# |version| and |release|, also used in various other places throughout the
# built documents.
#
# The short X.Y version.
version = u"0.4.0"
version = "0.4.0"
# The full version, including alpha/beta/rc tags.
release = u"0.4.0"
release = "0.4.0"

# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
#
# This is also used if you do content translation via gettext catalogs.
# Usually you set "language" from the command line for these cases.
language = 'en'
language = "en"

# List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files.
Expand Down Expand Up @@ -142,15 +142,15 @@
# (source start file, target name, title,
# author, documentclass [howto, manual, or own class]).
latex_documents = [
(master_doc, "PyEMD.tex", u"PyEMD Documentation", u"Dawid Laszuk", "manual"),
(master_doc, "PyEMD.tex", "PyEMD Documentation", "Dawid Laszuk", "manual"),
]


# -- Options for manual page output ---------------------------------------

# One entry per manual page. List of tuples
# (source start file, name, description, authors, manual section).
man_pages = [(master_doc, "PyEMD", u"PyEMD Documentation", [author], 1)]
man_pages = [(master_doc, "PyEMD", "PyEMD Documentation", [author], 1)]


# -- Options for Texinfo output -------------------------------------------
Expand All @@ -159,7 +159,7 @@
# (source start file, target name, title, author,
# dir menu entry, description, category)
texinfo_documents = [
(master_doc, "PyEMD", u"PyEMD Documentation", author, "PyEMD", "One line description of project.", "Miscellaneous"),
(master_doc, "PyEMD", "PyEMD Documentation", author, "PyEMD", "One line description of project.", "Miscellaneous"),
]


Expand Down
2 changes: 1 addition & 1 deletion example/eemd_example.py
Expand Up @@ -12,7 +12,7 @@
S += 5 * sin(11, 2.7)
S += 3 * sin(14, 1.6)
S += 1 * np.sin(4 * 2 * np.pi * (t - 0.8) ** 2)
S += t ** 2.1 - t
S += t**2.1 - t

# Assign EEMD to `eemd` variable
eemd = EEMD()
Expand Down
7 changes: 5 additions & 2 deletions example/emd_comparison.py
Expand Up @@ -6,6 +6,7 @@
a lot of the same computation within a single execution. For a single script
with a single EMD execution, it's still much more performant to use normal EMD.
"""

import time
import numpy as np

Expand All @@ -17,11 +18,13 @@
t = get_timeline(len(s), s.dtype)
n_repeat = 20

print(f"""Comparing EEMD execution on a larger signal with classic and JIT EMDs.
print(
f"""Comparing EEMD execution on a larger signal with classic and JIT EMDs.
Signal is random (uniform) noise of length: {len(s)}. The test is done by executing
EEMD with either classic or JIT EMD {n_repeat} times and taking the average. Such
setup favouries JitEMD which is compiled once and then reused {n_repeat-1} times.
Compiltion is quite costly.""")
Compiltion is quite costly."""
)

time_0 = time.time()
emd = EMD()
Expand Down

0 comments on commit 9f42c57

Please sign in to comment.