Skip to content

Commit 2a956bd

Browse files
authored
Merge pull request #920 from SpiNNakerManchester/actrions1
Turn on github actions Python side
2 parents 888087d + 4101298 commit 2a956bd

25 files changed

Lines changed: 430 additions & 163 deletions
Lines changed: 163 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,163 @@
1+
# Copyright (c) 2020 The University of Manchester
2+
#
3+
# This program is free software: you can redistribute it and/or modify
4+
# it under the terms of the GNU General Public License as published by
5+
# the Free Software Foundation, either version 3 of the License, or
6+
# (at your option) any later version.
7+
#
8+
# This program is distributed in the hope that it will be useful,
9+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
10+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11+
# GNU General Public License for more details.
12+
#
13+
# You should have received a copy of the GNU General Public License
14+
# along with this program. If not, see <http://www.gnu.org/licenses/>.
15+
16+
# This workflow will install Python dependencies, run tests, lint and rat with a variety of Python versions
17+
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions
18+
19+
name: Python Actions
20+
21+
on: [push]
22+
23+
jobs:
24+
build:
25+
26+
runs-on: ubuntu-latest
27+
strategy:
28+
matrix:
29+
python-version: [2.7, 3.6, 3.7, 3.8]
30+
31+
steps:
32+
- name: Set up Python ${{ matrix.python-version }}
33+
uses: actions/setup-python@v2
34+
with:
35+
python-version: ${{ matrix.python-version }}
36+
37+
- name: Checkout
38+
uses: actions/checkout@v2
39+
- name: Checkout SupportScripts
40+
uses: actions/checkout@v2
41+
with:
42+
repository: SpiNNakerManchester/SupportScripts
43+
path: support
44+
45+
- name: Checkout Spinnaker Dependencies
46+
run: |
47+
support/gitclone2.sh https://github.com/SpiNNakerManchester/SpiNNUtils.git
48+
support/gitclone2.sh https://github.com/SpiNNakerManchester/SpiNNMachine.git
49+
support/gitclone2.sh https://github.com/SpiNNakerManchester/SpiNNMan.git
50+
support/gitclone2.sh https://github.com/SpiNNakerManchester/PACMAN.git
51+
support/gitclone2.sh https://github.com/SpiNNakerManchester/DataSpecification.git
52+
support/gitclone2.sh https://github.com/SpiNNakerManchester/spalloc.git
53+
support/gitclone2.sh git://github.com/SpiNNakerManchester/SpiNNFrontEndCommon.git
54+
55+
- name: Install -pip
56+
run: |
57+
python -m pip install --upgrade pip
58+
pip install 'pylint<2.5' python-coveralls 'coverage>=4.4,<5.0'
59+
60+
- name: Install SpiNNUtils
61+
run: python setup.py install
62+
working-directory: SpiNNUtils
63+
64+
- name: Install SpiNNMachine
65+
run: python setup.py install
66+
working-directory: SpiNNMachine
67+
68+
- name: Install SpiNNMan
69+
run: python setup.py install
70+
working-directory: SpiNNMan
71+
72+
- name: preinstall pacman requirements (2.7 only)
73+
if: matrix.python-version == 2.7
74+
run: pip install -r requirements.txt
75+
working-directory: PACMAN
76+
77+
- name: Install PACMAN
78+
run: python setup.py install
79+
working-directory: PACMAN
80+
81+
- name: Install DataSpecification
82+
run: python setup.py install
83+
working-directory: DataSpecification
84+
85+
- name: Install spalloc
86+
run: python setup.py install
87+
working-directory: spalloc
88+
89+
- name: preinstall SpiNNFrontEndCommon requirements (2.7 Only)
90+
if: matrix.python-version == 2.7
91+
run: pip install -r requirements.txt
92+
working-directory: SpiNNFrontEndCommon
93+
94+
- name: Install SpiNNFrontEndCommon
95+
run: python setup.py install
96+
working-directory: SpiNNFrontEndCommon
97+
98+
- name: Preinstall requirements (2.7 Only)
99+
if: matrix.python-version == 2.7
100+
run: |
101+
pip install -r requirements.txt
102+
103+
- name: Setup
104+
run: |
105+
python setup.py develop
106+
107+
- name: Install requirements-test
108+
run: |
109+
pip install -r requirements-test.txt
110+
111+
- name: Create a spynnaker.cfg
112+
run: |
113+
echo '[Machine]' > ~/.spynnaker.cfg
114+
echo "machineName = $SPINNAKER_BOARD_ADDRESS" >> ~/.spynnaker.cfg
115+
echo "version = ${SPINNAKER_BOARD_VERSION:-5}" >> ~/.spynnaker.cfg
116+
echo '[Database]' >> ~/.spynnaker.cfg
117+
echo '[Simulation]' >> ~/.spynnaker.cfg
118+
echo '[Buffers]' >> ~/.spynnaker.cfg
119+
120+
- name: Test with pytest and coverage
121+
if: matrix.python-version == 3.6
122+
run: |
123+
pytest unittests --cov spynnaker
124+
125+
- name: Test with pytest
126+
if: matrix.python-version != 3.6
127+
run: |
128+
pytest unittests
129+
130+
- name: Lint with flake8
131+
run: |
132+
# run flake8
133+
flake8 spynnaker unittests
134+
135+
- name: Lint with pylint
136+
# Broken in 2.7 as it can not find data_specification.exceptions
137+
if: matrix.python-version != 2.7
138+
# Note that there's special conditioning of the return code of pylint
139+
run: |
140+
pylint --output-format=colorized --disable=R,C spynnaker || exit $(($? & 35))
141+
142+
- name: Run rat copyright enforcement
143+
if: matrix.python-version == 3.6
144+
run: |
145+
support/rat.sh download
146+
support/rat.sh run
147+
148+
- name: Build documentation with sphinx
149+
# TODO turn sphinx back on
150+
if: matrix.python-version == 13.6
151+
run: |
152+
cd doc/source
153+
sphinx-build -W -T -E -b html -d _build/doctrees-readthedocsdirhtml -D language=en . _build/html
154+
sphinx-build -W -T -b json -d _build/doctrees-json -D language=en . _build/json
155+
sphinx-build -W -T -b singlehtml -d _build/doctrees-readthedocssinglehtmllocalmedia -D language=en . _build/localmedia
156+
157+
- name: Run coveralls and report coverage
158+
if: matrix.python-version == 3.6
159+
env:
160+
COVERALLS_SERVICE_NAME: 'GitHub CI'
161+
COVERALLS_REPO_TOKEN : ${{ secrets.COVERALLS_REPO_TOKEN }}
162+
NODE_COVERALLS_DEBUG: 1
163+
run: coveralls

