Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Delete all requirements txt files and update documentation accordingly #967

Merged
merged 5 commits into from
Sep 20, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ Version 3.0.2
- Fix 'raw' mode in ``neurom stats``.
- Add example astrocyte analysis notebook.
- Fix readthedocs documentation build.
- Delete all requirements txt files and update documentation accordingly

Version 3.0.1
-------------
Expand Down
93 changes: 0 additions & 93 deletions doc/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,35 +53,21 @@

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

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

# Add any Sphinx extension module names here, as strings. They can be
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
# ones.
extensions = [
'sphinx_autorun',
'sphinx.ext.autodoc',
'sphinx.ext.autosummary',
'sphinx.ext.todo',
'sphinx.ext.viewcode',
'sphinx.ext.napoleon',
]

# Add any paths that contain templates here, relative to this directory.
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'

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

# The master toctree document.
master_doc = 'index'

# General information about the project.
project = u'NeuroM'
author = u'BBP Algorithm Development Section'
Expand Down Expand Up @@ -127,25 +113,17 @@
# output. They are ignored by default.
#show_authors = False

# The name of the Pygments (syntax highlighting) style to use.
pygments_style = 'sphinx'

# A list of ignored prefixes for module index sorting.
#modindex_common_prefix = []

# If true, keep warnings as "system message" paragraphs in the built documents.
#keep_warnings = False

# If true, `todo` and `todoList` produce output, else they produce nothing.
todo_include_todos = True
suppress_warnings = ["ref.python"]
autosummary_generate = True
autosummary_imported_members = False
autoclass_content = 'both'
autodoc_default_options = {
'members': True,
'imported-members': False,
'show-inheritance': True,
}
autosummary_mock_imports = ['plotly']

Expand All @@ -165,8 +143,6 @@
"repo_name": "BlueBrain/NeuroM"
}

# Add any paths that contain custom themes here, relative to this directory.
html_theme_path = ['_themes']

# The name for this set of Sphinx documents. If None, it defaults to
# "<project> v<release> documentation".
Expand Down Expand Up @@ -249,33 +225,8 @@
# implements a search results scorer. If empty, the default will be used.
#html_search_scorer = 'scorer.js'

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

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

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

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

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

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

# Grouping the document tree into LaTeX files. List of tuples
# (source start file, target name, title,
# author, documentclass [howto, manual, or own class]).
latex_documents = [
(master_doc, 'NeuroM.tex', u'NeuroM Documentation',
u'HBP Algorithm Development Section', 'manual'),
]

# The name of an image file (relative to this directory) to place at the top of
# the title page.
#latex_logo = None
Expand All @@ -299,27 +250,10 @@

# -- 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, 'neurom', u'NeuroM Documentation',
[author], 1)
]

# If true, show URL addresses after external links.
#man_show_urls = False


# -- Options for Texinfo output -------------------------------------------

# Grouping the document tree into Texinfo files. List of tuples
# (source start file, target name, title, author,
# dir menu entry, description, category)
texinfo_documents = [
(master_doc, 'NeuroM', u'NeuroM Documentation',
author, 'NeuroM', 'One line description of project.',
'Miscellaneous'),
]

# Documents to append as an appendix to all manuals.
#texinfo_appendices = []
Expand All @@ -329,30 +263,3 @@

# How to display URL addresses: 'footnote', 'no', or 'inline'.
#texinfo_show_urls = 'footnote'

# If true, do not generate a @detailmenu in the "Top" node's menu.
#texinfo_no_detailmenu = False
from sphinx.ext.autosummary import Autosummary

class AutosummaryOverride(Autosummary):
"""Extends Autosummary to ensure the nosignatures option is set."""

def run(self):
"""Wrap the autodoc output in a div with autodoc class."""
self.options["nosignatures"] = self.options.get("nosignatures", True)
result = super(AutosummaryOverride, self).run()
return result

def add_autosummary_override(app):
"""Override the autosummary definition to ensure no signatures."""
if "sphinx.ext.autosummary" in app.extensions:
app.add_directive("autosummary", AutosummaryOverride, override=True)

def allow_only_neurom(app, what, name, obj, skip, options):
"""Check that the member is part of neurom, exlude otherwise."""
if what in {"module", "class", "exception", "function"} and "neurom" not in getattr(obj, "__module__", ""):
return True

def setup(app):
app.connect('builder-inited', add_autosummary_override)
app.connect('autodoc-skip-member', allow_only_neurom)
48 changes: 13 additions & 35 deletions doc/source/developer.rst
Original file line number Diff line number Diff line change
Expand Up @@ -45,58 +45,36 @@ Running the tests
-----------------

