Skip to content

Commit

Permalink
Merge pull request #84 from lpfann/dev
Browse files Browse the repository at this point in the history
Release 8.1.0
  • Loading branch information
lpfann authored Jan 1, 2021
2 parents 1ba93de + 53bf341 commit c5790e9
Show file tree
Hide file tree
Showing 13 changed files with 1,294 additions and 822 deletions.
59 changes: 41 additions & 18 deletions .github/workflows/deploy_pypi.yml
Original file line number Diff line number Diff line change
@@ -1,38 +1,61 @@
name: Deploy to PyPI
name: Deploy PyPi and Docs

on:
release:
types: [published,edited] # Only deploy when publishing github releases
env:
PYTHONVERSION: 3.8

jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2.3.1
#----------------------------------------------
# check-out repo and set-up python
#----------------------------------------------
- uses: actions/checkout@v2
with:
fetch-depth: 1
- name: Set up Python
uses: actions/setup-python@v2.0.1
- name: Set up Python ${{ env.PYTHONVERSION }}
uses: actions/setup-python@v2
with:
python-version: 3.7
python-version: ${{ env.PYTHONVERSION }}
#----------------------------------------------
# ----- install & configure poetry -----
#----------------------------------------------
- name: Install Poetry
uses: dschep/install-poetry-action@v1.2
- name: Cache poetry venv
uses: snok/install-poetry@v1.1.1
with:
virtualenvs-create: true
virtualenvs-in-project: true
#----------------------------------------------
# load cached venv if cache exists
#----------------------------------------------
- name: Load cached venv
id: cached-poetry-dependencies
uses: actions/cache@v2
id: cache
with:
path: ~/.virtualenvs
key: poetry-3.7-${{ hashFiles('**/poetry.lock') }}
restore-keys: |
poetry-3.7-${{ hashFiles('**/poetry.lock') }}
path: .venv
key: venv-${{ hashFiles('**/poetry.lock') }}
- name: Set Poetry config
run: |
poetry config virtualenvs.in-project false
poetry config virtualenvs.path ~/.virtualenvs
poetry config pypi-token.pypi ${{ secrets.POETRY_PYPI_TOKEN_PYPI }}
#----------------------------------------------
# install dependencies if cache does not exist
#----------------------------------------------
- name: Install dependencies
if: steps.cache.outputs.cache-hit != 'true'
run: poetry install -v
- name: Deploy using poetry
run: poetry install
if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true'
- name: Deploy PyPi
run: poetry publish --build -u __token__ -p ${{ secrets.POETRY_PYPI_TOKEN_PYPI }}

