Skip to content
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
12 changes: 9 additions & 3 deletions .github/workflows/full-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,11 @@ jobs:
strategy:
fail-fast: true
matrix:
python-version: ["3.8", "3.10", "3.12"]
python-version: ["3.9", "3.10", "3.12"]
os: ["ubuntu-latest", "windows-latest"]
steps:
- uses: actions/checkout@v4
- uses: mpi4py/setup-mpi@v1
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
Expand All @@ -31,7 +32,7 @@ jobs:
- name: Install basic Python dependencies
run: |
python -m pip install --upgrade pip
python -m pip install pytest pytest-cov coveralls flake8
python -m pip install pytest pytest-cov coveralls flake8 "setuptools<=75.8.2" "numpy<2"
- name: Install Brian 2
run: |
python -m pip install brian2
Expand All @@ -52,13 +53,18 @@ jobs:
- name: Install PyNN itself
run: |
pip install -e ".[test]"
- name: Test installation has worked
- name: Test installation has worked (Ubuntu)
# this is needed because the PyNN tests are just skipped if the simulator
# fails to install, so we need to catch import failures separately
if: startsWith(matrix.os, 'ubuntu')
run: |
python -c "import pyNN.nest"
python -c "import pyNN.neuron"
python -c "import pyNN.brian2"
- name: Test installation has worked (Windows)
if: startsWith(matrix.os, 'windows')
run: |
python -c "import pyNN.brian2"
- name: Lint with flake8
run: |
# stop the build if there are Python syntax errors or undefined names
Expand Down
2 changes: 1 addition & 1 deletion doc/developers/contributing.txt
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ We try to stay fairly close to PEP8_. Please note in particular:
- some function/method names in PyNN use ``mixedCase``, but these will
gradually be deprecated and replaced with ``lower_case_with_underscores``.
Any new functions or methods should use the latter.
- we currently target versions 3.8+
- we currently target versions 3.9+


Testing
Expand Down
4 changes: 2 additions & 2 deletions doc/installation.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ install and run PyNN on Windows, but this has not been tested.

Installing PyNN requires:

* Python (version 3.8+)
* Python (version 3.9+)
* a recent version of the NumPy_ package
* the lazyarray_ package
* the Neo_ package (>= 0.11.0)
* the Neo_ package (>= 0.13.4)
* at least one of the supported simulators: e.g. NEURON, NEST, Brian 2 or Arbor.

