Skip to content

Commit

Permalink
Fix failing build for documentation (#29)
Browse files Browse the repository at this point in the history
* Add yaml.SafeLoader to conf.py

* Update python versions in CI

* Update tests

* Update readthedocs yml

* Fix req path in yml

* Remove requirements from readthedoc build

* Update badges, doc notebook

* Formatting update to notebook
  • Loading branch information
catanzaromj committed Feb 24, 2024
1 parent 5363c15 commit e930506
Show file tree
Hide file tree
Showing 8 changed files with 207 additions and 142 deletions.
50 changes: 25 additions & 25 deletions .github/workflows/python-app.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,37 +5,37 @@ name: Python application

on:
push:
branches: [ master ]
branches: [master]
pull_request:
branches: [ master ]
branches: [master]

jobs:
test:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.6, 3.7, 3.8]
python-version: ["3.7", "3.8", "3.9", "3.10", "3.11", "3.12"]

steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip==19.3.1
pip install flake8 pytest-cov
pip install -e ".[testing]"
- 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 --cov sktda
- name: Upload coverage results
run: |
bash <(curl -s https://codecov.io/bash)
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install flake8 pytest-cov
pip install -e ".[testing]"
- 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 --cov sktda
- name: Upload coverage results
run: |
bash <(curl -s https://codecov.io/bash)
16 changes: 10 additions & 6 deletions .readthedocs.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
version: 2

build:
os: "ubuntu-22.04"
tools:
python: "3.11"

python:
version: 3.7
install:
- method: pip
path: .
extra_requirements:
- docs
install:
- method: pip
path: .
extra_requirements:
- docs
37 changes: 20 additions & 17 deletions docs/conf.py
Original file line number Diff line number Diff line change
@@ -1,36 +1,39 @@
# -*- coding: utf-8 -*-
import os
import sys
sys.path.insert(0, os.path.abspath('.'))
sys.path.append(os.path.abspath('extensions'))
import yaml

sys.path.insert(0, os.path.abspath("."))
sys.path.append(os.path.abspath("extensions"))
from sktda import __version__
from sktda_docs_config import *

project = 'scikit-tda'
copyright = '2019, Nathaniel Saul'
author = 'Nathaniel Saul'
project = "scikit-tda"
copyright = "2019, Nathaniel Saul"
author = "Nathaniel Saul"
version = __version__
release = __version__

html_theme_options.update({
# Google Analytics info
'ga_ua': 'UA-124965309-1',
'ga_domain': '',
'gh_url': 'scikit-tda'
})
html_theme_options.update(
{
# Google Analytics info
"ga_ua": "UA-124965309-1",
"ga_domain": "",
"gh_url": "scikit-tda",
}
)

html_short_title = project
htmlhelp_basename = 'scikit-tdadoc'
htmlhelp_basename = "scikit-tdadoc"

html_context = {}

# Setup library data
import yaml
with open('data/libraries.yaml', 'r') as f:
libraries = yaml.load(f)
with open("data/libraries.yaml", "r") as f:
libraries = yaml.load(f, Loader=yaml.SafeLoader)


# import pdb; pdb.set_trace()
html_context['libraries'] = libraries
html_context["libraries"] = libraries

extensions.append('rstjinja')
extensions.append("rstjinja")
4 changes: 2 additions & 2 deletions docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,8 @@ This package is licensed with the MIT license.
:target: https://zenodo.org/badge/latestdoi/129452930
.. |Pypi| image:: https://badge.fury.io/py/scikit-tda.svg
:target: https://badge.fury.io/py/scikit-tda
.. |Downloads| image:: https://pypip.in/download/scikit-tda/badge.svg
:target: https://pypi.python.org/scikit-tda/sktda/
.. |Downloads| image:: https://img.shields.io/pypi/dm/scikit-tda
:target: https://pypi.org/project/scikit-tda/

.. _github: https://github.com/scikit-tda
.. _twitter: https://twitter.com/scikit_tda
Expand Down
14 changes: 9 additions & 5 deletions docs/libraries.rst
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,10 @@ To install the entire suite
>>> pip install scikit-tda
Below, you'll find information on each individual package, along with resources to explore more. Each package is well tested, well documented, easy to install, and open for contributions. If you find any bugs in the code or documentation, please let us know on `github <https://github.com/scikit-tda>`_
Below, you'll find information on each individual package, along with resources
to explore more. Each package is well tested, well documented, easy to install,
and open for contributions. If you find any bugs in the code or documentation,
please let us know on `github <https://github.com/scikit-tda>`_.


{% for library in libraries %}
Expand All @@ -32,10 +35,8 @@ Below, you'll find information on each individual package, along with resources

.. image:: https://badge.fury.io/py/{{ library["pypi" ]}}.svg
:target: https://badge.fury.io/py/{{ library["pypi" ]}}
.. image:: https://pypip.in/download/{{ library["pypi"] }}/badge.svg
.. image:: https://img.shields.io/pypi/dm/{{ library["pypi"] }}
:target: https://pypi.python.org/pypi/{{ library["pypi"] }}/
.. image:: https://travis-ci.org/scikit-tda/{{ library["repo"] }}.svg?branch=master
:target: https://travis-ci.org/scikit-tda/{{ library["repo"] }}
.. image:: https://codecov.io/gh/scikit-tda/{{ library["repo"] }}/branch/master/graph/badge.svg
:target: https://codecov.io/gh/scikit-tda/{{ library["repo"] }}
.. image:: https://img.shields.io/badge/License-MIT-yellow.svg
Expand All @@ -54,7 +55,10 @@ Below, you'll find information on each individual package, along with resources
>>> pip install {{ library["pypi"] }}
Check out complete documentation for {{ library["title"] }} at `{{ library["url"] }} <https://{{ library["url"] }}>`_ and the source code at `github.com/scikit-tda/{{ library["repo"] }} <https://github.com/scikit-tda/{{ library["repo"] }}>`_
Check out complete documentation for {{ library["title"] }} at `{{
library["url"] }} <https://{{ library["url"] }}>`_ and the source code at
`github.com/scikit-tda/{{ library["repo"] }}
<https://github.com/scikit-tda/{{ library["repo"] }}>`_.


{% endfor %}
Expand Down
206 changes: 127 additions & 79 deletions docs/notebooks/scikit-tda Tutorial.ipynb

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions sktda/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from ripser import *
from persim import *
import ripser
import persim

import tadasets

from ._version import __version__
from ._version import __version__
16 changes: 11 additions & 5 deletions test/test_sktda.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,22 @@

import sktda


def test_ripser():
assert "ripser" in dir(sktda)
assert callable(sktda.ripser)
assert callable(sktda.ripser.ripser)


def test_persim():
assert "PersImage" in dir(sktda)
assert "heat" in dir(sktda)
assert "sliced_wasserstein" in dir(sktda)
assert "plot_diagrams" in dir(sktda)
assert "persim" in dir(sktda)
assert "PersImage" in dir(sktda.persim)
assert "heat" in dir(sktda.persim)
assert "sliced_wasserstein" in dir(sktda.persim)
assert "plot_diagrams" in dir(sktda.persim)
assert "landscapes" in dir(sktda.persim)


def test_tadasets():
assert "tadasets" in dir(sktda)
assert "dsphere" in dir(sktda.tadasets)
assert "swiss_roll" in dir(sktda.tadasets)

0 comments on commit e930506

Please sign in to comment.