Skip to content

Commit

Permalink
Merge pull request #444 from effigies/mnt/updates
Browse files Browse the repository at this point in the history
chore: Clean up doc builds, environment, style checks
  • Loading branch information
effigies authored Jul 19, 2024
2 parents 6501da1 + f471662 commit d2f89b9
Show file tree
Hide file tree
Showing 8 changed files with 182 additions and 146 deletions.
8 changes: 5 additions & 3 deletions .git-blame-ignore-revs
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
# 2024-07-19 - effigies@gmail.com - chore(ruff): ruff check --fix && ruff format [git-blame-ignore-rev]
6333f4735f341e556113325c7bc9d0f2e284e418
# 2024-03-07 - mathiasg@stanford.edu - STY: ruff format smriprep [git-blame-ignore-rev]
83a50d465145c6e8176c3f13d4673ed4e0bdb26f
# 2023-11-21 - effigies@gmail.com - STY: ruff --fix smriprep [git-blame-ignore-rev]
3a586cf46cb1bb963b93d9546f20273194d15de5
5d4743142c43d415b761230d83a471cd5aae0314
# 2023-11-20 - effigies@gmail.com - STY: ruff --fix smriprep [git-blame-ignore-rev]
c5e8b6b8ddb69284a4cba58e2512b299f1e29464
946f030e4409bd2fcc044e4a0716ba8af91df247
# 2023-11-20 - effigies@gmail.com - STY: ruff format smriprep [git-blame-ignore-rev]
8d62c0f3f3c6a911b1dfe2e9a2016b8de7da051a
d14bcb0d65defd18affb6164867ab665c780637e
7 changes: 5 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
rev: v4.6.0
hooks:
- id: trailing-whitespace
exclude: '.gitignore|.*\.gii$'
Expand All @@ -11,7 +11,10 @@ repos:
- id: check-toml
- id: check-json
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.3.1
rev: v0.5.3
hooks:
- id: ruff
args: [ --fix ]
- id: ruff-format
- id: ruff
args: [ --select, ISC001, --fix ]
1 change: 1 addition & 0 deletions docs/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
api/
152 changes: 78 additions & 74 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,26 +12,31 @@
#
import os
import sys

from packaging.version import Version

from smriprep import (
__copyright__ as _copyright,
)
from smriprep import (
__package__ as _package,
)
from smriprep import (
__version__ as _version,
__copyright__ as _copyright,
)

sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), "sphinxext")))
sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), 'sphinxext')))

from github_link import make_linkcode_resolve # noqa: E402

os.environ['NO_ET'] = '1'

sys.path.insert(0, os.path.abspath("../wrapper"))
sys.path.insert(0, os.path.abspath('../wrapper'))

# -- Project information -----------------------------------------------------
project = _package
copyright = _copyright
author = "The sMRIPrep Developers"
copyright = _copyright # noqa: A001
author = 'The sMRIPrep Developers'

# The short X.Y version
version = Version(_version).public
Expand All @@ -41,30 +46,29 @@

# -- General configuration ---------------------------------------------------
extensions = [
"sphinx.ext.autodoc",
"sphinx.ext.doctest",
"sphinx.ext.intersphinx",
"sphinx.ext.coverage",
"sphinx.ext.mathjax",
"sphinx.ext.ifconfig",
"sphinx.ext.viewcode",
"sphinx.ext.githubpages",
"sphinxarg.ext", # argparse extension
"sphinxcontrib.apidoc",
"nipype.sphinxext.plot_workflow",
"nipype.sphinxext.apidoc",
'sphinx.ext.autodoc',
'sphinx.ext.doctest',
'sphinx.ext.intersphinx',
'sphinx.ext.coverage',
'sphinx.ext.mathjax',
'sphinx.ext.ifconfig',
'sphinx.ext.viewcode',
'sphinx.ext.githubpages',
'sphinxarg.ext', # argparse extension
'sphinxcontrib.apidoc',
'nipype.sphinxext.plot_workflow',
'nipype.sphinxext.apidoc',
]

