Skip to content

Commit c38b42e

Browse files
authored
Merge pull request #83 from franchuterivera/refactor_development_docs
Refactor development docs
2 parents 4bf86b0 + 086ffc7 commit c38b42e

24 files changed

+917
-469
lines changed

.binder/apt.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
build-essential
2+
swig

.binder/postBuild

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
#!/bin/bash
2+
3+
set -e
4+
5+
python -m pip install .[docs,examples]
6+
7+
# Taken from https://github.com/scikit-learn/scikit-learn/blob/22cd233e1932457947e9994285dc7fd4e93881e4/.binder/postBuild
8+
# under BSD3 license, copyright the scikit-learn contributors
9+
10+
# This script is called in a binder context. When this script is called, we are
11+
# inside a git checkout of the automl/Auto-PyTorch repo. This script
12+
# generates notebooks from the Auto-PyTorch python examples.
13+
14+
if [[ ! -f /.dockerenv ]]; then
15+
echo "This script was written for repo2docker and is supposed to run inside a docker container."
16+
echo "Exiting because this script can delete data if run outside of a docker container."
17+
exit 1
18+
fi
19+
20+
# Copy content we need from the Auto-PyTorch repo
21+
TMP_CONTENT_DIR=/tmp/Auto-PyTorch
22+
mkdir -p $TMP_CONTENT_DIR
23+
cp -r examples .binder $TMP_CONTENT_DIR
24+
# delete everything in current directory including dot files and dot folders
25+
find . -delete
26+
27+
# Generate notebooks and remove other files from examples folder
28+
GENERATED_NOTEBOOKS_DIR=examples
29+
cp -r $TMP_CONTENT_DIR/examples $GENERATED_NOTEBOOKS_DIR
30+
31+
find $GENERATED_NOTEBOOKS_DIR -name 'example_*.py' -exec sphx_glr_python_to_jupyter.py '{}' +
32+
# Keep __init__.py and custom_metrics.py
33+
NON_NOTEBOOKS=$(find $GENERATED_NOTEBOOKS_DIR -type f | grep -v '\.ipynb' | grep -v 'init' | grep -v 'custom_metrics')
34+
rm -f $NON_NOTEBOOKS
35+
36+
# Modify path to be consistent by the path given by sphinx-gallery
37+
mkdir notebooks
38+
mv $GENERATED_NOTEBOOKS_DIR notebooks/
39+
40+
# Put the .binder folder back (may be useful for debugging purposes)
41+
mv $TMP_CONTENT_DIR/.binder .
42+
# Final clean up
43+
rm -rf $TMP_CONTENT_DIR

.binder/requirements.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
-r ../requirements.txt

