Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade pydata theme #21

Closed
wants to merge 8 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions .flake8
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
[flake8]
exclude = build
exclude =
build,
__pycache__,
node_modules,
.nodeenv,
select = W191, W291, W293, W391, E115, E117, E122, E124, E125, E225, E231, E301, E303, E501, F401, F403
count = True
max-complexity = 10
max-line-length = 100
statistics = True
statistics = True
10 changes: 10 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
version: 2
updates:
- package-ecosystem: "pip" # See documentation for possible values
directory: "/" # Location of package manifests
insecure-external-code-execution: allow
schedule:
interval: "daily"
labels:
- "maintenance"
- "dependencies"
44 changes: 24 additions & 20 deletions .github/workflows/ci-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:

- name: Check Style
run: |
pip install -r requirements_style.txt --disable-pip-version-check
pip install .[style]
make

build:
Expand All @@ -36,19 +36,24 @@ jobs:
with:
python-version: 3.9

- name: Install pyansys_sphinx_theme
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v1
with:
python-version: 3.9
cache: "pip"
cache-dependency-path: "pyproject.toml"

- name: Verify package can be built
run: |
python setup.py sdist
pip install dist/pyansys*.tar.gz --disable-pip-version-check
- name: lint package
pip install -U pip build
python -m build

