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

Fix documentation, remove version cap on sphinxcontrib-bibtex #523

Merged
merged 40 commits into from
Feb 16, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
a7688c5
remove version constraint on sphinxcontrib-bibtex
Nov 4, 2022
2b11d70
add path to .bib file to conf.py
Nov 4, 2022
6dcd9cf
remove html4 writer, since its deprecated with newer sphinx versions
Nov 4, 2022
697a80f
updated mathjax path
Nov 14, 2022
2e94f75
fix bug for math formulas with sphinx 5.3.0
Nov 14, 2022
979e67d
remove version cap for sphinx
Nov 15, 2022
e3dfcbd
fix mathjax output by specifying mathjax as html math renderer
Nov 15, 2022
648bb11
undo changes for mathjax, this will be a separate PR
Nov 16, 2022
117c1cd
change citation style to author-year
Nov 16, 2022
a95a9c3
changed bibliography style for spade, removed labelprefix
Nov 16, 2022
633fbaa
define default style for bibliography
Nov 16, 2022
ae70a78
remove style for bibliography in spade.rst
Nov 16, 2022
799cfa0
add bibtex_reference_style for citations with round brackets
Nov 16, 2022
6443b66
add bibliography style, author_year
Nov 16, 2022
2a097ac
bibliography style spade.rst
Nov 16, 2022
8f486d1
bibliography style cubic.rst
Nov 16, 2022
5bfcde2
bibliography style cell_assembly_detection.rst
Nov 16, 2022
682c714
bibliography style citation.rst
Nov 16, 2022
93c8735
bibliography style contribute.rst
Nov 16, 2022
931f8d8
bibliography style _spike_train_processing.rst
Nov 16, 2022
9f99c52
remove path to .bib file
Nov 16, 2022
f712263
bibliography style asset.rst
Nov 16, 2022
50033cf
bibliography style causality.rst
Nov 16, 2022
08603ca
bibliography style change_point_detection.rst
Nov 16, 2022
78dae1d
bibliography style gpfa.rst
Nov 16, 2022
7a7853b
bibliography style signal_processing.rst
Nov 16, 2022
8cc83d9
bibliography style spike_train_surrogates.rst
Nov 16, 2022
1bf9038
bibliography style unitary_event_analysis.rst
Nov 16, 2022
040542a
bibliography style waveform_features.rst
Nov 16, 2022
c4ac0b1
bibliography style spike_train_generation.py
Nov 16, 2022
0ac22b1
bibliography style statistics.py
Nov 16, 2022
ace0fec
trigger CI build
Feb 6, 2023
65fedf2
Merge branch 'master' into fix/bibtex-contrib-version-cap
Feb 6, 2023
ee7666e
add gcc 12 to docs runner
Feb 7, 2023
c1da061
add conda update
Feb 7, 2023
3924988
install libstdcxx
Feb 7, 2023
d4400c2
add activate base environment commands to conda docs runner
Feb 7, 2023
5b72a85
Update CI.yml
Moritz-Alexander-Kern Feb 7, 2023
3df7b7e
remove version constraint on libstdcxx-ng
Feb 7, 2023
8d476b3
Merge remote-tracking branch 'origin/fix/bibtex-contrib-version-cap' …
Feb 7, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
12 changes: 7 additions & 5 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -389,27 +389,29 @@ jobs:

- name: Install dependencies
run: |
conda config --add channels conda-forge # bugfix with scipy==1.8.1: libstdcxx-ng 12.1.0 required
sudo apt-get update
sudo apt install -y libopenmpi-dev openmpi-bin
conda update conda
conda install -c conda-forge openmpi pandoc libstdcxx-ng # fix libstdc++.so.6: version for new scipy versions > 1.9.1
conda env update --file requirements/environment-docs.yml --name base
activate base
python -m pip install --upgrade pip
pip install -r requirements/requirements-docs.txt
pip install -r requirements/requirements-tutorials.txt
conda config --add channels conda-forge # bugfix with scipy==1.8.1: libstdcxx-ng 12.1.0 required
conda update conda
conda env update --file requirements/environment-docs.yml --name base
conda install -c conda-forge openmpi
conda install -c conda-forge pandoc
pip install -e .[extras]
# run notebooks
sed -i -E "s/nbsphinx_execute *=.*/nbsphinx_execute = 'always'/g" doc/conf.py

- name: List packages
run: |
activate base
pip list
conda list
python --version

- name: make html
run: |
activate base
cd doc
make html
6 changes: 2 additions & 4 deletions doc/citation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,5 @@ Further publications directly related to Elephant development
`BibTex references <https://github.com/NeuralEnsemble/elephant/blob/master/doc/bib/elephant.bib>`_
used in Elephant documentation).