- name: Run and convert notebooks into markdown
run: poetry run jupyter nbconvert --to markdown docs/*.ipynb
- name: Portray - Compile as HTML
run: poetry run portray as_html
- name: Deploy Docs to Github
uses: peaceiris/actions-gh-pages@v3
with:
deploy_key: ${{ secrets.ACTIONS_DEPLOY_KEY }}
publish_branch: gh-pages
publish_dir: ./site
cname: fri.lpfann.me
66 changes: 38 additions & 28 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
@@ -1,43 +1,53 @@
name: Documentation
name: Test Documentation

on: [push, pull_request]
on:
push:
branches:
- 'master'
- 'dev'
pull_request:

env:
PYTHONVERSION: 3.8

jobs:
build-docs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2.3.1
#----------------------------------------------
# check-out repo and set-up python
#----------------------------------------------
- uses: actions/checkout@v2
with:
fetch-depth: 1
- name: Setup Python
uses: actions/setup-python@v2.0.1
- name: Set up Python ${{ env.PYTHONVERSION }}
uses: actions/setup-python@v2
with:
python-version: 3.7
python-version: ${{ env.PYTHONVERSION }}
#----------------------------------------------
# ----- install & configure poetry -----
#----------------------------------------------
- name: Install Poetry
uses: dschep/install-poetry-action@v1.2
- name: Cache poetry venv
uses: snok/install-poetry@v1.1.1
with:
virtualenvs-create: true
virtualenvs-in-project: true
#----------------------------------------------
# load cached venv if cache exists
#----------------------------------------------
- name: Load cached venv
id: cached-poetry-dependencies
uses: actions/cache@v2
id: cache
with:
path: ~/.virtualenvs
key: poetry-3.7-${{ hashFiles('**/poetry.lock') }}
restore-keys: |
poetry-3.7-${{ hashFiles('**/poetry.lock') }}
- name: Set Poetry config
run: |
poetry config virtualenvs.in-project false
poetry config virtualenvs.path ~/.virtualenvs
path: .venv
key: venv-${{ hashFiles('**/poetry.lock') }}
#----------------------------------------------
# install dependencies if cache does not exist
#----------------------------------------------
- name: Install dependencies
if: steps.cache.outputs.cache-hit != 'true'
run: poetry install -v
run: poetry install
if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true'
- name: Run and convert notebooks into markdown
run: poetry run jupyter nbconvert --to markdown docs/*.ipynb
- run: poetry run portray as_html
name: Portray - Compile as HTML
- name: Deploy
uses: peaceiris/actions-gh-pages@v3
with:
deploy_key: ${{ secrets.ACTIONS_DEPLOY_KEY }}
publish_branch: gh-pages
publish_dir: ./site
cname: fri.lpfann.me
- name: Portray - Compile as HTML
run: poetry run portray as_html
67 changes: 48 additions & 19 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,40 +3,69 @@ name: pytest with poetry
on: [push]

jobs:
linting:
runs-on: ubuntu-latest
steps:
#----------------------------------------------
# check-out repo and set-up python
#----------------------------------------------
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
#----------------------------------------------
# load pip cache if cache exists
#----------------------------------------------
- uses: actions/cache@v2
with:
path: ~/.cache/pip
key: pip
restore-keys: pip
#----------------------------------------------
# install and run linters
#----------------------------------------------
- run: python -m pip install black
- run: |
black . --check
test:
runs-on: ubuntu-latest
strategy:
max-parallel: 4
matrix:
python-version: [3.6, 3.7, 3.8]
python-version: [3.6, 3.7, 3.8, 3.9]

steps:
- uses: actions/checkout@v2.3.1
#----------------------------------------------
# check-out repo and set-up python
#----------------------------------------------
- uses: actions/checkout@v2
with:
fetch-depth: 1
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2.0.1
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
#----------------------------------------------
# ----- install & configure poetry -----
#----------------------------------------------
- name: Install Poetry
uses: dschep/install-poetry-action@v1.2
- name: Cache poetry venv
uses: snok/install-poetry@v1.1.1
with:
virtualenvs-create: true
virtualenvs-in-project: true
#----------------------------------------------
# load cached venv if cache exists
#----------------------------------------------
- name: Load cached venv
id: cached-poetry-dependencies
uses: actions/cache@v2
id: cache
with:
path: ~/.virtualenvs
key: poetry-${{ matrix.python-version }}-${{ hashFiles('**/poetry.lock') }}
restore-keys: |
poetry-${{ matrix.python-version }}-${{ hashFiles('**/poetry.lock') }}
- name: Set Poetry config
run: |
poetry config virtualenvs.in-project false
poetry config virtualenvs.path ~/.virtualenvs
path: .venv
key: venv-${{ hashFiles('**/poetry.lock') }}
#----------------------------------------------
# install dependencies if cache does not exist
#----------------------------------------------
- name: Install dependencies
if: steps.cache.outputs.cache-hit != 'true'
run: poetry install -v
- name: Lint with black
run: poetry run black . --check
run: poetry install
if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true'
- name: Test with pytest
run: |
poetry run pytest --cov .
poetry run pytest -n 2 --cov .
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -91,3 +91,4 @@ target/
/.vscode/
/doc/.vscode/
/site/
fri/grouping.py
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
repos:
- repo: https://github.com/ambv/black
rev: stable
rev: 20.8b1
hooks:
- id: black
8 changes: 6 additions & 2 deletions fri/__init__.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
import logging

# noinspection PyUnresolvedReferences
from fri._version import __version__
from importlib_metadata import version

try:
__version__ = version(__name__)
except:
pass

logging.basicConfig(level=logging.INFO)
from enum import Enum
Expand Down
1 change: 0 additions & 1 deletion fri/_version.py

This file was deleted.

Loading

0 comments on commit c5790e9

Please sign in to comment.