Skip to content

Commit

Permalink
♻️ REFACTOR: EBP Migration (#76)
Browse files Browse the repository at this point in the history
Maintenance changes made, to align the coding practices with other packages in the EBP org:

- Move tests outside package
- Change links in README and add contributing section
- Add extras to setup.py
- Add `__version__` to package and read in setup.py
- Add tox.ini configuration
- Add and run pre-commit configuration
- Pin python to >=3.6,<4
- Pin sphinx to >=2,<4
- Add GitHub CI workflow (removed TravisCI hook)
- remove built docs folder and instead build docs with RTD (and test in PRs)
  • Loading branch information
chrisjsewell authored Aug 18, 2020
1 parent 782104f commit 6342ed3
Show file tree
Hide file tree
Showing 79 changed files with 266 additions and 14,978 deletions.
79 changes: 79 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
# This workflow will install Python dependencies, run tests and lint with a variety of Python versions
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions

name: continuous-integration

on:
push:
branches: [master]
tags:
- 'v*'
pull_request:

jobs:

pre-commit:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- name: Set up Python 3.8
uses: actions/setup-python@v1
with:
python-version: 3.8
- uses: pre-commit/action@v2.0.0

tests:

runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.6, 3.7, 3.8]
sphinx: [">=2,<3", ">=3,<4"]

steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v1
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install "sphinx${{ matrix.sphinx }}"
pip install .[testing]
- name: Run pytest
run: |
pytest --cov=sphinx_tabs --cov-report=xml --cov-report=term-missing
- name: Upload to Codecov
if: matrix.python-version == 3.7 && matrix.sphinx == '>=3,<=4' && github.repository == 'executablebooks/sphinx-tabs'
uses: codecov/codecov-action@v1
with:
name: sphinx-tabs-pytests-py3.7
flags: pytests
file: ./coverage.xml
fail_ci_if_error: true

publish:

name: Publish to PyPi
needs: [pre-commit, tests]
if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags')
runs-on: ubuntu-latest
steps:
- name: Checkout source
uses: actions/checkout@v2
- name: Set up Python 3.7
uses: actions/setup-python@v1
with:
python-version: 3.7
- name: Build package
run: |
pip install wheel
python setup.py sdist bdist_wheel
- name: Publish
uses: pypa/gh-action-pypi-publish@v1.1.0
with:
user: __token__
password: ${{ secrets.PYPI_KEY }}
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
build
_build
dist
test-output
*.egg*
docs/.doctrees
.tox/
.vscode/
__pycache__
*.pyc
.DS_Store
31 changes: 31 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
repos:

- repo: git://github.com/pre-commit/pre-commit-hooks
rev: v2.2.3
hooks:
- id: check-json
- id: check-yaml
- id: end-of-file-fixer
- id: trailing-whitespace

- repo: https://github.com/mgedmin/check-manifest
rev: "0.39"
hooks:
- id: check-manifest

- repo: https://github.com/PyCQA/pylint
rev: pylint-2.4.2
hooks:
- id: pylint
args:
- --disable=missing-docstring,similarities,fixme
additional_dependencies:
- sphinx
- docutils
- pygments
exclude: >
(?x)^(
setup.py|
test/.*|
docs/.*
)$
11 changes: 11 additions & 0 deletions .readthedocs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
version: 2

python:
version: 3
install:
- method: pip
path: .

sphinx:
builder: html
fail_on_warning: true
34 changes: 0 additions & 34 deletions .travis.yml

This file was deleted.

2 changes: 1 addition & 1 deletion CHANGES.txt
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ v1.1.4
* Fix broken javascript file inclusion

v1.1.3
* Insert CSS and JS files after custom ones add in conf.py
* Insert CSS and JS files after custom ones add in conf.py

v1.1.2
* Add support for dirhtml builder
Expand Down
19 changes: 19 additions & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
exclude docs
recursive-exclude docs *
exclude test
recursive-exclude test *
exclude images
recursive-exclude images *

