Skip to content

Added scipy sphinx theme and first notebook. #1

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

Closed
wants to merge 1 commit 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
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule "scipy-sphinx-theme"]
path = scipy-sphinx-theme
url = https://github.com/scipy/scipy-sphinx-theme.git
20 changes: 20 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Minimal makefile for Sphinx documentation
#

# You can set these variables from the command line, and also
# from the environment for the first two.
SPHINXOPTS ?=
SPHINXBUILD ?= sphinx-build
SOURCEDIR = .
BUILDDIR = _build

# Put it first so that "make" without argument is like "make help".
help:
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)

.PHONY: help Makefile

# Catch-all target: route all unknown targets to Sphinx using the new
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
%: Makefile
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
Binary file added _static/numpy_logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
12 changes: 12 additions & 0 deletions _templates/customsidebar.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<h3>Contents</h3>
{% set toctree = toctree(maxdepth=3, collapse=False, includehidden=True) %}

{{ toctree }}

<h3>Source</h3>

<a href="{{ sourcename | replace("notebooks/", "") }}">Download .ipynb file</a>

<br>

{{ globaltoc }}
5 changes: 5 additions & 0 deletions _templates/indexsidebar.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<h3>Resources</h3>
<ul>
<li><a href="https://numpy.org/">NumPy.org website</a></li>
<li><a href="https://scipy.org/">Scipy.org website</a></li>
</ul>
30 changes: 30 additions & 0 deletions _templates/layout.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
{% extends "!layout.html" %}

{%- block header %}
<div class="container">
<div class="top-scipy-org-logo-header" style="background-color: #a2bae8;">
<a href="{{ pathto('index') }}">
<img border=0 alt="NumPy" src="{{ pathto('_static/numpy_logo.png', 1) }}"></a>
</div>
</div>
</div>
{% endblock %}

{% block rootrellink %}
{% if pagename != 'index' %}
<li class="active"><a href="{{ pathto('index') }}">{{ shorttitle|e }}</a></li>
{% endif %}
{% endblock %}

{% block sidebarsearch %}
{%- if sourcename %}
<ul class="this-page-menu">
{%- if 'reference/generated' in sourcename %}
<li><a href="/numpy/docs/{{ sourcename.replace('reference/generated/', '').replace('.txt', '') |e }}">{{_('Edit page')}}</a></li>
{%- else %}
<li><a href="/numpy/docs/numpy-docs/{{ sourcename.replace('.txt', '.rst') |e }}">{{_('Edit page')}}</a></li>
{%- endif %}
</ul>
{%- endif %}
{{ super() }}
{% endblock %}
116 changes: 116 additions & 0 deletions conf.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
# Configuration file for the Sphinx documentation builder.
#
# This file only contains a selection of the most common options. For a full
# list see the documentation:
# https://www.sphinx-doc.org/en/master/usage/configuration.html

# -- Path setup --------------------------------------------------------------

# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here.
#
import os
import re

# -- Project information -----------------------------------------------------

project = 'NumPy Tutorials'
copyright = '2008-2020, The SciPy community'

# The default replacements for |version| and |release|, also used in various
# other places throughout the built documents.
#
import numpy
# The short X.Y version (including .devXXXX, rcX, b1 suffixes if present)
version = re.sub(r'(\d+\.\d+)\.\d+(.*)', r'\1\2', numpy.__version__)
version = re.sub(r'(\.dev\d+).*?$', r'\1', version)
# The full version, including alpha/beta/rc tags.
release = numpy.__version__
print("%s %s" % (version, release))

# -- General configuration ---------------------------------------------------

# Add any Sphinx extension module names here, as strings. They can be
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
# ones.
extensions = [
'nbsphinx',
'numpydoc',
'matplotlib.sphinxext.plot_directive',
]

# Add any paths that contain templates here, relative to this directory.
templates_path = ['_templates']

# List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files.
# This pattern also affects html_static_path and html_extra_path.
exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store', 'scipy-sphinx-theme']

master_doc = 'index'

# -- Options for HTML output -------------------------------------------------

