Skip to content

Commit

Permalink
Merge pull request ipython#302 from willingc/doc-update
Browse files Browse the repository at this point in the history
Refresh sphinx docs
  • Loading branch information
minrk committed Sep 6, 2016
2 parents 697318c + 07ce73a commit 82f53e7
Show file tree
Hide file tree
Showing 6 changed files with 92 additions and 2 deletions.
59 changes: 59 additions & 0 deletions docs/README_DOC.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
# Documenting traitlets

[Documentation for `traitlets`](https://traitlets.readthedocs.io/en/latest/)
is hosted on ReadTheDocs.

## Build Documentation locally

1. Change directory to documentation root:

$ cd docs

2. Create environment

- [**conda**] Create conda env (and install relevant dependencies):

$ conda env create -f environment.yml

- [**pip**] Create virtual environment (and install relevant dependencies):

$ virtualenv traitlets_docs -p python3
$ pip install -r requirements.txt


3. Activate the newly built environment `traitlets_docs`

- [**conda**] Activate conda env:

$ source activate traitlets_docs

- [**pip**] The virtualenv should have been automatically activated. If
not:

$ source activate

4. Build documentation using Makefile for Linux and OS X:

$ make html

or on Windows:

$ make.bat html

5. Display the documentation locally by navigating to
``build/html/index.html`` in your browser:

Or alternatively you may run a local server to display
the docs. In Python 3:

$ python -m http.server 8000

In your browser, go to `http://localhost:8000`.

## Developing Documentation

### Helpful files and directories

* `source/conf.py` - Sphinx build configuration file
* `source` directory - source for documentation
* `source/index.rst` - Main landing page of the Sphinx documentation
9 changes: 9 additions & 0 deletions docs/environment.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
name: traitlets
channels:
- conda-forge
- conda
dependencies:
- python=3
- ipython-genutils
- sphinx
- sphinx_rtd_theme
5 changes: 4 additions & 1 deletion docs/requirements.txt
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
ipython_genutils
ipython-genutils
Sphinx
sphinx-rtd-theme
-e ../.
10 changes: 10 additions & 0 deletions docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -313,3 +313,13 @@

# Example configuration for intersphinx: refer to the Python standard library.
intersphinx_mapping = {'https://docs.python.org/': None}

# Read The Docs
# on_rtd is whether we are on readthedocs.org, this line of code grabbed from docs.readthedocs.org
on_rtd = os.environ.get('READTHEDOCS', None) == 'True'

if not on_rtd: # only import and set the theme if we're building docs locally
import sphinx_rtd_theme
html_theme = 'sphinx_rtd_theme'
html_theme_path = [sphinx_rtd_theme.get_html_theme_path()]
# otherwise, readthedocs.org uses their theme by default, so no need to specify it
9 changes: 9 additions & 0 deletions readthedocs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
conda:
file: docs/environment.yml
python:
version: 3
setup_py_install: true
pip install: true
formats:
- epub
- pdf
2 changes: 1 addition & 1 deletion traitlets/traitlets.py
Original file line number Diff line number Diff line change
Expand Up @@ -839,7 +839,7 @@ def validate(*names):
the registered cross validator could potentially make changes to attributes
of the ``HasTraits`` instance. However, we recommend not to do so. The reason
is that the cross-validation of attributes may run in arbitrary order when
exiting the ``hold_trait_notifications` context, and such changes may not
exiting the ``hold_trait_notifications`` context, and such changes may not
commute.
"""
if not names:
Expand Down

0 comments on commit 82f53e7

Please sign in to comment.