From 813008ffa31811035f8c52826c91e140e94d8d9a Mon Sep 17 00:00:00 2001 From: Hugo van Kemenade Date: Tue, 1 Aug 2023 09:09:00 +0300 Subject: [PATCH 1/3] Test and build docs on GitHub Actions --- .github/workflows/doc.yml | 39 ++++++++++++++++++++++++++++++++++++++ .github/workflows/test.yml | 38 +++++++++++++++++++++++++++++++++++++ .gitignore | 3 ++- README.md | 2 +- 4 files changed, 80 insertions(+), 2 deletions(-) create mode 100644 .github/workflows/doc.yml create mode 100644 .github/workflows/test.yml diff --git a/.github/workflows/doc.yml b/.github/workflows/doc.yml new file mode 100644 index 0000000..b337420 --- /dev/null +++ b/.github/workflows/doc.yml @@ -0,0 +1,39 @@ +name: Docs + +on: [push, pull_request, workflow_dispatch] + +env: + FORCE_COLOR: 1 + +jobs: + docs: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v3 + + - name: Set up Python + uses: actions/setup-python@v4 + with: + python-version: 3.x + allow-prereleases: true + cache: pip + cache-dependency-path: | + setup.py + doc/requirements.txt + + - name: Install dependencies + run: | + python -m pip install -U pip + python -m pip install -r doc/requirements.txt + python -m pip install -e . + + - name: Build documentation + run: | + make -C doc html + + - name: Upload documentation + uses: actions/upload-artifact@v3 + with: + name: docs + path: doc/.build/html diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000..db18c5a --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,38 @@ +name: Test + +on: [push, pull_request, workflow_dispatch] + +env: + FORCE_COLOR: 1 + +jobs: + test: + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + python-version: ["3.8", "3.9", "3.10", "3.11"] + os: [windows-latest, macos-latest, ubuntu-latest] + + steps: + - uses: actions/checkout@v3 + + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v4 + with: + python-version: ${{ matrix.python-version }} + allow-prereleases: true + cache: pip + cache-dependency-path: | + setup.py + tests/requirements.txt + + - name: Install dependencies + run: | + python -m pip install -U pip + python -m pip install -r tests/requirements.txt + python -m pip install -e . + + - name: Test + run: | + pytest --cov=calmap --cov=tests diff --git a/.gitignore b/.gitignore index af2c9af..1e752e1 100644 --- a/.gitignore +++ b/.gitignore @@ -2,5 +2,6 @@ build dist .cache +.coverage *.egg-info -.sonarlint \ No newline at end of file +.sonarlint diff --git a/README.md b/README.md index 9959316..f0b1832 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ ------------------------------------------------ [![PyPI version](https://badge.fury.io/py/calmap.svg)](https://badge.fury.io/py/calmap) ![PyPI - Python Version](https://img.shields.io/pypi/pyversions/calmap.svg) -[![Build Status](https://travis-ci.com/MarvinT/calmap.svg?branch=master)](https://travis-ci.com/MarvinT/calmap) +[![GitHub Actions status](https://github.com/MarvinT/calmap/workflows/Test/badge.svg)](https://github.com/MarvinT/calmap/actions) [![Coverage Status](https://coveralls.io/repos/github/MarvinT/calmap/badge.svg?branch=master)](https://coveralls.io/github/MarvinT/calmap?branch=master) [![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/ambv/black) [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT) From 9f8766db7f2f4a666a4a42bb24f364c298a8fc9b Mon Sep 17 00:00:00 2001 From: Hugo van Kemenade Date: Sun, 31 Dec 2023 12:09:39 +0200 Subject: [PATCH 2/3] Test Python 3.12 --- .github/workflows/test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index db18c5a..70ee092 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -11,7 +11,7 @@ jobs: strategy: fail-fast: false matrix: - python-version: ["3.8", "3.9", "3.10", "3.11"] + python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"] os: [windows-latest, macos-latest, ubuntu-latest] steps: From 6034364f926979928dead003d71cd023f472a68b Mon Sep 17 00:00:00 2001 From: Hugo van Kemenade Date: Sun, 31 Dec 2023 12:23:54 +0200 Subject: [PATCH 3/3] Replace distutils with packaging to support Python 3.12 --- calmap/__init__.py | 4 ++-- setup.py | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/calmap/__init__.py b/calmap/__init__.py index 7651522..2ddb034 100644 --- a/calmap/__init__.py +++ b/calmap/__init__.py @@ -15,7 +15,7 @@ import matplotlib.pyplot as plt import numpy as np import pandas as pd -from distutils.version import StrictVersion +from packaging import version from dateutil.relativedelta import relativedelta from matplotlib.patches import Polygon @@ -28,7 +28,7 @@ __contact__ = "marvin.thielk@gmail.com, martijn@vermaat.name" __homepage__ = "https://github.com/MarvinT/calmap" -_pandas_18 = StrictVersion(pd.__version__) >= StrictVersion("0.18") +_pandas_18 = version.parse(pd.__version__) >= version.parse("0.18") def yearplot( diff --git a/setup.py b/setup.py index 6f52f4e..ffff4bb 100644 --- a/setup.py +++ b/setup.py @@ -1,7 +1,7 @@ import os from setuptools import setup -install_requires = ["matplotlib", "numpy", "pandas"] +install_requires = ["matplotlib", "packaging", "numpy", "pandas"] try: with open("README.md") as readme: