Skip to content

Commit

Permalink
Merge pull request #215 from scottclowe/sty_blacken
Browse files Browse the repository at this point in the history
STY: Change code style to black
  • Loading branch information
scottclowe committed Jun 28, 2021
2 parents 742e1ea + ec7b531 commit 0829998
Show file tree
Hide file tree
Showing 29 changed files with 620 additions and 543 deletions.
48 changes: 39 additions & 9 deletions .pre-commit-config.yaml
@@ -1,14 +1,33 @@
repos:
- repo: https://github.com/pre-commit/pygrep-hooks
rev: v1.9.0
- repo: https://github.com/timothycrosley/isort
rev: 5.9.1
hooks:
- id: python-check-blanket-noqa
- id: python-no-log-warn
- id: rst-backticks
- id: rst-directive-colons
types: [text]
- id: rst-inline-touching-normal
types: [text]
- id: isort
name: isort
args: ["--profile", "black"]
- id: isort
name: isort (cython)
types: [cython]
args: ["--profile", "black"]

- repo: https://github.com/psf/black
rev: 21.6b0
hooks:
- id: black
args:
- "--target-version=py27"
- "--target-version=py35"
- "--target-version=py36"
- "--target-version=py37"
- "--target-version=py38"
- "--target-version=py39"
types: [python]

- repo: https://github.com/asottile/blacken-docs
rev: v1.8.0
hooks:
- id: blacken-docs
additional_dependencies: [black==21.6b0]

- repo: https://github.com/kynan/nbstripout
rev: 0.4.0
Expand All @@ -20,6 +39,17 @@ repos:
hooks:
- id: black_nbconvert

- repo: https://github.com/pre-commit/pygrep-hooks
rev: v1.9.0
hooks:
- id: python-check-blanket-noqa
- id: python-no-log-warn
- id: rst-backticks
- id: rst-directive-colons
types: [text]
- id: rst-inline-touching-normal
types: [text]

- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.0.1
hooks:
Expand Down
41 changes: 26 additions & 15 deletions README.rst
@@ -1,21 +1,23 @@
FISSA
=====

+------------------+----------------------------------------------------------+
| Latest Release | |PyPI badge| |Py Versions| |
+------------------+----------------------------------------------------------+
| License | |License| |
+------------------+----------------------------------------------------------+
| Documentation | |readthedocs| |
+------------------+----------------------------------------------------------+
| Build Status | |Documentation| |GHA tests| |AppVeyor| |Codecov| |
+------------------+----------------------------------------------------------+
| Interactive Demo | |Binder| |
+------------------+----------------------------------------------------------+
| Support | |Gitter| |
+------------------+----------------------------------------------------------+
| Citation | |DOI badge| |
+------------------+----------------------------------------------------------+
+------------------+----------------------------------------------------------------------+
| Latest Release | |PyPI badge| |Py Versions| |
+------------------+----------------------------------------------------------------------+
| License | |License| |
+------------------+----------------------------------------------------------------------+
| Documentation | |readthedocs| |
+------------------+----------------------------------------------------------------------+
| Build Status | |Documentation| |GHA tests| |AppVeyor| |Codecov| |pre-commit-status| |
+------------------+----------------------------------------------------------------------+
| Code style | |black| |pre-commit| |
+------------------+----------------------------------------------------------------------+
| Interactive Demo | |Binder| |
+------------------+----------------------------------------------------------------------+
| Support | |Gitter| |
+------------------+----------------------------------------------------------------------+
| Citation | |DOI badge| |
+------------------+----------------------------------------------------------------------+

FISSA (Fast Image Signal Separation Analysis) is a Python package for
decontaminating somatic signals from two-photon calcium imaging data.
Expand Down Expand Up @@ -389,3 +391,12 @@ with this program. If not, see http://www.gnu.org/licenses/.
.. |License| image:: https://img.shields.io/pypi/l/fissa
:target: https://raw.githubusercontent.com/rochefort-lab/fissa/master/LICENSE
:alt: GPLv3 License
.. |pre-commit| image:: https://img.shields.io/badge/pre--commit-enabled-brightgreen?logo=pre-commit&logoColor=white
:target: https://github.com/pre-commit/pre-commit
:alt: pre-commit enabled
.. |pre-commit-status| image:: https://results.pre-commit.ci/badge/github/rochefort-lab/fissa/master.svg
:target: https://results.pre-commit.ci/latest/github/rochefort-lab/fissa/master
:alt: pre-commit.ci status
.. |black| image:: https://img.shields.io/badge/code%20style-black-000000.svg
:target: https://github.com/psf/black
:alt: black
116 changes: 62 additions & 54 deletions docs/conf.py
Expand Up @@ -15,15 +15,17 @@
import datetime
import os
import sys
sys.path.insert(0, os.path.abspath('.'))
sys.path.insert(0, os.path.abspath('../'))

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


# Can't import __meta__.py if the requirements aren't installed
# due to imports in __init__.py. This is a workaround.
def read(fname):
return open(os.path.join(os.path.dirname(__file__), fname)).read()


meta = {}
exec(read("../fissa/__meta__.py"), meta)

Expand All @@ -35,73 +37,77 @@ def read(fname):
project = meta["name"].upper()
project_path = meta["path"]
author = meta["author"]
copyright = '{}, {}'.format(now.year, author)
copyright = "{}, {}".format(now.year, author)


# The full version, including alpha/beta/rc tags
release = meta["version"]
# The short X.Y version
version = '.'.join(release.split('.')[0:2])
version = ".".join(release.split(".")[0:2])


# -- Automatically generate API documentation --------------------------------


