From 827cac93a4c61c7bbebb3d8dbec77cc643112ed1 Mon Sep 17 00:00:00 2001 From: Marcel Stimberg Date: Mon, 18 May 2026 17:01:40 +0200 Subject: [PATCH 1/5] Fix extlinks configuration in docs --- docs_sphinx/conf.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs_sphinx/conf.py b/docs_sphinx/conf.py index ad27cb7f0..f3d97eedb 100644 --- a/docs_sphinx/conf.py +++ b/docs_sphinx/conf.py @@ -414,7 +414,7 @@ 'mayavi': ('http://docs.enthought.com/mayavi/mayavi/', None)} # Configure linking to github -extlinks = {'issue': ('https://github.com/brian-team/brian2tools/issues/%s','#')} +extlinks = {'issue': ('https://github.com/brian-team/brian2tools/issues/%s','# %s')} # Create api docs def run_apidoc(_): From 92345cb0573cc8442f3ccc12a02e80f3a5090d77 Mon Sep 17 00:00:00 2001 From: Marcel Stimberg Date: Mon, 18 May 2026 17:01:59 +0200 Subject: [PATCH 2/5] Fix apidoc call --- docs_sphinx/conf.py | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/docs_sphinx/conf.py b/docs_sphinx/conf.py index f3d97eedb..fc8bbb793 100644 --- a/docs_sphinx/conf.py +++ b/docs_sphinx/conf.py @@ -425,9 +425,17 @@ def run_apidoc(_): brian2tools_dir = os.path.abspath(os.path.join(os.path.dirname(__file__), '..', 'brian2tools')) docs_sphinx_dir = os.path.abspath(os.path.join(os.path.dirname(__file__))) - apidoc.main(argv=['-f', '-e', '-M', - '-o', os.path.join(docs_sphinx_dir, 'reference'), - brian2tools_dir, os.path.join(brian2tools_dir, 'tests')]) + apidoc.main( + [ + "-f", + "-e", + "-M", + "-o", + os.path.join(docs_sphinx_dir, "reference"), + brian2tools_dir, + os.path.join(brian2tools_dir, "tests"), + ] + ) def setup(app): app.connect('builder-inited', run_apidoc) From b0e23196183de7eb7f7f678425ec71be8c07f37c Mon Sep 17 00:00:00 2001 From: Marcel Stimberg Date: Mon, 18 May 2026 17:08:57 +0200 Subject: [PATCH 3/5] Define __version__ --- brian2tools/__init__.py | 23 +++++++++++++++++++++++ docs_sphinx/conf.py | 6 ------ 2 files changed, 23 insertions(+), 6 deletions(-) diff --git a/brian2tools/__init__.py b/brian2tools/__init__.py index b6245d873..c0b6b1ebf 100644 --- a/brian2tools/__init__.py +++ b/brian2tools/__init__.py @@ -1,8 +1,31 @@ ''' Tools for use with the Brian 2 simulator. ''' +import logging + from .baseexport import * from .mdexport import * from .nmlexport import * from .plotting import * from .tests import run as test + +try: + from ._version import __version__, __version_tuple__ +except ImportError: + try: + from setuptools_scm import get_version + + __version__ = get_version( + root="..", + relative_to=__file__, + version_scheme="post-release", + local_scheme="no-local-version", + ) + __version_tuple__ = tuple(int(x) for x in __version__.split(".")[:3]) + except ImportError: + logging.getLogger(__name__).warning( + "Cannot determine Brian2tools version, running from source and " + "setuptools_scm is not installed." + ) + __version__ = "unknown" + __version_tuple__ = (0, 0, 0) \ No newline at end of file diff --git a/docs_sphinx/conf.py b/docs_sphinx/conf.py index fc8bbb793..17150571a 100644 --- a/docs_sphinx/conf.py +++ b/docs_sphinx/conf.py @@ -95,12 +95,6 @@ # import brian2tools version = brian2tools.__version__ -if version is None: - try: - from setuptools_scm import get_version - version = get_version(relative_to=brian2tools_dir) - except (ImportError, LookupError): - version = 'unknown' # The language for content autogenerated by Sphinx. Refer to documentation # for a list of supported languages. From 6b698f47b63b7c302202ff82a49d06d94632e1f6 Mon Sep 17 00:00:00 2001 From: Marcel Stimberg Date: Mon, 18 May 2026 17:10:14 +0200 Subject: [PATCH 4/5] Set documentation language --- docs_sphinx/conf.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs_sphinx/conf.py b/docs_sphinx/conf.py index 17150571a..46382ca89 100644 --- a/docs_sphinx/conf.py +++ b/docs_sphinx/conf.py @@ -101,7 +101,7 @@ # # This is also used if you do content translation via gettext catalogs. # Usually you set "language" from the command line for these cases. -language = None +language = "en" # There are two options for replacing |today|: either, you set today to some # non-false value, then it is used: From 3bfcea17c15fb274ae982e7f4dcfde37193daf70 Mon Sep 17 00:00:00 2001 From: Marcel Stimberg Date: Mon, 18 May 2026 17:16:44 +0200 Subject: [PATCH 5/5] Fix minor documentation issues --- docs_sphinx/conf.py | 7 ++++--- docs_sphinx/release_notes.rst | 2 +- docs_sphinx/user/nmlimport.rst | 2 +- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/docs_sphinx/conf.py b/docs_sphinx/conf.py index 46382ca89..ba89872bf 100644 --- a/docs_sphinx/conf.py +++ b/docs_sphinx/conf.py @@ -12,9 +12,9 @@ # All configuration values have a default; values that are commented out # serve to show the default. -import sys import os import shlex +import sys # If extensions (or modules to document with autodoc) are in another directory, # add these directories to sys.path here. If the directory is relative to the @@ -64,7 +64,7 @@ # We mock modules that are not needed just for building the documentation import sys -from unittest.mock import Mock, MagicMock +from unittest.mock import MagicMock, Mock MOCK_MODULES = ['matplotlib', 'matplotlib.colors', 'matplotlib.patches', 'matplotlib.pyplot', 'matplotlib.ticker', 'matplotlib.cm', 'mpl_toolkits', 'mpl_toolkits.axes_grid1', @@ -94,6 +94,7 @@ # built documents. # import brian2tools + version = brian2tools.__version__ # The language for content autogenerated by Sphinx. Refer to documentation @@ -183,7 +184,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 = [] # Add any extra paths that contain custom files (such as robots.txt or # .htaccess) here, relative to this directory. These files are copied diff --git a/docs_sphinx/release_notes.rst b/docs_sphinx/release_notes.rst index 9a936f34d..485b848d8 100644 --- a/docs_sphinx/release_notes.rst +++ b/docs_sphinx/release_notes.rst @@ -10,7 +10,7 @@ This release adds a number of major new features to the package. In particular: biophysical properties. This feature has been developed by Kapil Kumar (`@kapilkd13 `_) as part of the `Google Summer of Code `_ 2018. -* improved support for :doc:`exporting neuronal models to NeuroML , +* improved support for :doc:`exporting neuronal models to NeuroML `, and a new :doc:`general framework to export model descriptions `. As a demonstration of this framework, it is now possible to export a Brian model description as :doc:`human-readable markdown `. This feature has diff --git a/docs_sphinx/user/nmlimport.rst b/docs_sphinx/user/nmlimport.rst index e8d4bb30b..58af0a2ed 100644 --- a/docs_sphinx/user/nmlimport.rst +++ b/docs_sphinx/user/nmlimport.rst @@ -189,7 +189,7 @@ about the cell: A dictionary with general properties such as the threshold condition or the intracellular resistivity. The names are chosen to be consistent with the argument names in `.~SpatialNeuron`, in many cases you should therefore be able to directly - pass this dictionary: ``neuron = SpatialNeuron(..., **nml_object.properties)` + pass this dictionary: ``neuron = SpatialNeuron(..., **nml_object.properties)`` ``channel_properties``: A dictionary of reversal potentials and conductance densities for the different channels in the cell. The dictionary maps the name of segment groups to the name