Skip to content

Commit

Permalink
CI fix tests (#8)
Browse files Browse the repository at this point in the history
- GHA update
- remove nbs test
- add pre-commit config
- add README badges
  • Loading branch information
stefan-jansen authored Sep 8, 2021
1 parent d05155b commit d7cc8f1
Show file tree
Hide file tree
Showing 15 changed files with 163 additions and 118 deletions.
14 changes: 14 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
version: 2
updates:
# Maintain dependencies for GitHub Actions
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "weekly"
ignore:
# Official actions have moving tags like v1
# that are used, so they don't need updates here
- dependency-name: "actions/checkout"
- dependency-name: "actions/upload-artifact"
- dependency-name: "actions/download-artifact"
- dependency-name: "actions/setup-python"
6 changes: 1 addition & 5 deletions .github/workflows/build_wheels.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ on:
types:
- published


jobs:
dist:
runs-on: ${{ matrix.os }}
Expand Down Expand Up @@ -44,15 +43,13 @@ jobs:
upload_pypi:
needs: [ dist ]
runs-on: ubuntu-latest
# upload to (Test)-PyPI on push with tag starting with v; diff by commit
# if: startsWith(github.ref, 'refs/tags')
steps:
- uses: actions/download-artifact@v2
with:
name: artifact
path: dist
- name: publish to testpypi
uses: pypa/gh-action-pypi-publish@v1.4.1
uses: pypa/gh-action-pypi-publish@master
if: ${{ github.event.inputs.target }} == 'TESTPYPI'
with:
user: __token__
Expand All @@ -61,7 +58,6 @@ jobs:
- name: publish to pypi
uses: pypa/gh-action-pypi-publish@master
if: ${{ github.event.inputs.target }} == 'PYPI' || (github.event_name == 'release' && github.event.action == 'published')
# if: ${{ github.event.inputs.target }} == 'PYPI'
with:
user: __token__
password: ${{ secrets.PYPI_TOKEN }}
61 changes: 34 additions & 27 deletions .github/workflows/conda_package.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: conda
name: Anaconda

on: workflow_dispatch

Expand All @@ -16,9 +16,7 @@ jobs:
fail-fast: false
matrix:
os: [ macos-latest, windows-latest, ubuntu-latest ]
# os: [ ubuntu-latest ]
python: [ '3.7', '3.8']
# python: [ '3.9' ]
python: [ '3.7', '3.8', '3.9']

steps:
- name: Checkout pyfolio-reloaded
Expand All @@ -29,45 +27,54 @@ jobs:
with:
miniconda-version: latest
auto-update-conda: true
channel-priority: true
mamba-version: "*"
python-version: ${{ matrix.python }}
activate-environment: recipe
channels: ml4t, conda-forge, defaults, anaconda
channels: conda-forge, defaults, anaconda

- name: create uploader
# address broken client under py3.9
if: ${{ matrix.python == '3.9' }}
run: conda create -n up python=3.7 anaconda-client

- name: conda build for ${{ matrix.os }}
run: |
conda activate recipe
conda install -n recipe conda-build conda-verify anaconda-client
conda-build --output-folder . --python ${{ matrix.python }} conda/recipe/
mamba install -n recipe boa conda-verify anaconda-client
conda mambabuild --output-folder . --python ${{ matrix.python }} conda.recipe
- name: store macos result
- name: activate uploader
# address broken client under py3.9
if: ${{ matrix.python == '3.9' }}
run: conda activate up

- name: store windows result
uses: actions/upload-artifact@v2
if: ${{ matrix.os == 'macos-latest' }}
if: ${{ matrix.os == 'windows-latest' }}
with:
path: osx-64/*.tar.bz2
path: win-64/*.tar.bz2

- name: upload windows
if: ${{ matrix.os == 'windows-latest' }}
run: anaconda upload -l main -u ml4t win-64/*.tar.bz2

- name: store linux result
uses: actions/upload-artifact@v2
if: ${{ matrix.os == 'ubuntu-latest' }}
with:
path: linux-64/*.tar.bz2

- name: store windows result
- name: upload linux
if: ${{ matrix.os == 'ubuntu-latest' }}
run: anaconda upload -l main -u ml4t linux-64/*.tar.bz2

- name: store macos result
uses: actions/upload-artifact@v2
if: ${{ matrix.os == 'windows-latest' }}
if: ${{ matrix.os == 'macos-latest' }}
with:
path: win-64/*.tar.bz2
path: osx-64/*.tar.bz2

- name: upload ${{ matrix.os }} result to anaconcda
if: ${{ matrix.python != '3.9'}}
env:
OS: ${{ matrix.os }}
run: |
if [ "$OS" == "ubuntu-latest" ] ; then
anaconda upload -l main -u ml4t linux-64/*.tar.bz2
else
if [ "$OS" == "macos-latest" ] ; then
anaconda upload -l main -u ml4t osx-64/*.tar.bz2
else
anaconda upload -l main -u ml4t win-64/*.tar.bz2
fi
fi
- name: upload macos
if: ${{ matrix.os == 'macos-latest' }}
run: anaconda upload -l main -u ml4t osx-64/*.tar.bz2
4 changes: 2 additions & 2 deletions .github/workflows/unit_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,6 @@ jobs:
run: |
flake8
- name: Unittests with tox & nose
- name: Tests with tox & pytest
run: |
tox -p auto -q
tox
20 changes: 20 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v3.4.0
hooks:
- id: check-yaml
- id: check-merge-conflict
- id: end-of-file-fixer
- id: trailing-whitespace

- repo: https://gitlab.com/pycqa/flake8
rev: 3.9.1
hooks:
- id: flake8

- repo: https://github.com/psf/black
rev: 20.8b1
hooks:
- id: black

exclude: '^conda/recipe/meta.yaml$'
11 changes: 8 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,14 @@
</a>
</p>


[![Join the chat at https://gitter.im/stefan-jansen/pyfolio-reloaded](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/stefan-jansen/pyfolio-reloaded?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
[![PyPI Wheels](https://github.com/stefan-jansen/pyfolio-reloaded/actions/workflows/distribution.yml/badge.svg)](https://github.com/stefan-jansen/pyfolio-reloaded/actions/workflows/distribution.yml)
![PyPI](https://img.shields.io/pypi/v/pyfolio-reloaded)
[![Tests](https://github.com/stefan-jansen/pyfolio-reloaded/actions/workflows/unit_tests.yml/badge.svg)](https://github.com/stefan-jansen/pyfolio-reloaded/actions/workflows/unit_tests.yml)
[![conda](https://github.com/stefan-jansen/pyfolio-reloaded/actions/workflows/conda_package.yml/badge.svg)](https://github.com/stefan-jansen/pyfolio-reloaded/actions/workflows/conda_package.yml)
[![PyPI](https://github.com/stefan-jansen/pyfolio-reloaded/actions/workflows/build_wheels.yml/badge.svg)](https://github.com/stefan-jansen/pyfolio-reloaded/actions/workflows/build_wheels.yml)
[![Coverage Status](https://coveralls.io/repos/github/stefan-jansen/pyfolio-reloaded/badge.svg?branch=main)](https://coveralls.io/github/stefan-jansen/pyfolio-reloaded?branch=main)
![GitHub issues](https://img.shields.io/github/issues/stefan-jansen/pyfolio-reloaded)
![Discourse users](https://img.shields.io/discourse/users?server=https%3A%2F%2Fexchange.ml4trading.io%2F)
![Twitter Follow](https://img.shields.io/twitter/follow/ml4trading?style=social)

pyfolio is a Python library for performance and risk analysis of financial portfolios that works well with the [Zipline](https://zipline.ml4trading.io/) open source backtesting library.

Expand Down
2 changes: 1 addition & 1 deletion conda/recipe/meta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ requirements:
- scipy >=0.14.0
- scikit-learn>=0.16.1
- seaborn >=0.7.1
- empyrical-reloaded >=0.5.6
- empyrical-reloaded >=0.5.7 # pending update

test:
imports:
Expand Down
10 changes: 5 additions & 5 deletions docs/deploy.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
from subprocess import check_call

HERE = Path(__file__).resolve(strict=True).parent
ALPHALENS_ROOT = HERE.parent
TEMP_LOCATION = "/tmp/alphalens-doc"
PYFOLIO_ROOT = HERE.parent
TEMP_LOCATION = "/tmp/pyfolio-doc"
TEMP_LOCATION_GLOB = TEMP_LOCATION + "/*"


Expand Down Expand Up @@ -49,8 +49,8 @@ def main():
print("Copying built files to temp location.")
move("build/html", TEMP_LOCATION)

print("Moving to '%s'" % ALPHALENS_ROOT)
os.chdir(ALPHALENS_ROOT)
print("Moving to '%s'" % PYFOLIO_ROOT)
os.chdir(PYFOLIO_ROOT)

print("Checking out gh-pages branch.")
check_call(
Expand All @@ -77,7 +77,7 @@ def main():
os.chdir(old_dir)

print()
print("Updated documentation branch in directory %s" % ALPHALENS_ROOT)
print("Updated documentation branch in directory %s" % PYFOLIO_ROOT)
print("If you are happy with these changes, commit and push to gh-pages.")


Expand Down
55 changes: 30 additions & 25 deletions pyfolio/examples/round_trip_tear_sheet_example.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,13 @@
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"execution_count": 1,
"metadata": {
"ExecuteTime": {
"end_time": "2021-09-07T02:43:48.874652Z",
"start_time": "2021-09-07T02:43:48.864891Z"
}
},
"outputs": [],
"source": [
"# silence warnings\n",
Expand All @@ -38,11 +43,11 @@
},
{
"cell_type": "code",
"execution_count": 1,
"execution_count": 2,
"metadata": {
"ExecuteTime": {
"end_time": "2021-04-20T00:31:32.084691Z",
"start_time": "2021-04-20T00:31:30.976425Z"
"end_time": "2021-09-07T02:43:50.546591Z",
"start_time": "2021-09-07T02:43:48.989776Z"
}
},
"outputs": [],
Expand All @@ -63,11 +68,11 @@
},
{
"cell_type": "code",
"execution_count": 2,
"execution_count": 3,
"metadata": {
"ExecuteTime": {
"end_time": "2021-04-20T00:31:32.410509Z",
"start_time": "2021-04-20T00:31:32.335185Z"
"end_time": "2021-09-07T02:43:51.697971Z",
"start_time": "2021-09-07T02:43:51.616535Z"
}
},
"outputs": [],
Expand All @@ -89,11 +94,11 @@
},
{
"cell_type": "code",
"execution_count": 3,
"execution_count": 4,
"metadata": {
"ExecuteTime": {
"end_time": "2021-04-20T00:31:33.084992Z",
"start_time": "2021-04-20T00:31:33.077720Z"
"end_time": "2021-09-07T02:43:52.439793Z",
"start_time": "2021-09-07T02:43:52.437219Z"
}
},
"outputs": [],
Expand All @@ -120,11 +125,11 @@
},
{
"cell_type": "code",
"execution_count": 4,
"execution_count": 5,
"metadata": {
"ExecuteTime": {
"end_time": "2021-04-20T00:32:01.944657Z",
"start_time": "2021-04-20T00:31:34.193583Z"
"end_time": "2021-09-07T02:44:23.168045Z",
"start_time": "2021-09-07T02:43:54.942707Z"
},
"scrolled": false
},
Expand Down Expand Up @@ -615,11 +620,11 @@
},
{
"cell_type": "code",
"execution_count": 5,
"execution_count": 6,
"metadata": {
"ExecuteTime": {
"end_time": "2021-04-20T00:32:07.044586Z",
"start_time": "2021-04-20T00:32:01.945747Z"
"end_time": "2021-09-07T02:44:28.339232Z",
"start_time": "2021-09-07T02:44:23.171046Z"
}
},
"outputs": [],
Expand All @@ -630,11 +635,11 @@
},
{
"cell_type": "code",
"execution_count": 6,
"execution_count": 7,
"metadata": {
"ExecuteTime": {
"end_time": "2021-04-20T00:32:07.054464Z",
"start_time": "2021-04-20T00:32:07.045701Z"
"end_time": "2021-09-07T02:44:28.358198Z",
"start_time": "2021-09-07T02:44:28.340552Z"
}
},
"outputs": [
Expand Down Expand Up @@ -745,7 +750,7 @@
"4 0.112198 AMD 2 days -0.001249 "
]
},
"execution_count": 6,
"execution_count": 7,
"metadata": {},
"output_type": "execute_result"
}
Expand All @@ -756,11 +761,11 @@
},
{
"cell_type": "code",
"execution_count": 7,
"execution_count": 8,
"metadata": {
"ExecuteTime": {
"end_time": "2021-04-20T00:32:07.141707Z",
"start_time": "2021-04-20T00:32:07.055460Z"
"end_time": "2021-09-07T02:44:28.443008Z",
"start_time": "2021-09-07T02:44:28.359105Z"
}
},
"outputs": [
Expand Down Expand Up @@ -1165,4 +1170,4 @@
},
"nbformat": 4,
"nbformat_minor": 1
}
}
21 changes: 0 additions & 21 deletions pyfolio/tests/test_nbs.py

This file was deleted.

Loading

0 comments on commit d7cc8f1

Please sign in to comment.