The tests require that you have cloned the repository, since the test code is
not distributed in the package. It is recommended to use ``pytest`` for
this. There are two options:

Use the provided ``Makefile`` to run the tests using ``make``:
not distributed in the package. It is recommended to use ``tox`` for this.

.. code-block:: bash

$ git clone https://github.com/BlueBrain/NeuroM.git
$ cd NeuroM
$ make test

This runs ``pep8``, ``pylint`` and the unit tests in sequence.
$ tox

This method takes care of
installing all extra dependencies needed for running the tests, diagnosing the results,
performing linting on the source code. These dependencies are installed into a
``virtuanelv`` named ``neurom_test_venv``:

The ``Makefile`` also has targets for running only ``pylint`` and ``pep8`` individually:
This method takes care of installing all extra dependencies needed for tests, diagnosing results,
etc. It runs documentation check, pylint and the tests in sequence. Also it can run them
individually:

.. code-block:: bash

$ make lint # runs pep8 and pylint if that succeeds
$ make run_pep8 # run only pep8
$ make run_pylint # run only pylint

$ tox -e py36-lint # runs only pylint
$ tox -e py36-docs # run only documentation check
$ tox -e py36 # run only the tests

Note that you can also install the test dependencies and run the tests inside of your
own ``virtualenv``:
You can also run tests manually via `pylint` but you need to make sure that you have installed
all required dependencies in your virtual environment:

.. code-block:: bash

(nrm)$ pip install -r requirements_dev.txt
(your virtual env name)$ pip install neurom[plotly] pytest mock

This installs the following packages into your ``virtualenv``
unless they are already installed:

.. literalinclude:: ../../requirements_dev.txt
:lines: 29-36

Then, run the tests manually in the ``virtualenv``. For example,
Then, run the tests manually. For example,

.. code-block:: bash

(nrm)$ pytest --cov-report term-missing --cov-report xml --cov-report html --cov=neurom neurom

.. warning::

To ensure that the test requirements are the same as those run in continuous
integration, you should run the tests using the ``make test`` command. This is the
same command used in continuous integration. Failure to pass means will result in
a pull request being rejected.
(your virtual env name)$ pytest tests

.. include:: documentation.rst

Expand Down
4 changes: 2 additions & 2 deletions doc/source/documentation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ To build documentation, go into project's ``doc`` folder.

$ cd doc # assuming that you start from the project's root.

Make sure you have installed into your virtual environment libraries from ``requirements_docs.txt``
in the project's root. Run the command:
Make sure you have installed into your virtual environment libraries from `docs` extras:
``pip install neurom[docs]``. Then run the command in the ``doc`` folder:

.. code-block:: bash

Expand Down
1 change: 1 addition & 0 deletions neurom/core/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ def check_tree_type(tree):

def dendrite_filter(n):
"""Select only dendrites."""
# pylint: disable=consider-using-in
return n.type == NeuriteType.basal_dendrite or n.type == NeuriteType.apical_dendrite


Expand Down
2 changes: 1 addition & 1 deletion pylintrc
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
#R0903 - Too Few public methods
#W0511 - TODO in code
#R0401 - cyclic-import
disable=C0103,R0903,W0511,R0401,unspecified-encoding
disable=C0103,R0903,W0511,R0401,unspecified-encoding,consider-using-f-string

[FORMAT]
# Maximum number of characters on a single line.
Expand Down
1 change: 0 additions & 1 deletion requirements_benchmark.txt

This file was deleted.

39 changes: 0 additions & 39 deletions requirements_dev.txt

This file was deleted.

32 changes: 0 additions & 32 deletions requirements_docs.txt

This file was deleted.

4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,8 @@
},
name='neurom',
extras_require={
'plotly': ['plotly>=3.6.0',
'psutil>=5.5.1'], # for plotly image saving
'plotly': ['plotly>=3.6.0', 'psutil>=5.5.1'], # for plotly image saving
'docs': ['sphinx', 'sphinx-bluebrain-theme', 'sphinx-autorun'],
},
include_package_data=True,
python_requires='>=3.5',
Expand Down
2 changes: 1 addition & 1 deletion tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ commands =

[testenv:py36-docs]
changedir = doc
deps = -r requirements_docs.txt
extras = docs
commands =
# remove autosummary output
rm -rf {toxinidir}/doc/source/_neurom_build
Expand Down