autodoc_mock_imports = [
"matplotlib",
"nilearn",
"nitime",
"numpy",
"pandas",
"seaborn",
"skimage",
"svgutils",
"transforms3d",
'matplotlib',
'nilearn',
'nitime',
'pandas',
'seaborn',
'skimage',
'svgutils',
'transforms3d',
]

# Accept custom section names to be parsed for numpy-style docstrings
Expand All @@ -73,41 +77,41 @@
# https://github.com/sphinx-contrib/napoleon/pull/10 is merged.
napoleon_use_param = False
napoleon_custom_sections = [
("Inputs", "Parameters"),
("Outputs", "Parameters"),
("Attributes", "Parameters"),
("Mandatory Inputs", "Parameters"),
("Optional Inputs", "Parameters"),
('Inputs', 'Parameters'),
('Outputs', 'Parameters'),
('Attributes', 'Parameters'),
('Mandatory Inputs', 'Parameters'),
('Optional Inputs', 'Parameters'),
]

# Add any paths that contain templates here, relative to this directory.
templates_path = ["_templates"]
templates_path = ['_templates']

# The suffix(es) of source filenames.
# You can specify multiple suffix as a list of string:
#
# source_suffix = ['.rst', '.md']
source_suffix = ".rst"
source_suffix = '.rst'

# The master toctree document.
master_doc = "index"
master_doc = 'index'

# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
#
# This is also used if you do content translation via gettext catalogs.
# Usually you set "language" from the command line for these cases.
language = "en"
language = 'en'

# 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",
"api/modules.rst",
"api/smriprep.rst",
'_build',
'Thumbs.db',
'.DS_Store',
'api/modules.rst',
'api/smriprep.rst',
]

# The name of the Pygments (syntax highlighting) style to use.
Expand All @@ -119,7 +123,7 @@
# The theme to use for HTML and HTML Help pages. See the documentation for
# a list of builtin themes.
#
html_theme = "sphinx_rtd_theme"
html_theme = 'sphinx_rtd_theme'

# Theme options are theme-specific and customize the look and feel of a theme
# further. For a list of options available for each theme, see the
Expand All @@ -130,7 +134,7 @@
# 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"]
html_static_path = ['_static']

# Custom sidebar templates, must be a dictionary that maps document names
# to template names.
Expand All @@ -146,7 +150,7 @@
# -- Options for HTMLHelp output ---------------------------------------------

# Output file base name for HTML help builder.
htmlhelp_basename = "smriprepdoc"
htmlhelp_basename = 'smriprepdoc'


# -- Options for LaTeX output ------------------------------------------------
Expand All @@ -172,10 +176,10 @@
latex_documents = [
(
master_doc,
"smriprep.tex",
"sMRIPrep Documentation",
"The NiPreps Developers",
"manual",
'smriprep.tex',
'sMRIPrep Documentation',
'The NiPreps Developers',
'manual',
),
]

Expand All @@ -184,7 +188,7 @@

# One entry per manual page. List of tuples
# (source start file, name, description, authors, manual section).
man_pages = [(master_doc, "smriprep", "sMRIPrep Documentation", [author], 1)]
man_pages = [(master_doc, 'smriprep', 'sMRIPrep Documentation', [author], 1)]


# -- Options for Texinfo output ----------------------------------------------
Expand All @@ -195,12 +199,12 @@
texinfo_documents = [
(
master_doc,
"smriprep",
"sMRIPrep Documentation",
'smriprep',
'sMRIPrep Documentation',
author,
"sMRIPrep",
"One line description of project.",
"Miscellaneous",
'sMRIPrep',
'One line description of project.',
'Miscellaneous',
),
]

Expand All @@ -220,42 +224,42 @@
# epub_uid = ''

