Skip to content

Commit 2858c48

Browse files
authored
Simplify packaging and update versioneer (#69)
* Switch to setup.cfg for metadata. Also update versioneer to 0.21. * Fix up config file. * Clean up docs a bit.
1 parent c3b3962 commit 2858c48

File tree

13 files changed

+1057
-673
lines changed

13 files changed

+1057
-673
lines changed

.gitattributes

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
pymare/_version.py export-subst

MANIFEST.in

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
include versioneer.py
2+
include pymare/_version.py

docs/conf.py

Lines changed: 58 additions & 78 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,13 @@
1616
# If extensions (or modules to document with autodoc) are in another directory,
1717
# add these directories to sys.path here. If the directory is relative to the
1818
# documentation root, use os.path.abspath to make it absolute, like shown here.
19-
#
2019
import os
2120
import sys
2221
from datetime import datetime
22+
from distutils.version import LooseVersion
23+
24+
import sphinx
25+
from m2r import MdInclude
2326

2427
sys.path.insert(0, os.path.abspath("sphinxext"))
2528
sys.path.insert(0, os.path.abspath(os.path.pardir))
@@ -31,38 +34,28 @@
3134
# -- General configuration ------------------------------------------------
3235

3336
# If your documentation needs a minimal Sphinx version, state it here.
34-
35-
# needs_sphinx = '1.0'
37+
needs_sphinx = "3.5"
3638

3739
# generate autosummary even if no references
3840
autosummary_generate = True
39-
autodoc_default_flags = ["members", "inherited-members"]
4041
add_module_names = False
4142

4243
# Add any Sphinx extension module names here, as strings. They can be
4344
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
4445
# ones.
4546
extensions = [
46-
"sphinx.ext.autodoc",
47-
"sphinx.ext.autosummary",
48-
"sphinx.ext.doctest",
49-
"sphinx.ext.ifconfig",
50-
"sphinx.ext.intersphinx",
51-
"sphinx.ext.linkcode",
52-
"sphinx.ext.mathjax",
53-
"sphinx.ext.napoleon",
54-
"sphinx.ext.todo",
55-
"sphinx_copybutton",
56-
"sphinx_gallery.gen_gallery",
57-
"sphinxarg.ext",
58-
"m2r",
59-
"numpydoc",
47+
"sphinx.ext.autodoc", # standard
48+
"sphinx.ext.autosummary", # standard
49+
"sphinx.ext.doctest", # runs doctests
50+
"sphinx.ext.intersphinx", # links code to other packages
51+
"sphinx.ext.linkcode", # links to code from api
52+
"sphinx.ext.napoleon", # alternative to numpydoc
53+
"sphinx_copybutton", # for copying code snippets
54+
"sphinx_gallery.gen_gallery", # example gallery
55+
"sphinxarg.ext", # argparse
56+
"recommonmark", # markdown parser
6057
]
6158

62-
from distutils.version import LooseVersion
63-
64-
import sphinx
65-
6659
if LooseVersion(sphinx.__version__) < LooseVersion("1.4"):
6760
extensions.append("sphinx.ext.pngmath")
6861
else:
@@ -109,43 +102,47 @@
109102
# The name of the Pygments (syntax highlighting) style to use.
110103
pygments_style = "sphinx"
111104

112-
# If true, `todo` and `todoList` produce output, else they produce nothing.
113-
todo_include_todos = False
114-
115-
116-
# -- Options for HTML output ----------------------------------------------
105+
# -----------------------------------------------------------------------------
106+
# Napoleon settings
107+
# -----------------------------------------------------------------------------
108+
napoleon_google_docstring = False
109+
napoleon_numpy_docstring = True
110+
napoleon_include_init_with_doc = True
111+
napoleon_include_private_with_doc = False
112+
napoleon_include_special_with_doc = False
113+
napoleon_use_admonition_for_examples = False
114+
napoleon_use_admonition_for_notes = False
115+
napoleon_use_admonition_for_references = False
116+
napoleon_use_ivar = True
117+
napoleon_use_param = False
118+
napoleon_use_keyword = True
119+
napoleon_use_rtype = False
117120

118-
# The theme to use for HTML and HTML Help pages. See the documentation for
119-
# a list of builtin themes.
120-
#
121-
# installing theme package
121+
# -----------------------------------------------------------------------------
122+
# HTML output
123+
# -----------------------------------------------------------------------------
124+
# The theme to use for HTML and HTML Help pages.
125+
# See the documentation for a list of builtin themes.
122126
html_theme = "sphinx_rtd_theme"
123127

124128
# Theme options are theme-specific and customize the look and feel of a theme
125-
# further. For a list of options available for each theme, see the
126-
# documentation.
127-
#
128-
# html_theme_options = {}
129+
# further. For a list of options available for each theme, see the documentation.
130+
html_theme_options = {
131+
"includehidden": False, # don't show hidden TOCs in sidebar
132+
}
129133
html_sidebars = {"**": ["globaltoc.html", "relations.html", "searchbox.html", "indexsidebar.html"]}
130134

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

136-
137-
def setup(app):
138-
"From https://github.com/rtfd/sphinx_rtd_theme/issues/117."
139-
app.add_stylesheet("theme_overrides.css")
140-
app.add_stylesheet("pymare.css")
141-
app.connect("autodoc-process-docstring", generate_example_rst)
142-
143-
144140
html_favicon = "_static/nimare_favicon.png"
145141
html_logo = "_static/nimare_banner.png"
146142

147-
# -- Options for HTMLHelp output ------------------------------------------
148-
143+
# -----------------------------------------------------------------------------
144+
# HTMLHelp output
145+
# -----------------------------------------------------------------------------
149146
# Output file base name for HTML help builder.
150147
htmlhelp_basename = "pymaredoc"
151148

@@ -185,30 +182,26 @@ def setup(app):
185182
"reference_url": {
186183
# The module you locally document uses None
187184
"pymare": None,
188-
"matplotlib": "https://matplotlib.org/",
189-
"numpy": "http://docs.scipy.org/doc/numpy/",
190185
},
191186
}
192187