.. bibliography:: bib/elephant.bib
:labelprefix: ref
:keyprefix: citations-
:style: unsrt
.. bibliography::
:keyprefix: citations-
68 changes: 62 additions & 6 deletions doc/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -212,11 +212,14 @@
# see here https://github.com/phn/pytpm/issues/3#issuecomment-12133978
numpydoc_show_class_members = False

# A fix for Alabaster theme for no space between a citation reference
# and citation text
# https://github.com/sphinx-doc/sphinx/issues/6705#issuecomment-536197438
html4_writer = True
# path to bibtex-bibfiles.
bibtex_bibfiles = ['bib/elephant.bib']

# To configure your referencing style:
bibtex_reference_style = 'author_year_round'

# To configure the bibliography style:
bibtex_default_style = 'author_year'

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

Expand Down Expand Up @@ -349,10 +352,10 @@
# The name of math_renderer extension for HTML output.
html_math_renderer = 'mathjax'

# Remove the copyright notice from docstrings:


def process_docstring_remove_copyright(app, what, name, obj, options, lines):
"""Remove the copyright notice from docstrings: """

copyright_line = None
for i, line in enumerate(lines):
if line.startswith(':copyright:'):
Expand All @@ -366,3 +369,56 @@ def process_docstring_remove_copyright(app, what, name, obj, options, lines):
def setup(app):
app.connect('autodoc-process-docstring',
process_docstring_remove_copyright)

# replace square brackets in citation with round brackets
from dataclasses import dataclass, field
import sphinxcontrib.bibtex.plugin

from sphinxcontrib.bibtex.style.referencing import BracketStyle
from sphinxcontrib.bibtex.style.referencing.author_year \
import AuthorYearReferenceStyle


def bracket_style() -> BracketStyle:
return BracketStyle(
left='(',
right=')',
)


@dataclass
class RoundBracketReferenceStyle(AuthorYearReferenceStyle):
bracket_parenthetical: BracketStyle = field(default_factory=bracket_style)
bracket_textual: BracketStyle = field(default_factory=bracket_style)
bracket_author: BracketStyle = field(default_factory=bracket_style)
bracket_label: BracketStyle = field(default_factory=bracket_style)
bracket_year: BracketStyle = field(default_factory=bracket_style)


sphinxcontrib.bibtex.plugin.register_plugin(
'sphinxcontrib.bibtex.style.referencing',
'author_year_round', RoundBracketReferenceStyle)

# Custom style for bibliography labels

from pybtex.style.formatting.unsrt import Style as UnsrtStyle
from pybtex.style.labels import BaseLabelStyle
from pybtex.plugin import register_plugin


# a simple label style which uses the bibtex keys for labels
class AuthorYearStyle(BaseLabelStyle):

def format_labels(self, sorted_entries):
for entry in sorted_entries:
# create string for label
yield entry.persons["author"][0].last_names[0] + ", " +\
entry.fields["year"][-4:]


class AuthorYear(UnsrtStyle):

default_label_style = AuthorYearStyle


register_plugin('pybtex.style.formatting', 'author_year', AuthorYear)
6 changes: 2 additions & 4 deletions doc/contribute.rst
Original file line number Diff line number Diff line change
Expand Up @@ -340,10 +340,8 @@ Each module in ``doc/reference`` folder ends with the reference section:
References
----------
.. bibliography:: ../bib/elephant.bib
:labelprefix: <module name shortcut>
:keyprefix: <module name>-
:style: unsrt
.. bibliography::
:keyprefix: <module name>-
where ``<module name>`` is (by convention) the Python source file name, and
``<module name shortcut>`` is what will be displayed to the users.
Expand Down
22 changes: 8 additions & 14 deletions doc/reference/_spike_train_processing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -26,17 +26,11 @@ Spike train synchrony
References
----------

.. bibliography:: ../bib/elephant.bib
:labelprefix: cor
:keyprefix: correlation-
:style: unsrt

.. bibliography:: ../bib/elephant.bib
:labelprefix: ds
:keyprefix: dissimilarity-
:style: unsrt

.. bibliography:: ../bib/elephant.bib
:labelprefix: syn
:keyprefix: synchrony-
:style: unsrt
.. bibliography::
:keyprefix: correlation-

.. bibliography::
:keyprefix: dissimilarity-

.. bibliography::
:keyprefix: synchrony-
6 changes: 2 additions & 4 deletions doc/reference/asset.rst
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,5 @@ Analysis of Sequences of Synchronous EvenTs (ASSET)
References
----------

