Skip to content

Commit

Permalink
Merge pull request #60 from SpiNNakerManchester/doc-ver-pretty
Browse files Browse the repository at this point in the history
Get nicer version numbers in the documentation
  • Loading branch information
dkfellows committed Apr 12, 2021
2 parents 9a3dfa9 + 8b647de commit 4936579
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 13 deletions.
19 changes: 12 additions & 7 deletions docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
from mock import Mock as MagicMock
import inspect
import os
import re


class Mock(MagicMock):
Expand Down Expand Up @@ -62,7 +63,7 @@ def __getattr__(cls, name):
# Note that this has to go AFTER we have updated sys.path!
# This is because RTD doesn't actually install our checkout.
import spalloc # noqa: E402
from spalloc import __version__ as version # noqa: E402
from spalloc import __version__ as release # noqa: E402

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

Expand Down Expand Up @@ -107,9 +108,11 @@ def __getattr__(cls, name):
# |version| and |release|, also used in various other places throughout the
# built documents.
#
_tagver = re.sub(r"^\d+!", "", release)
# The short X.Y version.
version = re.sub(r"^(\d+!)?(\d+\.\d+).*$", r"\2", _tagver)
# The full version, including alpha/beta/rc tags.
release = version
# release = ""

# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
Expand Down Expand Up @@ -167,6 +170,8 @@ def linkcode_resolve(domain, info):
This code is derived from the version used by `Numpy
<https://github.com/numpy/numpy/blob/v1.9.2/doc/source/conf.py#L286>`_.
"""
# pylint: disable=broad-except

# Only link to Python source
if domain != 'py':
return None
Expand Down Expand Up @@ -211,11 +216,11 @@ def linkcode_resolve(domain, info):

# Generate a link to the code in the official GitHub repository with the
# current-version's tag.
return ("https://github.com/{repo}/blob/v{version}/"
"{module_path}{file_name}{linespec}"
"".format(repo=github_repo, version=version,
module_path=github_module_path, file_name=file_name,
linespec=linespec))
return ("https://github.com/{repo}/blob/{version}/"
"{module_path}{file_name}{linespec}".format(
repo=github_repo, version=_tagver,
module_path=github_module_path, file_name=file_name,
linespec=linespec))


# -- Options for HTML output ----------------------------------------------
Expand Down
10 changes: 5 additions & 5 deletions spalloc/job.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,11 @@ class Job(object):
SpiNNaker boards.
Constructing a :py:class:`.Job` object connects to a `spalloc-server
<https://github.com/project-rig/spalloc_server>`_ and requests a number of
SpiNNaker boards. See the :py:meth:`constructor <.Job.__init__>` for
details of the types of requests which may be made. The job object may then
be used to monitor the state of the request, control the boards allocated
and determine their IP addresses.
<https://github.com/SpiNNakerManchester/spalloc_server>`_ and requests a
number of SpiNNaker boards. See the :py:meth:`constructor <.Job.__init__>`
for details of the types of requests which may be made. The job object may
then be used to monitor the state of the request, control the boards
allocated and determine their IP addresses.
In its simplest form, a :py:class:`.Job` can be used as a context manager
like so::
Expand Down
2 changes: 1 addition & 1 deletion spalloc/protocol_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ def __init__(self):

class ProtocolClient(AbstractContextManager):
""" A simple (blocking) client implementation of the `spalloc-server
<https://github.com/project-rig/spalloc_server>`_ protocol.
<https://github.com/SpiNNakerManchester/spalloc_server>`_ protocol.
This minimal implementation is intended to serve both simple applications
and as an example implementation of the protocol for other applications.
Expand Down

0 comments on commit 4936579

Please sign in to comment.