.ratexcludes

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,10 @@
99
**/neural_modelling/builds/**/*.txt
1010
**/.nojekyll
1111
**/*.tag
12+
**/SpiNNUtils/**
13+
**/SpiNNMachine/**
14+
**/SpiNNMan/**
15+
**/PACMAN/**
16+
**/DataSpecification/**
17+
**/spalloc/**
18+
**/SpiNNFrontEndCommon/**

spynnaker/pyNN/external_devices_models/external_spinnaker_link_fpga_retina_device.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ def __init__(
9494
The SpiNNaker link to which the retina is connected
9595
:param str polarity: The "polarity" of the retina data
9696
:param str label:
97-
:param sr board_address:
97+
:param str board_address:
9898
"""
9999
# pylint: disable=too-many-arguments
100100
self.__polarity = polarity

spynnaker/pyNN/external_devices_models/push_bot/abstract_push_bot_retina_device.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ def __init__(self, protocol, resolution):
2929
"""
3030
:param protocol:
3131
:type protocol:
32-
MunichIOEthernetProtocol or MunichIoSpiNNakerLinkProtocol
32+
MunichIoEthernetProtocol or MunichIoSpiNNakerLinkProtocol
3333
:param PushBotRetinaResolution resolution:
3434
"""
3535
self._protocol = protocol

spynnaker/pyNN/models/abstract_models/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515

1616
from .abstract_accepts_incoming_synapses import AbstractAcceptsIncomingSynapses
1717
from .abstract_contains_units import AbstractContainsUnits
18+
from .abstract_has_delay_stages import AbstractHasDelayStages
1819
from .abstract_max_spikes import AbstractMaxSpikes
1920
from .abstract_population_initializable import AbstractPopulationInitializable
2021
from .abstract_population_settable import AbstractPopulationSettable
@@ -26,6 +27,7 @@
2627
from .abstract_weight_updatable import AbstractWeightUpdatable
2728

2829
__all__ = ["AbstractAcceptsIncomingSynapses", "AbstractContainsUnits",
30+
"AbstractHasDelayStages",
2931
"AbstractMaxSpikes", "AbstractPopulationInitializable",
3032
"AbstractPopulationSettable", "AbstractReadParametersBeforeSet",
3133
"AbstractSettable", "AbstractSynapseExpandable",

spynnaker/pyNN/models/abstract_models/abstract_accepts_incoming_synapses.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ def get_connections_from_machine(
5252
# pylint: disable=too-many-arguments
5353
""" Get the connections from the machine post-run.
5454
55-
:param ~spinnman.Transceiver transceiver:
55+
:param ~spinnman.transceiver.Transceiver transceiver:
5656
How to read the connection data
5757
:param ~pacman.model.placements.Placements placements:
5858
Where the connection data is on the machine
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
# Copyright (c) 2017-2019 The University of Manchester
2+
#
3+
# This program is free software: you can redistribute it and/or modify
4+
# it under the terms of the GNU General Public License as published by
5+
# the Free Software Foundation, either version 3 of the License, or
6+
# (at your option) any later version.
7+
#
8+
# This program is distributed in the hope that it will be useful,
9+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
10+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11+
# GNU General Public License for more details.
12+
#
13+
# You should have received a copy of the GNU General Public License
14+
# along with this program. If not, see <http://www.gnu.org/licenses/>.
15+
16+
from six import add_metaclass
17+
from spinn_utilities.abstract_base import (
18+
AbstractBase, abstractproperty)
19+
20+
21+
@add_metaclass(AbstractBase)
22+
class AbstractHasDelayStages(object):
23+
""" Indicates that this object (a vertex) has delay stages that are used \
24+
to increase the space required for bitfields in \
25+
:py:func:`spynnaker.pyNN.utilities.bit_field_utilities.get_estimated_sdram_for_bit_field_region`
26+
"""
27+
28+
__slots__ = ()
29+
30+
@abstractproperty
31+
def n_delay_stages(self):
32+
""" The maximum number of delay stages required by any connection\
33+
out of this delay extension vertex
34+
35+
:rtype: int
36+
"""

spynnaker/pyNN/models/abstract_models/abstract_synapse_expandable.py

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -21,37 +21,40 @@
2121

2222
@add_metaclass(AbstractBase)
2323
class AbstractSynapseExpandable(object):
24-
""" Indicates a class (most likely a MachineVertex) that has may need to
24+
""" Indicates a class (most likely a MachineVertex) that has may need to\
2525
run the SYNAPSE_EXPANDER aplx
2626
27-
Cores that do not use the synapse_manager should not implement this
28-
api even though their app vertex may hold a synapse_manager
27+
Cores that do not use the synapse_manager should not implement this
28+
API even though their app vertex may hold a synapse_manager
2929
30-
Note: This is NOT implemented by the DelayExtensionMachineVertex
30+
.. note::
31+
This is NOT implemented by the DelayExtensionMachineVertex
3132
which needs a different expander aplx
3233
"""
3334

3435
__slots__ = ()
3536

3637
@abstractmethod
3738
def gen_on_machine(self):
38-
3939
"""
4040
True if the synapses of a the slice of this vertex should be generated
4141
on the machine.
4242
43-
Note: The typical implementation for this method will be to ask the
44-
app_vertex's synapse_manager
43+
.. note::
44+
The typical implementation for this method will be to ask the
45+
app_vertex's synapse_manager
4546
"""
4647

4748
@abstractmethod
4849
def read_generated_connection_holders(self, transceiver, placement):
4950
""" Fill in the connection holders
5051
52+
.. note::
53+
The typical implementation for this method will be to ask the
54+
app_vertex's synapse_manager
5155
52-
Note: The typical implementation for this method will be to ask the
53-
app_vertex's synapse_manager
54-
55-
:param Transceiver transceiver: How the data is to be read
56-
:param Placement placement: Where the data is on the machine
56+
:param ~spinnman.transceiver.Transceiver transceiver:
57+
How the data is to be read
58+
:param ~pacman.model.placements.Placement placement:
59+
Where the data is on the machine
5760
"""

spynnaker/pyNN/models/common/neuron_recorder.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -753,7 +753,7 @@ def write_neuron_recording_region(
753753
754754
:param ~data_specification.DataSpecificationGenerator spec: dsg spec
755755
:param int neuron_recording_region: the recording region
756-
:param ~pacman.model.graphs.commmon.Slice vertex_slice:
756+
:param ~pacman.model.graphs.common.Slice vertex_slice:
757757
the vertex slice
758758
:param int data_n_time_steps: how many time steps to run this time
759759
:rtype: None

spynnaker/pyNN/models/neural_projections/projection_application_edge.py

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ def forget_machine_edges(self):
168168

169169
def __check_list_mode(self):
170170
"""
171-
Makes sure the pre and post slices are sorted lists
171+
Makes sure the pre- and post-slices are sorted lists
172172
"""
173173
if not self.__slices_list_mode:
174174
self.__pre_slices = sorted(
@@ -179,34 +179,32 @@ def __check_list_mode(self):
179179

180180
@property
181181
def pre_slices(self):
182-
"""
183-
Get the slices for the pre_vertexes of the MachineEdges
182+
""" Get the slices for the pre_vertexes of the MachineEdges
184183
185184
While the remember machine_edges remain unchanged this will return a
186-
list with a consitent id. If the edges change a new list is created
185+
list with a consistent id. If the edges change a new list is created
187186
188187
The List will be sorted by lo_atom.
189188
No checking is done for overlaps or gaps
190189
191-
:return: Ordered list of pre slices
192-
:rtype list(Slice)
190+
:return: Ordered list of pre-slices
191+
:rtype: list(~pacman.model.graphs.common.Slice)
193192
"""
194193
self.__check_list_mode()
195194
return self.__pre_slices
196195

197196
@property
198197
def post_slices(self):
199-
"""
200-
Get the slices for the post_vertexes of the MachineEdges
198+
""" Get the slices for the post_vertexes of the MachineEdges
201199
202200
While the remember machine_edges remain unchanged this will return a
203-
list with a consitent id. If the edges change a new list is created
201+
list with a consistent id. If the edges change a new list is created
204202
205203
The List will be sorted by lo_atom.
206204
No checking is done for overlaps or gaps
207205
208-
:return: Ordered list of post slices
209-
:rtype list(Slice)
206+
:return: Ordered list of post-slices
207+
:rtype: list(~pacman.model.graphs.common.Slice)
210208
"""
211209
self.__check_list_mode()
212210
return self.__post_slices

0 commit comments

Comments
 (0)