-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Also: * Move tabulate records code to standalone functions (fixes #27) * Move `get_cache` to top level and `cli/utils.py` to `utils.py` (improves access and fixes #29) * Create .readthedocs.yml * Add PyPi deployment
- Loading branch information
1 parent
14f7a90
commit 4558db8
Showing
30 changed files
with
1,924 additions
and
84 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
version: 2 | ||
jobs: | ||
build_docs: | ||
docker: | ||
- image: circleci/python:3.6-stretch | ||
steps: | ||
# Get our data and merge with upstream | ||
- run: sudo apt-get update | ||
- checkout | ||
|
||
- restore_cache: | ||
keys: | ||
- cache-pip | ||
- run: | | ||
pip install --user -e .[rtd] | ||
pip install -r docs/requirements.txt | ||
- save_cache: | ||
key: cache-pip | ||
paths: | ||
- ~/.cache/pip | ||
|
||
# Build the docs | ||
- run: | ||
name: Build docs to store | ||
command: | | ||
cd docs | ||
make html-strict | ||
- store_artifacts: | ||
path: docs/_build/html/ | ||
destination: html | ||
|
||
|
||
workflows: | ||
version: 2 | ||
default: | ||
jobs: | ||
- build_docs |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
--- | ||
name: Documentation Improvements | ||
about: Suggest improvements to the documentation | ||
title: '' | ||
labels: documentation | ||
assignees: '' | ||
|
||
--- | ||
|
||
**Is your feature request related to a problem? Please describe.** | ||
A clear and concise description of what the problem is. Ex. This section is unclear [...] | ||
|
||
**Describe the solution you'd like** | ||
A clear and concise description of what you want to happen. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
version: 2 | ||
|
||
python: | ||
version: 3 | ||
install: | ||
- method: pip | ||
path: . | ||
extra_requirements: | ||
- rtd | ||
- requirements: docs/requirements.txt |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
_build/ | ||
_api/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
# 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) | ||
|
||
# raise warnings to errors | ||
html-strict: | ||
@$(SPHINXBUILD) -b html -nW --keep-going "$(SOURCEDIR)" "$(BUILDDIR)/html" $(SPHINXOPTS) $(O) | ||
|
||
clean: | ||
rm -r $(BUILDDIR) |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
# 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 sys | ||
# sys.path.insert(0, os.path.abspath('.')) | ||
|
||
|
||
# -- Project information ----------------------------------------------------- | ||
|
||
project = "Jupyter Cache" | ||
copyright = "2020, Executable Book Project" | ||
author = "Executable Book Project" | ||
|
||
master_doc = "index" | ||
|
||
# -- 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 = [ | ||
"myst_parser", | ||
"myst_nb", | ||
"sphinx.ext.intersphinx", | ||
"sphinx_copybutton", | ||
# "sphinx.ext.autodoc", | ||
# "sphinx.ext.viewcode", | ||
] | ||
|
||
# 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", | ||
"**/example_nbs/*", | ||
"**/.jupyter_cache/**/*", | ||
] | ||
|
||
|
||
# -- Options for HTML output ------------------------------------------------- | ||
|
||
# The theme to use for HTML and HTML Help pages. See the documentation for | ||
# a list of builtin themes. | ||
# | ||
html_theme = "pandas_sphinx_theme" | ||
html_logo = "_static/logo.jpg" | ||
|
||
# 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"] | ||
|
||
|
||
intersphinx_mapping = {"python": ("https://docs.python.org/3.7", None)} | ||
autodoc_member_order = "bysource" | ||
|
||
nitpick_ignore = [ | ||
("py:class", "Any"), | ||
("py:class", "Tuple"), | ||
("py:class", "ForwardRef"), | ||
("py:class", "NoneType"), | ||
] | ||
|
||
|
||
def setup(app): | ||
"""Add functions to the Sphinx setup.""" | ||
# app.connect("builder-inited", run_apidoc) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
# Contributing | ||
|
||
[![CI Status][travis-badge]][travis-link] | ||
[![Coverage][coveralls-badge]][coveralls-link] | ||
[![Code style: black][black-badge]][black-link] | ||
[![CircleCI][circleci-badge]][circleci-link] | ||
[![Documentation Status][rtd-badge]][rtd-link] | ||
|
||
## Code Style | ||
|
||
Code style is tested using [flake8](http://flake8.pycqa.org), | ||
with the configuration set in `.flake8`, | ||
and code formatted with [black](https://github.com/ambv/black). | ||
|
||
Installing with `jupyter-cache[code_style]` makes the [pre-commit](https://pre-commit.com/) | ||
package available, which will ensure this style is met before commits are submitted, by reformatting the code | ||
and testing for lint errors. | ||
It can be setup by: | ||
|
||
```shell | ||
>> cd jupyter-cache | ||
>> pre-commit install | ||
``` | ||
|
||
Optionally you can run `black` and `flake8` separately: | ||
|
||
```shell | ||
>> black . | ||
>> flake8 . | ||
``` | ||
|
||
Editors like VS Code also have automatic code reformat utilities, which can adhere to this standard. | ||
|
||
All functions and class methods should be annotated with types and include a docstring. The prefered docstring format is outlined in `jupyter-cache/docstring.fmt.mustache` and can be used automatically with the | ||
[autodocstring] VS Code extension. | ||
|
||
## Testing | ||
|
||
For code tests: | ||
|
||
```shell | ||
>> cd jupyter-cache | ||
>> pytest | ||
``` | ||
|
||
For documentation build tests: | ||
|
||
```shell | ||
>> cd jupyter-cache/docs | ||
>> make clean | ||
>> make html-strict | ||
``` | ||
|
||
## Pull Requests | ||
|
||
To contribute, make Pull Requests to the `master` branch (this is the default branch). A PR can consist of one or multiple commits. Before you open a PR, make sure to clean up your commit history and create the commits that you think best divide up the total work as outlined above (use `git rebase` and `git commit --amend`). Ensure all commit messages clearly summarise the changes in the header and the problem that this commit is solving in the body. | ||
|
||
Merging pull requests: There are three ways of 'merging' pull requests on GitHub: | ||
|
||
- Squash and merge: take all commits, squash them into a single one and put it on top of the base branch. | ||
Choose this for pull requests that address a single issue and are well represented by a single commit. | ||
Make sure to clean the commit message (title & body) | ||
- Rebase and merge: take all commits and 'recreate' them on top of the base branch. All commits will be recreated with new hashes. | ||
Choose this for pull requests that require more than a single commit. | ||
Examples: PRs that contain multiple commits with individually significant changes; PRs that have commits from different authors (squashing commits would remove attribution) | ||
- Merge with merge commit: put all commits as they are on the base branch, with a merge commit on top | ||
Choose for collaborative PRs with many commits. Here, the merge commit provides actual benefits. | ||
|
||
[travis-badge]: https://travis-ci.org/ExecutableBookProject/jupyter-cache.svg?branch=master | ||
[travis-link]: https://travis-ci.org/ExecutableBookProject/jupyter-cache | ||
[coveralls-badge]: https://coveralls.io/repos/github/ExecutableBookProject/jupyter-cache/badge.svg?branch=master | ||
[coveralls-link]: https://coveralls.io/github/ExecutableBookProject/jupyter-cache?branch=master | ||
[circleci-badge]: https://circleci.com/gh/ExecutableBookProject/jupyter-cache.svg?style=shield | ||
[circleci-link]: https://circleci.com/gh/ExecutableBookProject/jupyter-cache | ||
[rtd-badge]: https://readthedocs.org/projects/jupyter-cache/badge/?version=latest | ||
[rtd-link]: https://jupyter-cache.readthedocs.io/en/latest/?badge=latest | ||
[black-badge]: https://img.shields.io/badge/code%20style-black-000000.svg | ||
[black-link]: https://github.com/ambv/black | ||
[autodocstring]: https://marketplace.visualstudio.com/items?itemName=njpwerner.autodocstring |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
# Jupyter Cache | ||
|
||
A defined interface for working with a cache of jupyter notebooks. | ||
|
||
```{warning} | ||
This project is in an alpha state. It may evolve rapidly and/or make breaking changes! | ||
Comments, requests, or bugreports are welcome and recommended! Please | ||
[open an issue here](https://github.com/ExecutableBookProject/jupyter-cache/issues) | ||
``` | ||
|
||
This packages provides a clear [API](use/api) and [CLI](use/cli) for staging, executing and cacheing | ||
Jupyter Notebooks. Although there are certainly other use cases, | ||
the principle use case this was written for is generating books / websites, | ||
created from multiple notebooks (and other text documents), | ||
during which it is desired that notebooks can be *auto-executed* **only** | ||
if the notebook had been modified in a way that may alter its code cell outputs. | ||
|
||
Some desired requirements (not yet all implemented): | ||
|
||
- A clear and robust API | ||
- The cache is persistent on disk | ||
- Notebook comparisons separate out "edits to content" from "edits to code cells". | ||
Cell rearranges and code cell changes should require a re-execution. | ||
Text content changes should not. | ||
- Allow parallel access to notebooks (for execution) | ||
- Store execution statistics/reports. | ||
- Store external assets: Notebooks being executed often require external assets: importing scripts/data/etc. These are prepared by the users. | ||
- Store execution artifacts: created during exeution | ||
- A transparent and robust cache invalidation: imagine the user updating an external dependency or a Python module, or checking out a different git branch. | ||
|
||
## Installation | ||
|
||
To install `jupytes-cache`, do the following: | ||
|
||
```bash | ||
pip install jupyter-cache[cli] | ||
``` | ||
|
||
For package development: | ||
|
||
```bash | ||
git clone https://github.com/ExecutableBookProject/jupyter-cache | ||
cd jupyter-cache | ||
git checkout develop | ||
pip install -e .[cli,code_style,testing,rtd] | ||
``` | ||
|
||
Here are the site contents: | ||
|
||
```{toctree} | ||
--- | ||
maxdepth: 2 | ||
caption: Contents | ||
--- | ||
using/cli.md | ||
using/api.ipynb | ||
develop/contributing.md | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
git+https://github.com/pandas-dev/pandas-sphinx-theme.git@master |
Oops, something went wrong.