exclude .pre-commit-config.yaml
exclude .readthedocs.yml
exclude pylint.cfg
exclude tox.ini

include LICENSE
include README.md
include CHANGES.txt

include sphinx_tabs/tabs.js
include sphinx_tabs/tabs.css
recursive-include sphinx_tabs/semantic-ui-2.4.1 *
23 changes: 0 additions & 23 deletions Makefile

This file was deleted.

50 changes: 35 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,16 +1,18 @@
sphinx-tabs [![Build Status](https://travis-ci.org/djungelorm/sphinx-tabs.svg?branch=master)](https://travis-ci.org/djungelorm/sphinx-tabs)
========================================
# sphinx-tabs

[![Github-CI][github-ci]][github-link]
[![Coverage Status][codecov-badge]][codecov-link]
[![PyPI][pypi-badge]][pypi-link]

Create tabbed content in [Sphinx documentation](http://www.sphinx-doc.org) when building HTML.

For example, see the [Raw] code of [example/index.rst](example/index.rst) which generates the following:
For example, see the [Raw] code of [docs/index.rst](docs/index.rst) which generates the following:

A live demo can be found here: https://djungelorm.github.io/sphinx-tabs/
A live demo can be found here: <https://sphinx-tabs.readthedocs.io>

![Tabs](/images/tabs.gif)

Installation
----------------------------------------
## Installation

```bash
pip install sphinx-tabs
Expand All @@ -23,14 +25,27 @@ extensions = ['sphinx_tabs.tabs']
```

If you are using [Read The Docs](https://readthedocs.org/) for building your documentation, the extension must be added as a requirement. Please add the following to `requirements.txt` at the root of the project:

```
sphinx-tabs==1.1.13
```

## Contributing

We welcome all contributions!
See the [EBP Contributing Guide](https://executablebooks.org/en/latest/contributing.html) for general details.

The simplest way to run tests is to install [pre-commit](https://pre-commit.com/) for linting and [tox](https://tox.readthedocs.io) for unit tests and documentation build:

```console
$ pre-commit run --all
```
https://github.com/djungelorm/sphinx-tabs/releases/download/v1.1.12/sphinx-tabs-1.1.13.tar.gz
```

An example of this can be found [here](https://github.com/djungelorm/sphinx-tabs-rtd-test/blob/master/requirements.txt).
```console
$ tox -p
```

Basic Tabs
----------------------------------------
## Basic Tabs

Basic tabs can be coded as follows:

Expand All @@ -52,8 +67,7 @@ Basic tabs can be coded as follows:

![Tabs](/images/tabs.gif)

Grouped Tabs
----------------------------------------
## Grouped Tabs

Tabs can be grouped, so that changing the current tab in one area changes the current tab in the
another area. For example:
Expand Down Expand Up @@ -90,8 +104,7 @@ another area. For example:

![Group Tabs](/images/groupTabs.gif)

Code Tabs
----------------------------------------
## Code Tabs

Tabs containing code areas with syntax highlighting can be created as follows:

Expand Down Expand Up @@ -134,3 +147,10 @@ Tabs containing code areas with syntax highlighting can be created as follows:
```

![Code Tabs](/images/codeTabs.gif)

[github-ci]: https://github.com/executablebooks/sphinx-tabs/workflows/continuous-integration/badge.svg?branch=master
[github-link]: https://github.com/executablebooks/sphinx-tabs
[pypi-badge]: https://img.shields.io/pypi/v/sphinx-tabs.svg
[pypi-link]: https://pypi.org/project/sphinx-tabs
[codecov-badge]: https://codecov.io/gh/executablebooks/sphinx-tabs/branch/master/graph/badge.svg
[codecov-link]: https://codecov.io/gh/executablebooks/sphinx-tabs
4 changes: 0 additions & 4 deletions docs/.buildinfo

This file was deleted.

1 change: 0 additions & 1 deletion docs/.nojekyll

This file was deleted.

Loading

0 comments on commit 6342ed3

Please sign in to comment.