diff --git a/.github/workflows/c_actions.yml b/.github/workflows/c_actions.yml index 49155427a7..41cb2461a0 100644 --- a/.github/workflows/c_actions.yml +++ b/.github/workflows/c_actions.yml @@ -37,18 +37,25 @@ jobs: uses: ./support/actions/apt-get-install with: packages: doxygen gcc-arm-none-eabi - - name: Checkout SpiNNaker Dependencies - uses: ./support/actions/checkout-spinn-deps + + - name: Checkout SpiNNaker C Dependencies + uses: ./support/actions/install-spinn-deps with: # Note: SpiNNUtils needed for spinn_utilities.make_tools - repositories: spinnaker_tools spinn_common SpiNNFrontEndCommon SpiNNUtils + repositories: spinnaker_tools spinn_common SpiNNFrontEndCommon + install: false + + - name: "Prepare: Install SpiNNUtils" + uses: ./support/actions/install-spinn-deps + with: + # Note: SpiNNUtils needed for spinn_utilities.make_tools + repositories: SpiNNUtils + install: true + - name: Set environment variables run: | echo "SPINN_DIRS=$PWD/spinnaker_tools" >> $GITHUB_ENV echo "NEURAL_MODELLING_DIRS=$PWD/neural_modelling" >> $GITHUB_ENV - - name: Install SpiNNUtils - run: python setup.py install - working-directory: SpiNNUtils - name: Lint C code using Vera++ uses: ./support/actions/vera diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index e358b85ac1..4a0e10df77 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -44,20 +44,22 @@ jobs: echo "NEURAL_MODELLING_DIRS=$PWD/neural_modelling" >> $GITHUB_ENV - name: Install pip, etc uses: ./support/actions/python-tools + - name: Checkout SpiNNaker Dependencies - uses: ./support/actions/checkout-spinn-deps + uses: ./support/actions/install-spinn-deps with: repositories: > spinnaker_tools SpiNNUtils SpiNNMachine SpiNNMan PACMAN DataSpecification spalloc SpiNNFrontEndCommon TestBase install: true + - name: Install matplotlib uses: ./support/actions/install-matplotlib - name: Read tags run: make doxysetup working-directory: neural_modelling - name: Setup - uses: ./support/actions/run-setup + uses: ./support/actions/run-install - name: Build Python Documentation uses: ./support/actions/sphinx diff --git a/.github/workflows/python_actions.yml b/.github/workflows/python_actions.yml index e1a51d35f5..03c5440978 100644 --- a/.github/workflows/python_actions.yml +++ b/.github/workflows/python_actions.yml @@ -48,17 +48,21 @@ jobs: python-version: ${{ matrix.python-version }} - name: Install pip, etc uses: ./support/actions/python-tools + - name: Install Spinnaker Dependencies - uses: ./support/actions/checkout-spinn-deps + uses: ./support/actions/install-spinn-deps with: repositories: > SpiNNUtils SpiNNMachine SpiNNMan PACMAN DataSpecification spalloc SpiNNFrontEndCommon TestBase install: true + - name: Install matplotlib uses: ./support/actions/install-matplotlib + - name: Setup - uses: ./support/actions/run-setup + uses: ./support/actions/run-install + - name: Setup PyNN uses: ./support/actions/pynn-setup - name: Create a spynnaker.cfg @@ -107,7 +111,7 @@ jobs: - name: Install pip, etc uses: ./support/actions/python-tools - name: Install Spinnaker Dependencies - uses: ./support/actions/checkout-spinn-deps + uses: ./support/actions/install-spinn-deps with: repositories: > SpiNNUtils SpiNNMachine SpiNNMan PACMAN DataSpecification spalloc @@ -115,8 +119,8 @@ jobs: install: true - name: Install matplotlib uses: ./support/actions/install-matplotlib - - name: Setup - uses: ./support/actions/run-setup + - name: Install + uses: ./support/actions/run-install - name: Setup PyNN uses: ./support/actions/pynn-setup diff --git a/MANIFEST.in b/MANIFEST.in index 8606192875..62ac48dd8c 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -1 +1 @@ -include CITATION.cff LICENSE.md requirements.txt pypi_to_import \ No newline at end of file +include CITATION.cff LICENSE LICENSE_POLICY.md README.md \ No newline at end of file diff --git a/requirements-test.txt b/pyproject.toml similarity index 67% rename from requirements-test.txt rename to pyproject.toml index 47174b2f8b..4e9ac9943a 100644 --- a/requirements-test.txt +++ b/pyproject.toml @@ -1,4 +1,4 @@ -# Copyright (c) 2017 The University of Manchester +# Copyright (c) 2023 The University of Manchester # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -12,16 +12,6 @@ # See the License for the specific language governing permissions and # limitations under the License. --r requirements.txt -SpiNNakerTestBase == 1!6.0.1 -flake8 -coverage >= 4.4, < 5.0 -# pytest will be brought in by pytest-cov -pytest-cov -pytest-timeout -pytest-forked -pytest-progress -sphinx >= 4 -testfixtures -mock -graphviz +[build-system] +requires = ["setuptools"] +build-backend = "setuptools.build_meta:" \ No newline at end of file diff --git a/requirements.txt b/requirements.txt deleted file mode 100644 index b940a86c3f..0000000000 --- a/requirements.txt +++ /dev/null @@ -1,30 +0,0 @@ -# Copyright (c) 2017 The University of Manchester -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -SpiNNUtilities == 1!6.0.1 -SpiNNMachine == 1!6.0.1 -SpiNNMan == 1!6.0.1 -SpiNNaker_PACMAN == 1!6.0.1 -SpiNNaker_DataSpecification == 1!6.0.1 -spalloc == 1!6.0.1 -SpiNNFrontEndCommon == 1!6.0.1 -matplotlib < 3.5.99; python_version == '3.7' -matplotlib; python_version >= '3.8' -quantities >= 0.12.1 -pynn >= 0.9.1, < 0.10 -lazyarray >= 0.2.9, <= 0.4.0 -appdirs >= 1.4.2 , < 2.0.0 -neo >= 0.5.2, < 0.10.0 -# csa # needed but excluded due to readthedocs -# spinnaker_tools diff --git a/setup.cfg b/setup.cfg new file mode 100644 index 0000000000..937c4f1170 --- /dev/null +++ b/setup.cfg @@ -0,0 +1,86 @@ +# Copyright (c) 2023 The University of Manchester +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +[metadata] +name = sPyNNaker +version = attr: spynnaker._version.__version__ +description = Tools for simulating neural models generated using + PyNN 0.9 on the SpiNNaker platform +long_description = file: README.md +long_description_content_type = text/markdown +url = https://github.com/SpiNNakerManchester/SpyNNaker +license = Apache-2.0 +classifiers = + Development Status :: 5 - Production/Stable + Intended Audience :: Developers + Intended Audience :: Science/Research + License :: OSI Approved :: Apache License 2.0 + Natural Language :: English + Operating System :: POSIX :: Linux + Operating System :: Microsoft :: Windows + Operating System :: MacOS + Programming Language :: Python :: 3 + Programming Language :: Python :: 3.7 + Programming Language :: Python :: 3.8 + Programming Language :: Python :: 3.9 + Programming Language :: Python :: 3.10 + Programming Language :: Python :: 3.11 +maintainer = SpiNNakerTeam +maintainer_email = spinnakerusers@googlegroups.com +keywords = + spinnaker + pynn + +[options] +python_requires = >=3.7, <4 +packages = find: +zip_safe = True +include_package_data = True +install_requires = + SpiNNFrontEndCommon == 1!6.0.1 + matplotlib + pyparsing>=2.2.1,<3.0.0 + quantities >= 0.12.1 + pynn >= 0.9.1, < 0.10.0 + lazyarray >= 0.2.9, <= 0.4.0 + neo >= 0.5.2, < 0.10.0 + # below may fail for read the docs + scipy + csa + +[options.packages.find] +include = + spynnaker + spynnaker.* + spynnaker8 + spynnaker8.* + +[options.package_data] +spynnaker.pyNN.model_binaries = + *.aplx + *.dict +* = + spynnaker.cfg + *.sql + + +[options.extras_require] +test = + SpiNNakerTestBase == 1!6.0.1 + # pytest will be brought in by pytest-cov + pytest-cov + testfixtures + mock + graphviz + diff --git a/setup.py b/setup.py index 4c5f27ef13..bb8feb390a 100644 --- a/setup.py +++ b/setup.py @@ -1,4 +1,4 @@ -# Copyright (c) 2014 The University of Manchester +# Copyright (c) 2023 The University of Manchester # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -12,114 +12,22 @@ # See the License for the specific language governing permissions and # limitations under the License. +import distutils.dir_util +from setuptools import setup import os -from collections import defaultdict -try: - from setuptools import setup -except ImportError: - from distutils.core import setup - -__version__ = None -__version_type__ = None -exec(open("spynnaker/_version.py").read()) -assert __version__ - -long_description = {} -this_directory = os.path.abspath(os.path.dirname(__file__)) -try: - with open(os.path.join(this_directory, 'README.md'), - encoding="utf-8") as f: - long_description["long_description"] = f.read() - long_description["long_description_content_type"] = "text/markdown" -except IOError: - # If we can't read the long description, so be it; it's not a fatal error - pass - -install_requires = [ - 'SpiNNUtilities == 1!6.0.1', - 'SpiNNMachine == 1!6.0.1', - 'SpiNNMan == 1!6.0.1', - 'SpiNNaker_PACMAN == 1!6.0.1', - 'SpiNNaker_DataSpecification == 1!6.0.1', - 'spalloc == 1!6.0.1', - 'SpiNNFrontEndCommon == 1!6.0.1', - "matplotlib < 3.5.99; python_version == '3.7'", - "matplotlib; python_version >= '3.8'", - 'pyparsing>=2.2.1,<3.0.0', - 'quantities >= 0.12.1', - 'pynn >= 0.9.1, < 0.10.0 ', - 'lazyarray >= 0.2.9, <= 0.4.0', - 'appdirs >= 1.4.2 , < 2.0.0', - 'neo >= 0.5.2, < 0.10.0'] -if os.environ.get('READTHEDOCS', None) != 'True': - # scipy must be added in config.py as a mock - # csa is a badly written package - install_requires.extend(('scipy', 'csa')) - -# Build a list of all project modules, as well as supplementary files -extensions = {".aplx", ".boot", ".cfg", ".json", ".sql", ".template", ".xml", - ".xsd", ".dict"} -packages = [] -package_data = defaultdict(list) - - -def find(main_package): - main_package_dir = os.path.join(os.path.dirname(__file__), main_package) - start = len(main_package_dir) - for dirname, _dirnames, filenames in os.walk(main_package_dir): - if '__init__.py' in filenames: - package = "{}{}".format( - main_package, dirname[start:].replace(os.sep, '.')) - packages.append(package) - for filename in filenames: - _, ext = os.path.splitext(filename) - if ext in extensions: - package = "{}{}".format( - main_package, dirname[start:].replace(os.sep, '.')) - package_data[package].append(filename) - - -find("spynnaker") -setup( - name="sPyNNaker", - version=__version__, - description="Tools for simulating neural models generated using " - "PyNN 0.9 on the SpiNNaker platform", - url="https://github.com/SpiNNakerManchester/SpyNNaker", - classifiers=[ - "Development Status :: 5 - Production/Stable", - - "Environment :: Console", - - "Intended Audience :: Developers", - "Intended Audience :: Science/Research", - - "License :: OSI Approved :: Apache License 2.0", - - "Natural Language :: English", - - "Operating System :: POSIX :: Linux", - "Operating System :: Microsoft :: Windows", - "Operating System :: MacOS", - - "Programming Language :: C", - "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.7", - "Programming Language :: Python :: 3.8", - "Programming Language :: Python :: 3.9", - "Programming Language :: Python :: 3.10", - "Programming Language :: Python :: 3.11", - - "Topic :: Scientific/Engineering", - "Topic :: Scientific/Engineering :: Neuroscience", - ], - keywords=["spinnaker", "pynn0.9", "neural simulation"], - packages=packages, - package_data=package_data, - install_requires=install_requires, - extras_require={ - "graphs": ["graphviz"]}, - maintainer="SpiNNakerTeam", - maintainer_email="spinnakerusers@googlegroups.com", - **long_description -) +import sys + + +if __name__ == '__main__': + # Repeated installs assume files have not changed + # https://github.com/pypa/setuptools/issues/3236 + if len(sys.argv) > 0 and sys.argv[1] == 'egg_info': + # on the first call to setpy.py remove files left by previous install + this_dir = os.path.dirname(os.path.abspath(__file__)) + build_dir = os.path.join(this_dir, "build") + if os.path.isdir(build_dir): + distutils.dir_util.remove_tree(build_dir) + egg_dir = os.path.join(this_dir, "sPyNNaker.egg-info") + if os.path.isdir(egg_dir): + distutils.dir_util.remove_tree(egg_dir) + setup() diff --git a/test_whole_board/test_whole_board.py b/test_whole_board/test_whole_board.py index 0a5b13d270..75548c1da5 100644 --- a/test_whole_board/test_whole_board.py +++ b/test_whole_board/test_whole_board.py @@ -14,8 +14,8 @@ import pyNN.spiNNaker as sim import spynnaker -from spalloc.job import Job -from spalloc.states import JobState +from spalloc_client.job import Job +from spalloc_client.states import JobState import pytest import tempfile import os diff --git a/unittests/test_import_all.py b/unittests/test_import_all.py index 031c126b1d..3fb341b7ce 100644 --- a/unittests/test_import_all.py +++ b/unittests/test_import_all.py @@ -35,7 +35,7 @@ def test_import_all(self): package_loader.load_module( "data_specification", remove_pyc_files=True) package_loader.load_module( - "spalloc", remove_pyc_files=True) + "spalloc_client", remove_pyc_files=True) package_loader.load_module( "spinn_front_end_common", remove_pyc_files=True) # Test the files