Optional dependencies are:
Expand Down
2 changes: 1 addition & 1 deletion pyNN/common/projections.py
Original file line number Diff line number Diff line change
Expand Up @@ -443,7 +443,7 @@ def save(self, attribute_names, file, format='list', gather=True, with_address=T
if attribute_names in ('all', 'connections'):
attribute_names = self.synapse_type.get_parameter_names()
if isinstance(file, str):
file = recording.files.StandardTextFile(file, mode='wb')
file = recording.files.StandardTextFile(file, mode='w')
all_values = self.get(attribute_names, format=format,
gather=gather, with_address=with_address)
if format == 'array':
Expand Down
16 changes: 2 additions & 14 deletions pyNN/recording/files.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,17 +28,6 @@
DEFAULT_BUFFER_SIZE = 10000


def _savetxt(filename, data, format, delimiter):
"""
Due to the lack of savetxt in older versions of numpy
we provide a cut-down version of that function.
"""
f = open(filename, 'w')
for row in data:
f.write(delimiter.join([format % val for val in row]) + '\n')
f.close()


def savez(file, *args, **kwds):
import zipfile
from numpy.lib import format
Expand Down Expand Up @@ -148,10 +137,9 @@ def write(self, data, metadata):
# write header
header_lines = ["# %s = %s" % item for item in metadata.items()]
header = "\n".join(header_lines) + '\n'
self.fileobj.write(header.encode('utf-8'))
self.fileobj.write(header)
# write data
savetxt = getattr(np, 'savetxt', _savetxt)
savetxt(self.fileobj, data, fmt='%r', delimiter='\t')
np.savetxt(self.fileobj, data, delimiter='\t')
self.fileobj.close()

def read(self):
Expand Down
8 changes: 3 additions & 5 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name = "PyNN"
version = "0.12.3"
description = "A Python package for simulator-independent specification of neuronal network models"
readme = "README.rst"
requires-python = ">=3.8"
requires-python = ">=3.9"
license = {text = "CeCILL http://www.cecill.info"}
authors = [
{name = "The PyNN team", email = "pynn-maintainers@protonmail.com"}
Expand All @@ -20,19 +20,17 @@ classifiers = [
"Natural Language :: English",
"Operating System :: OS Independent",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
"Topic :: Education",
"Topic :: Scientific/Engineering"
]
dependencies = [
"numpy>=1.18.5",
"lazyarray>=0.5.2",
"neo>=0.11.0",
"quantities>=0.12.1",
"neo>=0.13.4",
"morphio"
]

Expand Down
7 changes: 0 additions & 7 deletions test/system/test_neuron.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,6 @@
have_neuroml = False


skip_ci = False
if "JENKINS_SKIP_TESTS" in os.environ:
skip_ci = os.environ["JENKINS_SKIP_TESTS"] == "1"


def test_ticket168():
"""
Error setting firing rate of `SpikeSourcePoisson` after `reset()` in NEURON
Expand Down Expand Up @@ -131,8 +126,6 @@ class SimpleNeuronType(NativeCellType):

def test_electrical_synapse():
pytest.skip("Skipping test for now as it produces a segmentation fault")
if skip_ci:
pytest.skip("Skipping test on CI server as it produces a segmentation fault")
p1 = pyNN.neuron.Population(4, pyNN.neuron.standardmodels.cells.HH_cond_exp())
p2 = pyNN.neuron.Population(4, pyNN.neuron.standardmodels.cells.HH_cond_exp())
syn = pyNN.neuron.ElectricalSynapse(weight=1.0)
Expand Down
2 changes: 1 addition & 1 deletion test/unittests/test_connectors_parallel.py
Original file line number Diff line number Diff line change
Expand Up @@ -448,7 +448,7 @@ def test_with_plastic_synapses_not_distributed(self, sim=sim):
(2, 2, 0.4, 0.13, 130, 97),
(0, 1, 0.5, 0.14, 140, 96), # local
]
file = recording.files.StandardTextFile("test.connections.2", mode='wb')
file = recording.files.StandardTextFile("test.connections.2", mode='w')
file.write(connection_list, {"columns": ["i", "j", "weight", "delay", "U", "tau_rec"]})
C = connectors.FromFileConnector("test.connections.2", distributed=False)
syn = sim.TsodyksMarkramSynapse(tau_facil=88.8)
Expand Down
2 changes: 1 addition & 1 deletion test/unittests/test_connectors_serial.py
Original file line number Diff line number Diff line change
Expand Up @@ -555,7 +555,7 @@ def test_with_plastic_synapses_not_distributed(self, sim=sim):
(2, 2, 0.4, 0.13, 130, 97),
(0, 1, 0.5, 0.14, 140, 96), # local
]
file = recording.files.StandardTextFile("test.connections.2", mode='wb')
file = recording.files.StandardTextFile("test.connections.2", mode='w')
file.write(connection_list, {"columns": ["i", "j", "weight", "delay", "U", "tau_rec"]})
C = connectors.FromFileConnector("test.connections.2", distributed=False)
syn = sim.TsodyksMarkramSynapse(tau_facil=88.8)
Expand Down
14 changes: 0 additions & 14 deletions test/unittests/test_files.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,20 +11,6 @@
builtin_open = open


def test__savetxt():
mock_file = Mock()
files.open = Mock(return_value=mock_file)
files._savetxt(filename="dummy_file",
data=[(0, 2.3), (1, 3.4), (2, 4.3)],
format="%f",
delimiter=" ")
target = [(('0.000000 2.300000\n',), {}),
(('1.000000 3.400000\n',), {}),
(('2.000000 4.300000\n',), {})]
assert mock_file.write.call_args_list == target
files.open = builtin_open


def test_create_BaseFile():
files.open = Mock()
bf = files.BaseFile("filename", 'r')
Expand Down