193188
# Generate the plots for the gallery
194-
plot_gallery = "True"
195-
196-
# -- Options for Texinfo output -------------------------------------------
197-
198-
# Grouping the document tree into Texinfo files. List of tuples
199-
# (source start file, target name, title, author,
200-
# dir menu entry, description, category)
201-
texinfo_documents = [
202-
(
203-
"index",
204-
"project-template",
205-
"project-template Documentation",
206-
"Vighnesh Birodkar",
207-
"project-template",
208-
"One line description of project.",
209-
"Miscellaneous",
210-
),
211-
]
189+
plot_gallery = True
190+
191+
192+
def setup(app):
193+
"""From https://github.com/rtfd/sphinx_rtd_theme/issues/117."""
194+
app.add_stylesheet("theme_overrides.css")
195+
app.add_stylesheet("pymare.css")
196+
app.connect("autodoc-process-docstring", generate_example_rst)
197+
# Fix to https://github.com/sphinx-doc/sphinx/issues/7420
198+
# from https://github.com/life4/deal/commit/7f33cbc595ed31519cefdfaaf6f415dada5acd94
199+
# from m2r to make `mdinclude` work
200+
app.add_config_value("no_underscore_emphasis", False, "env")
201+
app.add_config_value("m2r_parse_relative_links", False, "env")
202+
app.add_config_value("m2r_anonymous_references", False, "env")
203+
app.add_config_value("m2r_disable_inline_math", False, "env")
204+
app.add_directive("mdinclude", MdInclude)
212205

213206

214207
def generate_example_rst(app, what, name, obj, options, lines):
@@ -221,16 +214,3 @@ def generate_example_rst(app, what, name, obj, options, lines):
221214
if not os.path.exists(examples_path):
222215
# touch file
223216
open(examples_path, "w").close()
224-
225-
226-
# Documents to append as an appendix to all manuals.
227-
# texinfo_appendices = []
228-
229-
# If false, no module index is generated.
230-
# texinfo_domain_indices = True
231-
232-
# How to display URL addresses: 'footnote', 'no', or 'inline'.
233-
# texinfo_show_urls = 'footnote'
234-
235-
# If true, do not generate a @detailmenu in the "Top" node's menu.
236-
# texinfo_no_detailmenu = False

docs/contents.rst

Lines changed: 0 additions & 10 deletions
This file was deleted.

docs/index.rst

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,15 @@ PyMARE is a Python package for meta-analyses and meta-regressions.
2929
:target: https://codecov.io/gh/neurostuff/pymare
3030
:alt: Codecov
3131

32-
.. include:: contents.rst
32+
.. toctree::
33+
:maxdepth: 2
34+
:caption: Contents:
35+
36+
about
37+
installation
38+
auto_examples/index
39+
contributing
40+
api
3341

3442
Indices and tables
3543
------------------

docs/installation.rst

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,17 @@
33
Installation
44
============
55

6-
You can install PyMARE from master:
6+
PyMARE can be installed from pip. To install the latest official release:
77

88
.. code-block:: bash
99
10-
pip install git+https://github.com/neurostuff/PyMARE.git
10+
pip install pymare
11+
12+
If you want to use the most up-to-date version, you can install from the ``master`` branch:
1113

12-
PyMARE requires Python >=3.6 and the following packages:
14+
.. code-block:: bash
15+
16+
pip install git+https://github.com/neurostuff/PyMARE.git
1317
14-
- numpy
15-
- scipy
16-
- pandas
18+
PyMARE requires Python >=3.6 and a number of packages.
19+
For a complete list, please see the file ``setup.cfg``.

pymare/__init__.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
1-
from ._version import get_versions
1+
"""PyMARE: Python Meta-Analysis & Regression Engine"""
22
from .core import Dataset, meta_regression
33
from .effectsize import OneSampleEffectSizeConverter, TwoSampleEffectSizeConverter
44

5-
__version__ = get_versions()["version"]
6-
75
__all__ = [
86
"Dataset",
97
"meta_regression",
108
"OneSampleEffectSizeConverter",
119
"TwoSampleEffectSizeConverter",
1210
]
1311

14-
del get_versions
12+
from . import _version
13+
14+
__version__ = _version.get_versions()["version"]

0 commit comments

Comments
 (0)