# A list of files that should not be packed into the epub file.
epub_exclude_files = ["search.html"]
epub_exclude_files = ['search.html']


# -- Extension configuration -------------------------------------------------

apidoc_module_dir = "../smriprep"
apidoc_output_dir = "api"
apidoc_module_dir = '../smriprep'
apidoc_output_dir = 'api'
apidoc_excluded_paths = [
"conftest.py",
"*/conftest.py",
"*/tests/*",
"tests/*",
"data/*",
"conf/*",
'conftest.py',
'*/conftest.py',
'*/tests/*',
'tests/*',
'data/*',
'conf/*',
]
apidoc_separate_modules = True
apidoc_extra_args = ["--module-first", "-d 1", "-T"]
apidoc_extra_args = ['--module-first', '-d 1', '-T']

# Options for github links
# The following is used by sphinx.ext.linkcode to provide links to github
linkcode_resolve = make_linkcode_resolve(
"smriprep",
"https://github.com/nipreps/smriprep/blob/{revision}/{package}/{path}#L{lineno}",
'smriprep',
'https://github.com/nipreps/smriprep/blob/{revision}/{package}/{path}#L{lineno}',
)

# -- Options for intersphinx extension ---------------------------------------
intersphinx_mapping = {
"python": ("https://docs.python.org/3/", None),
"numpy": ("https://numpy.org/doc/stable/", None),
"scipy": ("https://docs.scipy.org/doc/scipy/", None),
"matplotlib": ("https://matplotlib.org/", None),
"bids": ("https://bids-standard.github.io/pybids/", None),
"nibabel": ("https://nipy.org/nibabel/", None),
"nipype": ("https://nipype.readthedocs.io/en/latest/", None),
"niworkflows": ("https://www.nipreps.org/niworkflows/", None),
"templateflow": ("https://www.templateflow.org/python-client", None),
'python': ('https://docs.python.org/3/', None),
'numpy': ('https://numpy.org/doc/stable/', None),
'scipy': ('https://docs.scipy.org/doc/scipy/', None),
'matplotlib': ('https://matplotlib.org/', None),
'bids': ('https://bids-standard.github.io/pybids/', None),
'nibabel': ('https://nipy.org/nibabel/', None),
'nipype': ('https://nipype.readthedocs.io/en/latest/', None),
'niworkflows': ('https://www.nipreps.org/niworkflows/', None),
'templateflow': ('https://www.templateflow.org/python-client', None),
}

# -- Options for versioning extension ----------------------------------------
Expand Down
10 changes: 7 additions & 3 deletions env.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,16 @@ dependencies:
# Intel Math Kernel Library for numpy
- mkl=2023.2
- mkl-service=2.4
# ANTs is linked against libitk 5.3 but does not pin the version
- libitk=5.3
# Base scientific python stack; required by FSL, so pinned here
- numpy=1.26
- scipy=1.11
- scipy=1.13
- matplotlib=3.8
- pandas=2.2
- h5py=3.10
- h5py=3.11
# Dependencies compiled against numpy, best to stick with conda
- scikit-image=0.22
- scikit-image=0.23
- scikit-learn=1.4
# Utilities
- graphviz=9.0
Expand All @@ -32,3 +34,5 @@ dependencies:
- pip
- pip:
- -r requirements.txt
variables:
FSLOUTPUTTYPE: NIFTI_GZ
5 changes: 5 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,10 @@ source = [

[tool.ruff]
line-length = 99
extend-exclude = [
"wrapper/*.py",
"docs/sphinxext/*",
]

[tool.ruff.lint]
extend-select = [
Expand Down Expand Up @@ -177,6 +181,7 @@ inline-quotes = "single"

[tool.ruff.lint.extend-per-file-ignores]
"*/test_*.py" = ["S101"]
"docs/conf.py" = ["A001"]

[tool.ruff.format]
quote-style = "single"
Loading

0 comments on commit d2f89b9

Please sign in to comment.