- name: Install
run: |
pip install twine
twine check dist/*
python -m pip install -e .[doc]

- name: Build Documentation
run: |
pip install -r requirements_docs.txt
make -C doc html SPHINXOPTS="-W"
touch doc/build/html/.nojekyll
echo "sphinxdocs.pyansys.com" > doc/build/html/CNAME
Expand All @@ -68,7 +73,6 @@ jobs:
BRANCH: gh-pages
FOLDER: doc/build/html
CLEAN: true
single-commit: true

Release:
if: github.event_name == 'push' && contains(github.ref, 'refs/tags')
Expand All @@ -77,21 +81,21 @@ jobs:
steps:
- uses: actions/checkout@v2

- name: Set up Python
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v1
with:
python-version: 3.9

- name: Generate package
run: python setup.py sdist

- name: Upload to Public PyPi
- name: Build package
run: |
pip install twine
twine upload --skip-existing dist/*
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.TWINE_TOKEN }}
pip install -U pip build
python -m build

- name: Publish
uses: pypa/gh-action-pypi-publish@v1.1.0
with:
user: __token__
password: ${{ secrets.TWINE_TOKEN }}

- name: Release
uses: softprops/action-gh-release@v1
Expand Down
13 changes: 11 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,17 @@ dist/*
#########################
*.egg-info/


# sphinx auto-generated
build/*
doc/build/
doc/source/_autosummary/
doc/source/_autosummary/

# Node
.nodeenv/
node_modules/

# generated by build
src/pyansys_sphinx_theme/theme/pyansys_sphinx_theme/static/scripts/
src/pyansys_sphinx_theme/theme/pyansys_sphinx_theme/static/styles/
src/pyansys_sphinx_theme/theme/pyansys_sphinx_theme/static/vendor/
src/pyansys_sphinx_theme/theme/pyansys_sphinx_theme/static/webpack-macros.html
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Simple makefile to simplify repetitive build env management tasks under posix

CODESPELL_DIRS ?= ./
CODESPELL_SKIP ?= "*.pyc,*.txt,*.gif,*.png,*.jpg,*.js,*.html,*.doctree,*.ttf,*.woff,*.woff2,*.eot,*.mp4,*.inv,*.pickle,*.ipynb,flycheck*,./.git/*,./.hypothesis/*,*.yml,./doc/build/*,./doc/images/*,./dist/*,*~,.hypothesis*,./doc/source/examples/*,*cover,*.dat,*.mac,\#*,build,PKG-INFO,*.mypy_cache/*"
CODESPELL_SKIP ?= "*.pyc,*.txt,*.gif,*.png,*.jpg,*.js,*.html,*.doctree,*.ttf,*.woff,*.woff2,*.eot,*.mp4,*.inv,*.pickle,*.ipynb,flycheck*,./.git/*,./.hypothesis/*,*.yml,./doc/build/*,./doc/images/*,./dist/*,*~,.hypothesis*,./doc/source/examples/*,*cover,*.dat,*.mac,\#*,build,PKG-INFO,*.mypy_cache/*,./node_modules/*,./.nodeenv/*,./src/pyansys_sphinx_theme/theme/pyansys_sphinx_theme/static/*"
CODESPELL_IGNORE ?= "ignore_words.txt"

all: doctest
Expand Down
7 changes: 4 additions & 3 deletions README.rst
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
====================
PyAnsys Sphinx Theme
====================

Expand All @@ -14,9 +15,9 @@ all PyAnsys packages.

Documentation
~~~~~~~~~~~~~
Full documentation for the theme can found at `PyAnsys Sphinx Documentation <https://sphinxdocs.pyansys.com>`_. The webpage was
also built using the ``pyansys-sphinx-theme``, so visit the site for a
preview of the theme.
Full documentation for the theme can found at `PyAnsys Sphinx Documentation
<https://sphinxdocs.pyansys.com>`_. The webpage was also built using the
``pyansys-sphinx-theme``, so visit the site for a preview of the theme.

Other Sites Using the PyAnsys theme:

Expand Down
6 changes: 4 additions & 2 deletions doc/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,21 @@
from pyansys_sphinx_theme import __version__, pyansys_logo_black

# Project information
project = 'pyansys_sphinx_theme'
project = 'pyansys-sphinx-theme'
copyright = f"(c) {datetime.now().year} ANSYS, Inc. All rights reserved"
author = "Ansys Inc."
release = version = __version__

# use the default pyansys logo
html_logo = pyansys_logo_black
html_theme = 'pyansys_sphinx_theme'
html_title = 'PyAnsys Sphinx Theme'

# specify the location of your github repo
html_theme_options = {
"github_url": "https://github.com/pyansys/pyansys-sphinx-theme",
"show_prev_next": False
"show_breadcrumbs": True,
"additional_breadcrumbs": [('PyAnsys', 'https://docs.pyansys.com')],
}

# Sphinx extensions
Expand Down
37 changes: 30 additions & 7 deletions doc/source/index.rst
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
============================================
PyAnsys Sphinx Theme Documentation |version|
============================================

..
Simply reuse the root readme

Expand All @@ -17,15 +13,15 @@ PyAnsys Sphinx Theme Documentation |version|
coding_style


Code Examples
~~~~~~~~~~~~~
Theme Preview
-------------
Here's a quick preview for how Python code looks using the
``pyansys-sphinx-theme``. For more examples, click the links at the
top of the page to see function, method, and class documentation.


Rendered Python Code
--------------------
~~~~~~~~~~~~~~~~~~~~

.. code:: python

Expand All @@ -38,3 +34,30 @@ Rendered Python Code
... print("Negative number")
Positive number


Tables
~~~~~~

.. list-table:: Sample Table
:widths: 25 25 50
:header-rows: 1

* - Heading row 1, column 1
- Heading row 1, column 2
- Heading row 1, column 3
* - Row 1, column 1
-
- Row 1, column 3
* - Row 2, column 1
- Row 2, column 2
- Row 2, column 3


API Documentation
~~~~~~~~~~~~~~~~~

.. currentmodule:: pyansys_sphinx_theme.samples

.. autosummary::

Complex
2 changes: 1 addition & 1 deletion doc/source/style.rst
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ Methods and functions should generally be documented with the
``Examples`` docstring section to make the usage of the method or
function clear. Here is a sample function:

.. literalinclude:: ../../pyansys_sphinx_theme/sample_func.py
.. literalinclude:: ../../src/pyansys_sphinx_theme/sample_func.py

To include the docstring of function within sphinx, use the
``autofunction::`` directive:
Expand Down
51 changes: 40 additions & 11 deletions doc/source/usage.rst
Original file line number Diff line number Diff line change
Expand Up @@ -8,20 +8,46 @@ Install this theme with:

pip install pyansys-sphinx-theme

If you are just getting started using sphinx, follow the directions at
`Sphinx Quickstart
<https://www.sphinx-doc.org/en/master/usage/quickstart.html>`_. Next,
modify your sphinx ``conf.py`` to use ``html_theme =
'pyansys_sphinx_theme'``. Consider using the following ``conf.py`` used in this repository:
If you are just getting started using sphinx, follow the directions at `Sphinx
Quickstart <https://www.sphinx-doc.org/en/master/usage/quickstart.html>`_.
Next, modify your sphinx ``conf.py`` to use ``html_theme =
'pyansys_sphinx_theme'``.


Configurating this Theme
~~~~~~~~~~~~~~~~~~~~~~~~
This theme extends the PyData-Sphinx-Theme theme and can be configured by
following the directions at `PyData Theme Configuration`_.

The PyAnsys Sphinx also theme includes extra configuration parameters, including
a top of page "breadcrumb" link tree that can be helpful when navigating
documentation. This webpage uses the following configuration:

.. code:: python

html_title = 'PyAnsys Sphinx Theme'

html_theme_options = {
"show_breadcrumbs": True,
"additional_breadcrumbs": [('PyAnsys', 'https://docs.pyansys.com')],
}

This provides links back to the main PyAnsys documentation page at
`docs.pyansys.com <https://docs.pyansys.com>`_ while also providing the reader
with a clear location of where they are within the documentation. Note that the
title of the project should be configured with ``html_title`` as the default
html title may be less than ideal.


Example Configuration
~~~~~~~~~~~~~~~~~~~~~

This theme uses the following configuration found at `conf.py <https://github.com/pyansys/pyansys-sphinx-theme/blob/main/doc/source/conf.py>`_:

.. literalinclude:: ./conf.py
:language: python

:language: python

For additional configuration options, see `Configuring The PyData
Sphinx Theme
<https://pydata-sphinx-theme.readthedocs.io/en/latest/user_guide/configuring.html>`_,
which forms the basis for the style of this theme.
For additional configuration options, see `PyData Theme Configuration`_.


Editing the CSS
Expand Down Expand Up @@ -55,3 +81,6 @@ Next, add the following to ``conf.py``:
html_css_files = ['css/custom.css']

This way you can override the CSS style of this theme.


.. _PyData Theme Configuration: https://pydata-sphinx-theme.readthedocs.io/en/v0.4.2/user_guide/configuring.html
37 changes: 37 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
{
"name": "pyansys_sphinx_theme",
"repository": "https://github.com/pyansys/pyansys-sphinx-theme",
"scripts": {
"build": "webpack"
},
"devDependencies": {
"clean-webpack-plugin": "^3.0.0",
"copy-webpack-plugin": "^5.1.1",
"css-loader": "^3.4.2",
"dedent": "^0.7.0",
"extract-loader": "^4.0.3",
"file-loader": "^5.0.2",
"html-webpack-plugin": "^4.3.0",
"imports-loader": "^0.8.0",
"mini-css-extract-plugin": "^0.9.0",
"node-sass": "^6.0.1",
"optimize-css-assets-webpack-plugin": "^5.0.3",
"pa11y-ci": "^2.4.0",
"pa11y-ci-reporter-html": "^2.1.2",
"sass-loader": "^10.1.1",
"style-loader": "^1.1.3",
"webpack": "^4.41.6",
"webpack-cli": "^3.3.11",
"webpack-dev-server": "^3.10.3",
"webpack-merge": "^4.2.2",
"webpack-shell-plugin": "^0.5.0",
"webpack-watch-files-plugin": "^1.0.3"
},
"dependencies": {
"@fortawesome/fontawesome-free": "5.13.0",
"bootstrap": "^4.4.1",
"jquery": "3.5.1",
"optimize-css-assets-webpack-plugin": "^5.0.3",
"popper.js": "^1.16.1"
}
}
37 changes: 0 additions & 37 deletions pyansys_sphinx_theme/__init__.py

This file was deleted.

Loading