def run_apidoc(_):
ignore_paths = [
os.path.join('..', project_path, 'tests'),
os.path.join("..", project_path, "tests"),
]

argv = [
"--force", # Overwrite output files
"--follow-links", # Follow symbolic links
"--separate", # Put each module file in its own page
"--module-first", # Put module documentation before submodule
"-o", "source/packages", # Output path
"-o",
"source/packages", # Output path
os.path.join("..", project_path),
] + ignore_paths

try:
# Sphinx 1.7+
from sphinx.ext import apidoc

apidoc.main(argv)
except ImportError:
# Sphinx 1.6 (and earlier)
from sphinx import apidoc

argv.insert(0, apidoc.__file__)
apidoc.main(argv)


def retitle_modules(_):
pth = 'source/packages/modules.rst'
pth = "source/packages/modules.rst"
lines = open(pth).read().splitlines()
# Overwrite the junk in the first two lines with a better title
lines[0] = 'API Reference'
lines[1] = '============='
open(pth, 'w').write('\n'.join(lines))
lines[0] = "API Reference"
lines[1] = "============="
open(pth, "w").write("\n".join(lines))


def setup(app):
app.connect('builder-inited', run_apidoc)
app.connect('builder-inited', retitle_modules)
app.connect("builder-inited", run_apidoc)
app.connect("builder-inited", retitle_modules)


# -- General configuration ---------------------------------------------------

# If your documentation needs a minimal Sphinx version, state it here.
#
# needs_sphinx = '1.0'
# needs_sphinx = "1.0"

# Add any Sphinx extension module names here, as strings. They can be
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
# extensions coming with Sphinx (named "sphinx.ext.*") or your custom
# ones.
extensions = [
'sphinx.ext.autodoc',
'sphinx.ext.intersphinx',
'sphinx.ext.todo',
'sphinx.ext.coverage',
'sphinx.ext.mathjax',
'sphinx.ext.ifconfig',
'sphinx.ext.viewcode',
"sphinx.ext.autodoc",
"sphinx.ext.intersphinx",
"sphinx.ext.todo",
"sphinx.ext.coverage",
"sphinx.ext.mathjax",
"sphinx.ext.ifconfig",
"sphinx.ext.viewcode",
"numpydoc", # handle NumPy documentation formatted docstrings
]

Expand Down Expand Up @@ -129,19 +135,19 @@ def setup(app):
}

# 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", ".md"]
source_suffix = ".rst"

# The encoding of source files.
source_encoding = "utf-8"

# 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.
Expand All @@ -153,7 +159,7 @@ def setup(app):
# 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']
exclude_patterns = ["_build", "Thumbs.db", ".DS_Store"]

# The name of the Pygments (syntax highlighting) style to use.
pygments_style = None
Expand Down Expand Up @@ -186,44 +192,38 @@ def setup(app):
# 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.
#
# The default sidebars (for documents that don't match any pattern) are
# defined by theme itself. Builtin themes are using these templates by
# default: ``['localtoc.html', 'relations.html', 'sourcelink.html',
# 'searchbox.html']``.
# default: ``["localtoc.html", "relations.html", "sourcelink.html",
# "searchbox.html"]``.
#
# html_sidebars = {}


# -- Options for HTMLHelp output ---------------------------------------------

# Output file base name for HTML help builder.
htmlhelp_basename = project + 'doc'
htmlhelp_basename = project + "doc"


# -- Options for LaTeX output ------------------------------------------------

latex_elements = {
# The paper size ('letterpaper' or 'a4paper').
# The paper size ("letterpaper" or "a4paper").
# "papersize": "letterpaper",
#
# 'papersize': 'letterpaper',

# The font size ('10pt', '11pt' or '12pt').
# The font size ("10pt", "11pt" or "12pt").
# "pointsize": "10pt",
#
# 'pointsize': '10pt',

# Additional stuff for the LaTeX preamble.
#
# 'preamble': '',

# Latex figure (float) alignment
#
# 'figure_align': 'htbp',

#
# Additional stuff for the LaTeX preamble.
# Need to manually declare what the delta symbol (Δ) corresponds to.
"preamble": """
\DeclareUnicodeCharacter{394}{$\Delta$}
Expand All @@ -234,19 +234,21 @@ def setup(app):
# (source start file, target name, title,
# author, documentclass [howto, manual, or own class]).
latex_documents = [
(master_doc, project + '.tex', project + ' Documentation',
meta["author"], 'manual'),
(
master_doc,
project + ".tex",
project + " Documentation",
meta["author"],
"manual",
),
]


# -- Options for manual page output ------------------------------------------

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


# -- Options for Texinfo output ----------------------------------------------
Expand All @@ -255,9 +257,15 @@ def setup(app):
# (source start file, target name, title, author,
# dir menu entry, description, category)
texinfo_documents = [
(master_doc, project, project + ' Documentation',
author, project, meta["description"],
'Miscellaneous'),
(
master_doc,
project,
project + " Documentation",
author,
project,
meta["description"],
"Miscellaneous",
),
]


Expand All @@ -269,14 +277,14 @@ def setup(app):
# The unique identifier of the text. This can be a ISBN number
# or the project homepage.
#
# epub_identifier = ''
# epub_identifier = ""

# A unique identification for the text.
#
# epub_uid = ''
# 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 -------------------------------------------------
Expand Down
2 changes: 1 addition & 1 deletion docs/source/user-guide.rst
Expand Up @@ -2,4 +2,4 @@ FISSA User Guide
================

.. include:: ../../README.rst
:start-line: 19
:start-line: 21

0 comments on commit 0829998

Please sign in to comment.