# The theme to use for HTML and HTML Help pages. See the documentation for
# a list of builtin themes.
#

# Add any paths that contain custom static files (such as style sheets) here,
# relative to this directory. They are copied after the builtin static files,
# so a file named "default.css" will overwrite the builtin "default.css".
html_static_path = ['_static']

themedir = os.path.join('scipy-sphinx-theme', '_theme')
if not os.path.isdir(themedir):
raise RuntimeError("Get the scipy-sphinx-theme first, "
"via git submodule init && git submodule update")

html_theme = 'scipy'
html_theme_path = [themedir]

if 'scipyorg' in tags:
# Build for the scipy.org website
html_theme_options = {
"edit_link": True,
"sidebar": "right",
"scipy_org_logo": True,
"rootlinks": [("https://scipy.org/", "Scipy.org"),
("https://docs.scipy.org/", "Docs")]
}
else:
# Default build
html_theme_options = {
"edit_link": False,
"sidebar": "left",
"scipy_org_logo": False,
"rootlinks": [("https://numpy.org/", "NumPy.org"),
("https://numpy.org/doc", "Docs"),
]
}
html_sidebars = {'index': ['indexsidebar.html', 'searchbox.html'],
'**': ['customsidebar.html', 'globaltoc.html']}

#html_additional_pages = {
# 'index': 'indexcontent.html',
#}

html_title = "%s" % project
html_static_path = ['_static']
html_last_updated_fmt = '%b %d, %Y'

#html_use_modindex = True
html_copy_source = True
html_domain_indices = False
html_file_suffix = '.html'
html_sourcelink_suffix = '.ipynb'

htmlhelp_basename = 'numpy'

if 'sphinx.ext.pngmath' in extensions:
pngmath_use_preview = True
pngmath_dvipng_args = ['-gamma', '1.5', '-D', '96', '-bg', 'Transparent']

plot_html_show_formats = False
plot_html_show_source_link = False

32 changes: 32 additions & 0 deletions index.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
.. numpy-tutorials documentation master file, created by
sphinx-quickstart on Thu May 7 18:15:01 2020.
You can adapt this file completely to your liking, but it should at least
contain the root `toctree` directive.

NumPy Tutorials
===============

The goal of this repository is to provide high-quality resources by the NumPy project, both for self-learning and for teaching classes with.

This set of tutorials and educational materials is being developed, IT IS NOT YET INTEGRATED IN THE HTML DOCS AT https://www.numpy.org/devdocs/

You can contribute by submitting a Pull Request on GitHub with your Jupyter Notebook file.

Resources
---------

- NumPy
- NumPy Documentation Team
- Code of Conduct
- Contributor Guide
- NEP 44

Tutorials
=========

All tutorials are downloadable as ``.ipynb`` files.

.. toctree::
:maxdepth: 1

notebooks/tutorial-svd
35 changes: 35 additions & 0 deletions make.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
@ECHO OFF

pushd %~dp0

REM Command file for Sphinx documentation

if "%SPHINXBUILD%" == "" (
set SPHINXBUILD=sphinx-build
)
set SOURCEDIR=.
set BUILDDIR=_build

if "%1" == "" goto help

%SPHINXBUILD% >NUL 2>NUL
if errorlevel 9009 (
echo.
echo.The 'sphinx-build' command was not found. Make sure you have Sphinx
echo.installed, then set the SPHINXBUILD environment variable to point
echo.to the full path of the 'sphinx-build' executable. Alternatively you
echo.may add the Sphinx directory to PATH.
echo.
echo.If you don't have Sphinx installed, grab it from
echo.http://sphinx-doc.org/
exit /b 1
)

%SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%
goto end

:help
%SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%

:end
popd
1,070 changes: 1,070 additions & 0 deletions notebooks/.ipynb_checkpoints/tutorial-svd-checkpoint.ipynb

Large diffs are not rendered by default.

1,070 changes: 1,070 additions & 0 deletions notebooks/tutorial-svd.ipynb

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions scipy-sphinx-theme
Submodule scipy-sphinx-theme added at b15a88