.. bibliography:: ../bib/elephant.bib
:labelprefix: asset
:keyprefix: asset-
:style: unsrt
.. bibliography::
:keyprefix: asset-
6 changes: 2 additions & 4 deletions doc/reference/causality.rst
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,5 @@ Causality measures
References
----------

.. bibliography:: ../bib/elephant.bib
:labelprefix: gr
:keyprefix: granger-
:style: unsrt
.. bibliography::
:keyprefix: granger-
6 changes: 2 additions & 4 deletions doc/reference/cell_assembly_detection.rst
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,5 @@ Cell assembly detection (CAD)
References
----------

.. bibliography:: ../bib/elephant.bib
:labelprefix: cad
:keyprefix: cad-
:style: unsrt
.. bibliography::
:keyprefix: cad-
4 changes: 1 addition & 3 deletions doc/reference/change_point_detection.rst
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,5 @@ Detection of non-stationary processes
References
----------

.. bibliography:: ../bib/elephant.bib
:labelprefix: cpd
.. bibliography::
:keyprefix: cpd-
:style: unsrt
6 changes: 2 additions & 4 deletions doc/reference/cubic.rst
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,5 @@ Cumulant Based Inference of higher-order Correlation (CuBIC)
References
----------

.. bibliography:: ../bib/elephant.bib
:labelprefix: cubic
:keyprefix: cubic-
:style: unsrt
.. bibliography::
:keyprefix: cubic-
6 changes: 2 additions & 4 deletions doc/reference/gpfa.rst
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,5 @@ Gaussian-Process Factor Analysis (GPFA)
References
----------

.. bibliography:: ../bib/elephant.bib
:labelprefix: gpfa
:keyprefix: gpfa-
:style: unsrt
.. bibliography::
:keyprefix: gpfa-
6 changes: 2 additions & 4 deletions doc/reference/signal_processing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,5 @@ Signal processing
References
----------

.. bibliography:: ../bib/elephant.bib
:labelprefix: sig
:keyprefix: signal-
:style: unsrt
.. bibliography::
:keyprefix: signal-
6 changes: 2 additions & 4 deletions doc/reference/spade.rst
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,5 @@ Spike Pattern Detection and Evaluation (SPADE)
References
----------

.. bibliography:: ../bib/elephant.bib
:labelprefix: spade
:keyprefix: spade-
:style: unsrt
.. bibliography::
:keyprefix: spade-
6 changes: 2 additions & 4 deletions doc/reference/spike_train_surrogates.rst
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,5 @@ Spike train surrogates
References
----------

.. bibliography:: ../bib/elephant.bib
:labelprefix: sr
:keyprefix: surrogates-
:style: unsrt
.. bibliography::
:keyprefix: surrogates-
6 changes: 2 additions & 4 deletions doc/reference/unitary_event_analysis.rst
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,5 @@ VR implemented the method, SG and MD provided guidance.
References
----------

.. bibliography:: ../bib/elephant.bib
:labelprefix: ue
:keyprefix: unitary_event_analysis-
:style: unsrt
.. bibliography::
:keyprefix: unitary_event_analysis-
6 changes: 2 additions & 4 deletions doc/reference/waveform_features.rst
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,5 @@ Waveform features
References
----------

.. bibliography:: ../bib/elephant.bib
:labelprefix: wf
:keyprefix: waveforms-
:style: unsrt
.. bibliography::
:keyprefix: waveforms-
5 changes: 1 addition & 4 deletions elephant/spike_train_generation.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,8 @@
References
----------

.. bibliography:: ../bib/elephant.bib
:labelprefix: gen
.. bibliography::
:keyprefix: generation-
:style: unsrt


:copyright: Copyright 2014-2022 by the Elephant team, see `doc/authors.rst`.
:license: Modified BSD, see LICENSE.txt for details.
Expand Down
4 changes: 1 addition & 3 deletions elephant/statistics.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,8 @@
References
----------

.. bibliography:: ../bib/elephant.bib
:labelprefix: st
.. bibliography::
:keyprefix: statistics-
:style: unsrt


:copyright: Copyright 2014-2022 by the Elephant team, see `doc/authors.rst`.
Expand Down
2 changes: 1 addition & 1 deletion requirements/requirements-docs.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ numpydoc>=1.1.0
jupyter>=1.0.0
sphinx>=3.3.0
nbsphinx>=0.8.0
sphinxcontrib-bibtex==1.0.0
sphinxcontrib-bibtex>1.0.0
sphinx-tabs>=1.3.0
matplotlib>=3.3.2
# conda install -c conda-forge pandoc