.github/workflows/docs.yml

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
name: Docs
2+
on: [pull_request, push]
3+
4+
jobs:
5+
build-and-deploy:
6+
runs-on: ubuntu-18.04
7+
steps:
8+
- uses: actions/checkout@v2
9+
- name: Setup Python
10+
uses: actions/setup-python@v2
11+
with:
12+
python-version: 3.8
13+
- name: Install dependencies
14+
run: |
15+
pip install -e .[docs,examples]
16+
- name: Make docs
17+
run: |
18+
cd docs
19+
make html
20+
- name: Pull latest gh-pages
21+
if: (contains(github.ref, 'develop') || contains(github.ref, 'master')) && github.event_name == 'push'
22+
run: |
23+
cd ..
24+
git clone https://github.com/automl/Auto-PyTorch.git --branch gh-pages --single-branch gh-pages
25+
- name: Copy new doc into gh-pages
26+
if: (contains(github.ref, 'develop') || contains(github.ref, 'master')) && github.event_name == 'push'
27+
run: |
28+
branch_name=${GITHUB_REF##*/}
29+
cd ../gh-pages
30+
rm -rf $branch_name
31+
cp -r ../Auto-PyTorch/docs/build/html $branch_name
32+
- name: Push to gh-pages
33+
if: (contains(github.ref, 'develop') || contains(github.ref, 'master')) && github.event_name == 'push'
34+
run: |
35+
last_commit=$(git log --pretty=format:"%an: %s")
36+
cd ../gh-pages
37+
branch_name=${GITHUB_REF##*/}
38+
git add $branch_name/
39+
git config --global user.name 'Github Actions'
40+
git config --global user.email 'not@mail.com'
41+
git remote set-url origin https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}
42+
git commit -am "$last_commit"
43+
git push

README.md

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2,33 +2,36 @@
22

33
Copyright (C) 2019 [AutoML Group Freiburg](http://www.automl.org/)
44

5-
This an alpha version of Auto-PyTorch.
6-
So far, Auto-PyTorch supports tabular data (classification, regression), image data (classification) and time-series data (TODO).
5+
This an alpha version of Auto-PyTorch with improved API.
6+
So far, Auto-PyTorch supports tabular data (classification, regression).
7+
We plan to enable image data and time-series data.
8+
9+
10+
Find the documentation [here](https://automl.github.io/Auto-PyTorch/refactor_development)
711

812

913
## Installation
1014

1115
### Pip
12-
```sh
13-
$ pip install autoPyTorch
14-
```
1516

16-
### Manually
17+
We recommend using Anaconda for developing as follows:
18+
1719
```sh
18-
$ cd install/path
19-
$ git clone https://github.com/automl/Auto-PyTorch.git
20-
$ cd Auto-PyTorch
21-
$ cat requirements.txt | xargs -n 1 -L 1 pip install
22-
$ python setup.py install
23-
```
20+
# Following commands assume the user is in a cloned directory of Auto-Pytorch
21+
conda create -n autopytorch python=3.8
22+
conda activate autopytorch
23+
conda install gxx_linux-64 gcc_linux-64 swig
24+
cat requirements.txt | xargs -n 1 -L 1 pip install
25+
python setup.py install
2426

27+
```
2528

2629
## Contributing
2730

2831
If you want to contribute to Auto-PyTorch, clone the repository and checkout our current development branch
2932

3033
```sh
31-
$ git checkout development
34+
$ git checkout refactor_development
3235
```
3336

3437

autoPyTorch/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
from autoPyTorch.__version__ import __version__ # noqa (imported but unused)

autoPyTorch/__version__.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
"""Version information."""
2+
3+
# The following line *must* be the last in the module, exactly as formatted:
4+
__version__ = "0.0.3"

docs/Makefile

Lines changed: 182 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,182 @@
1+
# Makefile for Sphinx documentation
2+
#
3+
4+
# You can set these variables from the command line.
5+
SPHINXOPTS =
6+
SPHINXBUILD = sphinx-build
7+
PAPER =
8+
BUILDDIR = build
9+
10+
# User-friendly check for sphinx-build
11+
ifeq ($(shell which $(SPHINXBUILD) >/dev/null 2>&1; echo $$?), 1)
12+
$(error The '$(SPHINXBUILD)' command was not found. Make sure you have Sphinx installed, then set the SPHINXBUILD environment variable to point to the full path of the '$(SPHINXBUILD)' executable. Alternatively you can add the directory with the executable to your PATH. If you don't have Sphinx installed, grab it from http://sphinx-doc.org/)
13+
endif
14+
15+
# Internal variables.
16+
PAPEROPT_a4 = -D latex_paper_size=a4
17+
PAPEROPT_letter = -D latex_paper_size=letter
18+
ALLSPHINXOPTS = -d $(BUILDDIR)/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) .
19+
# the i18n builder cannot share the environment and doctrees with the others
20+
I18NSPHINXOPTS = $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) .
21+
22+
.PHONY: help clean html dirhtml singlehtml pickle json htmlhelp qthelp devhelp epub latex latexpdf text man changes linkcheck doctest gettext
23+
24+
all: html
25+
26+
help:
27+
@echo "Please use \`make <target>' where <target> is one of"
28+
@echo " html to make standalone HTML files"
29+
@echo " dirhtml to make HTML files named index.html in directories"
30+
@echo " singlehtml to make a single large HTML file"
31+
@echo " pickle to make pickle files"
32+
@echo " json to make JSON files"
33+
@echo " htmlhelp to make HTML files and a HTML help project"
34+
@echo " qthelp to make HTML files and a qthelp project"
35+
@echo " devhelp to make HTML files and a Devhelp project"
36+
@echo " epub to make an epub"
37+
@echo " latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter"
38+
@echo " latexpdf to make LaTeX files and run them through pdflatex"
39+
@echo " latexpdfja to make LaTeX files and run them through platex/dvipdfmx"
40+
@echo " text to make text files"
41+
@echo " man to make manual pages"
42+
@echo " texinfo to make Texinfo files"
43+
@echo " info to make Texinfo files and run them through makeinfo"
44+
@echo " gettext to make PO message catalogs"
45+
@echo " changes to make an overview of all changed/added/deprecated items"
46+
@echo " xml to make Docutils-native XML files"
47+
@echo " pseudoxml to make pseudoxml-XML files for display purposes"
48+
@echo " linkcheck to check all external links for integrity"
49+
@echo " doctest to run all doctests embedded in the documentation (if enabled)"
50+
51+
clean:
52+
rm -rf $(BUILDDIR)/*
53+
rm -rf generated
54+
rm -rf examples/
55+
rm -rf gen_modules/
56+
57+
html:
58+
$(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html
59+
@echo
60+
@echo "Build finished. The HTML pages are in $(BUILDDIR)/html."
61+
62+
dirhtml:
63+
$(SPHINXBUILD) -b dirhtml $(ALLSPHINXOPTS) $(BUILDDIR)/dirhtml
64+
@echo
65+
@echo "Build finished. The HTML pages are in $(BUILDDIR)/dirhtml."
66+
67+
singlehtml:
68+
$(SPHINXBUILD) -b singlehtml $(ALLSPHINXOPTS) $(BUILDDIR)/singlehtml
69+
@echo
70+
@echo "Build finished. The HTML page is in $(BUILDDIR)/singlehtml."
71+
72+
pickle:
73+
$(SPHINXBUILD) -b pickle $(ALLSPHINXOPTS) $(BUILDDIR)/pickle
74+
@echo
75+
@echo "Build finished; now you can process the pickle files."
76+
77+
json:
78+
$(SPHINXBUILD) -b json $(ALLSPHINXOPTS) $(BUILDDIR)/json
79+
@echo
80+
@echo "Build finished; now you can process the JSON files."
81+
82+
htmlhelp:
83+
$(SPHINXBUILD) -b htmlhelp $(ALLSPHINXOPTS) $(BUILDDIR)/htmlhelp
84+
@echo
85+
@echo "Build finished; now you can run HTML Help Workshop with the" \
86+
".hhp project file in $(BUILDDIR)/htmlhelp."
87+
88+
qthelp:
89+
$(SPHINXBUILD) -b qthelp $(ALLSPHINXOPTS) $(BUILDDIR)/qthelp
90+
@echo
91+
@echo "Build finished; now you can run "qcollectiongenerator" with the" \
92+
".qhcp project file in $(BUILDDIR)/qthelp, like this:"
93+
@echo "# qcollectiongenerator $(BUILDDIR)/qthelp/AutoPyTorch.qhcp"
94+
@echo "To view the help file:"
95+
@echo "# assistant -collectionFile $(BUILDDIR)/qthelp/AutoPyTorch.qhc"
96+
97+
devhelp:
98+
$(SPHINXBUILD) -b devhelp $(ALLSPHINXOPTS) $(BUILDDIR)/devhelp
99+
@echo
100+
@echo "Build finished."
101+
@echo "To view the help file:"
102+
@echo "# mkdir -p $$HOME/.local/share/devhelp/AutoPyTorch"
103+
@echo "# ln -s $(BUILDDIR)/devhelp $$HOME/.local/share/devhelp/AutoPyTorch"
104+
@echo "# devhelp"
105+
106+
epub:
107+
$(SPHINXBUILD) -b epub $(ALLSPHINXOPTS) $(BUILDDIR)/epub
108+
@echo
109+
@echo "Build finished. The epub file is in $(BUILDDIR)/epub."
110+
111+
latex:
112+
$(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
113+
@echo
114+
@echo "Build finished; the LaTeX files are in $(BUILDDIR)/latex."
115+
@echo "Run \`make' in that directory to run these through (pdf)latex" \
116+
"(use \`make latexpdf' here to do that automatically)."
117+
118+
latexpdf:
119+
$(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
120+
@echo "Running LaTeX files through pdflatex..."
121+
$(MAKE) -C $(BUILDDIR)/latex all-pdf
122+
@echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex."
123+
124+
latexpdfja:
125+
$(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
126+
@echo "Running LaTeX files through platex and dvipdfmx..."
127+
$(MAKE) -C $(BUILDDIR)/latex all-pdf-ja
128+
@echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex."
129+
130+
text:
131+
$(SPHINXBUILD) -b text $(ALLSPHINXOPTS) $(BUILDDIR)/text
132+
@echo
133+
@echo "Build finished. The text files are in $(BUILDDIR)/text."
134+
135+
man:
136+
$(SPHINXBUILD) -b man $(ALLSPHINXOPTS) $(BUILDDIR)/man
137+
@echo
138+
@echo "Build finished. The manual pages are in $(BUILDDIR)/man."
139+
140+
texinfo:
141+
$(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo
142+
@echo
143+
@echo "Build finished. The Texinfo files are in $(BUILDDIR)/texinfo."
144+
@echo "Run \`make' in that directory to run these through makeinfo" \
145+
"(use \`make info' here to do that automatically)."
146+
147+
info:
148+
$(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo
149+
@echo "Running Texinfo files through makeinfo..."
150+
make -C $(BUILDDIR)/texinfo info
151+
@echo "makeinfo finished; the Info files are in $(BUILDDIR)/texinfo."
152+
153+
gettext:
154+
$(SPHINXBUILD) -b gettext $(I18NSPHINXOPTS) $(BUILDDIR)/locale
155+
@echo
156+
@echo "Build finished. The message catalogs are in $(BUILDDIR)/locale."
157+
158+
changes:
159+
$(SPHINXBUILD) -b changes $(ALLSPHINXOPTS) $(BUILDDIR)/changes
160+
@echo
161+
@echo "The overview file is in $(BUILDDIR)/changes."
162+
163+
linkcheck:
164+
$(SPHINXBUILD) -b linkcheck $(ALLSPHINXOPTS) $(BUILDDIR)/linkcheck
165+
@echo
166+
@echo "Link check complete; look for any errors in the above output " \
167+
"or in $(BUILDDIR)/linkcheck/output.txt."
168+
169+
doctest:
170+
$(SPHINXBUILD) -b doctest $(ALLSPHINXOPTS) $(BUILDDIR)/doctest
171+
@echo "Testing of doctests in the sources finished, look at the " \
172+
"results in $(BUILDDIR)/doctest/output.txt."
173+
174+
xml:
175+
$(SPHINXBUILD) -b xml $(ALLSPHINXOPTS) $(BUILDDIR)/xml
176+
@echo
177+
@echo "Build finished. The XML files are in $(BUILDDIR)/xml."
178+
179+
pseudoxml:
180+
$(SPHINXBUILD) -b pseudoxml $(ALLSPHINXOPTS) $(BUILDDIR)/pseudoxml
181+
@echo
182+
@echo "Build finished. The pseudo-XML files are in $(BUILDDIR)/pseudoxml."

docs/_templates/class.rst

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
:mod:`{{module}}`.{{objname}}
2+
{{ underline }}==============
3+
4+
.. currentmodule:: {{ module }}
5+
6+
.. autoclass:: {{ objname }}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
:mod:`{{module}}`.{{objname}}
2+
{{ underline }}==============
3+
4+
.. currentmodule:: {{ module }}
5+
6+
.. autoclass:: {{ objname }}
7+
8+
.. include:: {{module}}.{{objname}}.examples
9+
10+
.. raw:: html
11+
12+
<div class="clearer"></div>

docs/_templates/function.rst

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
:mod:`{{module}}`.{{objname}}
2+
{{ underline }}====================
3+
4+
.. currentmodule:: {{ module }}
5+
6+
.. autofunction:: {{ objname }}
7+
8+
.. raw:: html
9+
10+
<div class="clearer"></div>

docs/_templates/layout.html

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
{% extends "!layout.html" %}
2+
3+
{# Custom CSS overrides #}
4+
{# set bootswatch_css_custom = ['_static/my-styles.css'] #}
5+
6+
{# Add github banner (from: https://github.com/blog/273-github-ribbons). #}
7+
{% block header %}
8+
{{ super() }}
9+
<a href="https://github.com/automl/Auto-PyTorch"
10+
class="visible-desktop hidden-xs"><img
11+
id="gh-banner"
12+
style="position: absolute; top: 50px; right: 0; border: 0;"
13+
src="https://s3.amazonaws.com/github/ribbons/forkme_right_red_aa0000.png"
14+
alt="Fork me on GitHub"></a>
15+
<script>
16+
// Adjust banner height.
17+
$(function () {
18+
var navHeight = $(".navbar .container").css("height");
19+
$("#gh-banner").css("top", navHeight);
20+
});
21+
</script>
22+
{% endblock %}
23+

0 commit comments

Comments
 (0)