Skip to content

Commit a7402c6

Browse files
committed
DOC: very basic hack to separate vbench project from main docs, generate chapters by module. Need some prettification, close #718
1 parent df54e85 commit a7402c6

File tree

11 files changed

+977
-13
lines changed

11 files changed

+977
-13
lines changed

doc/source/index.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -125,4 +125,4 @@ See the package overview for more detail about what's in the library.
125125
related
126126
comparison_with_r
127127
api
128-
vbench
128+

vb_suite/.gitignore

+4-1
Original file line numberDiff line numberDiff line change
@@ -1 +1,4 @@
1-
benchmarks.db
1+
benchmarks.db
2+
build/*
3+
source/vbench/*
4+
source/*.rst

vb_suite/attrs_caching.py

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
from vbench.benchmark import Benchmark
2+
3+
common_setup = """from pandas_vb_common import *
4+
"""
5+
6+
#----------------------------------------------------------------------
7+
# DataFrame.index / columns property lookup time
8+
9+
setup = common_setup + """
10+
df = DataFrame(np.random.randn(10, 6))
11+
cur_index = df.index
12+
"""
13+
stmt = "foo = df.index"
14+
15+
getattr_dataframe_index = Benchmark(stmt, setup,
16+
name="getattr_dataframe_index")
17+
18+
stmt = "df.index = cur_index"
19+
setattr_dataframe_index = Benchmark(stmt, setup,
20+
name="setattr_dataframe_index")

vb_suite/make.py

+108
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,108 @@
1+
#!/usr/bin/env python
2+
3+
"""
4+
Python script for building documentation.
5+
6+
To build the docs you must have all optional dependencies for statsmodels
7+
installed. See the installation instructions for a list of these.
8+
9+
Note: currently latex builds do not work because of table formats that are not
10+
supported in the latex generation.
11+
12+
Usage
13+
-----
14+
python make.py clean
15+
python make.py html
16+
"""
17+
18+
import glob
19+
import os
20+
import shutil
21+
import sys
22+
import sphinx
23+
24+
os.environ['PYTHONPATH'] = '..'
25+
26+
SPHINX_BUILD = 'sphinxbuild'
27+
28+
def sf():
29+
'push a copy to the sf site'
30+
os.system('cd build/html; rsync -avz . wesmckinn,[email protected]'
31+
':/home/groups/p/pa/pandas/htdocs/ -essh --cvs-exclude')
32+
def sfpdf():
33+
'push a copy to the sf site'
34+
os.system('cd build/latex; scp pandas.pdf wesmckinn,[email protected]'
35+
':/home/groups/p/pa/pandas/htdocs/')
36+
37+
def clean():
38+
if os.path.exists('build'):
39+
shutil.rmtree('build')
40+
41+
if os.path.exists('source/generated'):
42+
shutil.rmtree('source/generated')
43+
44+
def html():
45+
check_build()
46+
if os.system('sphinx-build -P -b html -d build/doctrees '
47+
'source build/html'):
48+
raise SystemExit("Building HTML failed.")
49+
50+
def latex():
51+
check_build()
52+
if sys.platform != 'win32':
53+
# LaTeX format.
54+
if os.system('sphinx-build -b latex -d build/doctrees '
55+
'source build/latex'):
56+
raise SystemExit("Building LaTeX failed.")
57+
# Produce pdf.
58+
59+
os.chdir('build/latex')
60+
61+
# Call the makefile produced by sphinx...
62+
if os.system('make'):
63+
raise SystemExit("Rendering LaTeX failed.")
64+
65+
os.chdir('../..')
66+
else:
67+
print 'latex build has not been tested on windows'
68+
69+
def check_build():
70+
build_dirs = [
71+
'build', 'build/doctrees', 'build/html',
72+
'build/latex', 'build/plots', 'build/_static',
73+
'build/_templates']
74+
for d in build_dirs:
75+
try:
76+
os.mkdir(d)
77+
except OSError:
78+
pass
79+
80+
def all():
81+
# clean()
82+
html()
83+
84+
funcd = {
85+
'html' : html,
86+
'latex' : latex,
87+
'clean' : clean,
88+
'sf' : sf,
89+
'sfpdf' : sfpdf,
90+
'all' : all,
91+
}
92+
93+
small_docs = False
94+
95+
# current_dir = os.getcwd()
96+
# os.chdir(os.path.dirname(os.path.join(current_dir, __file__)))
97+
98+
if len(sys.argv)>1:
99+
for arg in sys.argv[1:]:
100+
func = funcd.get(arg)
101+
if func is None:
102+
raise SystemExit('Do not know how to handle %s; valid args are %s'%(
103+
arg, funcd.keys()))
104+
func()
105+
else:
106+
small_docs = False
107+
all()
108+
#os.chdir(current_dir)

vb_suite/source/conf.py

+224
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,224 @@
1+
# -*- coding: utf-8 -*-
2+
#
3+
# pandas documentation build configuration file, created by
4+
#
5+
# This file is execfile()d with the current directory set to its containing dir.
6+
#
7+
# Note that not all possible configuration values are present in this
8+
# autogenerated file.
9+
#
10+
# All configuration values have a default; values that are commented out
11+
# serve to show the default.
12+
13+
import sys, os
14+
15+
# If extensions (or modules to document with autodoc) are in another directory,
16+
# add these directories to sys.path here. If the directory is relative to the
17+
# documentation root, use os.path.abspath to make it absolute, like shown here.
18+
#sys.path.append(os.path.abspath('.'))
19+
sys.path.insert(0, os.path.abspath('../sphinxext'))
20+
21+
sys.path.extend([
22+
23+
# numpy standard doc extensions
24+
os.path.join(os.path.dirname(__file__),
25+
'..', '../..',
26+
'sphinxext')
27+
28+
])
29+
30+
# -- General configuration -----------------------------------------------------
31+
32+
# Add any Sphinx extension module names here, as strings. They can be extensions
33+
# coming with Sphinx (named 'sphinx.ext.*') or your custom ones. sphinxext.
34+
35+
extensions = ['sphinx.ext.autodoc',
36+
'sphinx.ext.doctest']
37+
38+
# Add any paths that contain templates here, relative to this directory.
39+
templates_path = ['_templates', '_templates/autosummary']
40+
41+
# The suffix of source filenames.
42+
source_suffix = '.rst'
43+
44+
# The encoding of source files.
45+
#source_encoding = 'utf-8'
46+
47+
# The master toctree document.
48+
master_doc = 'vbench'
49+
50+
# General information about the project.
51+
project = u'pandas'
52+
copyright = u'2008-2011, the pandas development team'
53+
54+
# The version info for the project you're documenting, acts as replacement for
55+
# |version| and |release|, also used in various other places throughout the
56+
# built documents.
57+
#
58+
# The short X.Y version.
59+
import pandas
60+
61+
# version = '%s r%s' % (pandas.__version__, svn_version())
62+
version = '%s' % (pandas.__version__)
63+
64+
# The full version, including alpha/beta/rc tags.
65+
release = version
66+
67+
# JP: added from sphinxdocs
68+
autosummary_generate = True
69+
70+
# The language for content autogenerated by Sphinx. Refer to documentation
71+
# for a list of supported languages.
72+
#language = None
73+
74+
# There are two options for replacing |today|: either, you set today to some
75+
# non-false value, then it is used:
76+
#today = ''
77+
# Else, today_fmt is used as the format for a strftime call.
78+
#today_fmt = '%B %d, %Y'
79+
80+
# List of documents that shouldn't be included in the build.
81+
#unused_docs = []
82+
83+
# List of directories, relative to source directory, that shouldn't be searched
84+
# for source files.
85+
exclude_trees = []
86+
87+
# The reST default role (used for this markup: `text`) to use for all documents.
88+
#default_role = None
89+
90+
# If true, '()' will be appended to :func: etc. cross-reference text.
91+
#add_function_parentheses = True
92+
93+
# If true, the current module name will be prepended to all description
94+
# unit titles (such as .. function::).
95+
#add_module_names = True
96+
97+
# If true, sectionauthor and moduleauthor directives will be shown in the
98+
# output. They are ignored by default.
99+
#show_authors = False
100+
101+
# The name of the Pygments (syntax highlighting) style to use.
102+
pygments_style = 'sphinx'
103+
104+
# A list of ignored prefixes for module index sorting.
105+
#modindex_common_prefix = []
106+
107+
108+
# -- Options for HTML output ---------------------------------------------------
109+
110+
# The theme to use for HTML and HTML Help pages. Major themes that come with
111+
# Sphinx are currently 'default' and 'sphinxdoc'.
112+
html_theme = 'agogo'
113+
114+
# The style sheet to use for HTML and HTML Help pages. A file of that name
115+
# must exist either in Sphinx' static/ path, or in one of the custom paths
116+
# given in html_static_path.
117+
#html_style = 'statsmodels.css'
118+
119+
# Theme options are theme-specific and customize the look and feel of a theme
120+
# further. For a list of options available for each theme, see the
121+
# documentation.
122+
#html_theme_options = {}
123+
124+
# Add any paths that contain custom themes here, relative to this directory.
125+
html_theme_path = ['themes']
126+
127+
# The name for this set of Sphinx documents. If None, it defaults to
128+
# "<project> v<release> documentation".
129+
html_title = 'Vbench performance benchmarks for pandas'
130+
131+
# A shorter title for the navigation bar. Default is the same as html_title.
132+
#html_short_title = None
133+
134+
# The name of an image file (relative to this directory) to place at the top
135+
# of the sidebar.
136+
#html_logo = None
137+
138+
# The name of an image file (within the static path) to use as favicon of the
139+
# docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32
140+
# pixels large.
141+
#html_favicon = None
142+
143+
# Add any paths that contain custom static files (such as style sheets) here,
144+
# relative to this directory. They are copied after the builtin static files,
145+
# so a file named "default.css" will overwrite the builtin "default.css".
146+
html_static_path = ['_static']
147+
148+
# If not '', a 'Last updated on:' timestamp is inserted at every page bottom,
149+
# using the given strftime format.
150+
#html_last_updated_fmt = '%b %d, %Y'
151+
152+
# If true, SmartyPants will be used to convert quotes and dashes to
153+
# typographically correct entities.
154+
#html_use_smartypants = True
155+
156+
# Custom sidebar templates, maps document names to template names.
157+
#html_sidebars = {}
158+
159+
# Additional templates that should be rendered to pages, maps page names to
160+
# template names.
161+
#html_additional_pages = {}
162+
163+
# If false, no module index is generated.
164+
html_use_modindex = True
165+
166+
# If false, no index is generated.
167+
#html_use_index = True
168+
169+
# If true, the index is split into individual pages for each letter.
170+
#html_split_index = False
171+
172+
# If true, links to the reST sources are added to the pages.
173+
#html_show_sourcelink = True
174+
175+
# If true, an OpenSearch description file will be output, and all pages will
176+
# contain a <link> tag referring to it. The value of this option must be the
177+
# base URL from which the finished HTML is served.
178+
#html_use_opensearch = ''
179+
180+
# If nonempty, this is the file name suffix for HTML files (e.g. ".xhtml").
181+
#html_file_suffix = ''
182+
183+
# Output file base name for HTML help builder.
184+
htmlhelp_basename = 'performance'
185+
186+
187+
# -- Options for LaTeX output --------------------------------------------------
188+
189+
# The paper size ('letter' or 'a4').
190+
#latex_paper_size = 'letter'
191+
192+
# The font size ('10pt', '11pt' or '12pt').
193+
#latex_font_size = '10pt'
194+
195+
# Grouping the document tree into LaTeX files. List of tuples
196+
# (source start file, target name, title, author, documentclass [howto/manual]).
197+
latex_documents = [
198+
('index', 'performance.tex',
199+
u'pandas vbench Performance Benchmarks',
200+
u'Wes McKinney', 'manual'),
201+
]
202+
203+
# The name of an image file (relative to this directory) to place at the top of
204+
# the title page.
205+
#latex_logo = None
206+
207+
# For "manual" documents, if this is true, then toplevel headings are parts,
208+
# not chapters.
209+
#latex_use_parts = False
210+
211+
# Additional stuff for the LaTeX preamble.
212+
#latex_preamble = ''
213+
214+
# Documents to append as an appendix to all manuals.
215+
#latex_appendices = []
216+
217+
# If false, no module index is generated.
218+
#latex_use_modindex = True
219+
220+
221+
# Example configuration for intersphinx: refer to the Python standard library.
222+
# intersphinx_mapping = {'http://docs.scipy.org/': None}
223+
import glob
224+
autosummary_generate = glob.glob("*.rst")

0 commit comments

Comments
 (0)