diff --git a/.github/workflows/c_actions.yml b/.github/workflows/c_actions.yml
index 2c5b3ab..b2df8ad 100644
--- a/.github/workflows/c_actions.yml
+++ b/.github/workflows/c_actions.yml
@@ -36,14 +36,18 @@ jobs:
repository: SpiNNakerManchester/SupportScripts
path: support
- name: Checkout Spinnaker Dependencies
- uses: ./support/actions/checkout-spinn-deps
+ uses: ./support/actions/install-spinn-deps
with:
# Note: SpiNNUtils needed for spinn_utilities.make_tools
repositories: >
- spinnaker_tools spinn_common SpiNNFrontEndCommon sPyNNaker SpiNNUtils
- - name: Install SpiNNUtils
- run: python setup.py install
- working-directory: SpiNNUtils
+ spinnaker_tools spinn_common SpiNNFrontEndCommon sPyNNaker
+
+ - name: "Prepare: Install SpiNNUtils"
+ uses: ./support/actions/install-spinn-deps
+ with:
+ # Note: SpiNNUtils needed for spinn_utilities.make_tools
+ repositories: SpiNNUtils
+ install: true
- name: Lint C code using Vera++
# Note: run this before building to avoid linting modified_src directories
diff --git a/.github/workflows/python_actions.yml b/.github/workflows/python_actions.yml
index ee7ed24..315df87 100644
--- a/.github/workflows/python_actions.yml
+++ b/.github/workflows/python_actions.yml
@@ -36,17 +36,21 @@ jobs:
path: support
- 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 sPyNNaker 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
diff --git a/MANIFEST.in b/MANIFEST.in
new file mode 100644
index 0000000..4e4eef7
--- /dev/null
+++ b/MANIFEST.in
@@ -0,0 +1 @@
+include LICENSE LICENSE_POLICY.md README.md CITATION.cff
\ No newline at end of file
diff --git a/pyproject.toml b/pyproject.toml
new file mode 100644
index 0000000..4e9ac99
--- /dev/null
+++ b/pyproject.toml
@@ -0,0 +1,17 @@
+# 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.
+
+[build-system]
+requires = ["setuptools"]
+build-backend = "setuptools.build_meta:"
\ No newline at end of file
diff --git a/requirements-test.txt b/requirements-test.txt
deleted file mode 100644
index 4f016d9..0000000
--- a/requirements-test.txt
+++ /dev/null
@@ -1,21 +0,0 @@
-# Copyright (c) 2019 The University of Manchester
-#
-# This program is free software: you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation, either version 3 of the License, or
-# (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program. If not, see .
-
--r requirements.txt
-SpiNNakerTestBase == 1!6.0.1
-flake8
-pytest>=2.8
-pytest-cov
-sphinx >= 2
diff --git a/requirements.txt b/requirements.txt
deleted file mode 100644
index a09c36a..0000000
--- a/requirements.txt
+++ /dev/null
@@ -1,23 +0,0 @@
-# Copyright (c) 2019 The University of Manchester
-#
-# This program is free software: you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation, either version 3 of the License, or
-# (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program. If not, see .
-
-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
-SpiNNFrontEndCommon == 1!6.0.1
-sPyNNaker == 1!6.0.1
-opencv-python
diff --git a/setup.cfg b/setup.cfg
new file mode 100644
index 0000000..9a1ea95
--- /dev/null
+++ b/setup.cfg
@@ -0,0 +1,65 @@
+# 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 = SpiNNGym
+version = attr: spinn_gym._version.__version__
+description="SpiNNaker Gym for reinforcement learning with SNNs"
+# long_description = file: README.md
+# long_description_content_type = text/markdown
+url="https://github.com/SpiNNakerManchester/SpiNNGym"
+license = Apache-2.0
+classifiers =
+ Development Status :: 3 - Alpha
+ Intended Audience :: Developers
+ Intended Audience :: Science/Research
+ License :: OSI Approved :: GNU General Public License v2 (GPLv2)
+ 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"
+
+[options]
+python_requires = >=3.7, <4
+packages = find:
+zip_safe = True
+include_package_data = True
+install_requires =
+ sPyNNaker == 1!6.0.1
+ opencv-python
+
+[options.packages.find]
+include =
+ spinn_gym
+ spinn_gym.*
+
+# We expect the c files to always be built. If not uncomment below
+# [options.package_data]
+# * =
+# *.aplx
+# *.dict
+
+[options.extras_require]
+test =
+ SpiNNakerTestBase == 1!6.0.1
+ # pytest will be brought in by pytest-cov
+ pytest-cov
diff --git a/setup.py b/setup.py
index 7d270fc..2346eb5 100644
--- a/setup.py
+++ b/setup.py
@@ -1,68 +1,34 @@
-# Copyright (c) 2019 The University of Manchester
+# Copyright (c) 2023 The University of Manchester
#
-# This program is free software: you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation, either version 3 of the License, or
-# (at your option) any later version.
+# 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
#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
+# https://www.apache.org/licenses/LICENSE-2.0
#
-# You should have received a copy of the GNU General Public License
-# along with this program. If not, see .
+# 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.
-import os
+import distutils.dir_util
from setuptools import setup
-from collections import defaultdict
-
-__version__ = None
-exec(open("spinn_gym/_version.py").read())
-assert __version__
-
-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',
- 'sPyNNaker == 1!6.0.1',
- 'opencv-python']
-if os.environ.get('READTHEDOCS', None) != 'True':
-
- # scipy must be added in config.py as a mock
- install_requires.append('scipy')
-
+import os
+import sys
-# Build a list of all project modules, as well as supplementary files
-main_package = "spinn_gym"
-extensions = {".aplx", ".boot", ".cfg", ".json", ".sql", ".template", ".xml",
- ".xsd", ".dict"}
-main_package_dir = os.path.join(os.path.dirname(__file__), main_package)
-start = len(main_package_dir)
-packages = []
-package_data = defaultdict(list)
-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)
-setup(
- name="SpiNNGym",
- version=__version__,
- description="SpiNNaker Gym for reinforcement learning with SNNs",
- url="https://github.com/SpiNNakerManchester/SpiNNGym",
- packages=packages,
- package_data=package_data,
- install_requires=install_requires
-)
+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, "setup.py")
+ if os.path.isdir(egg_dir):
+ distutils.dir_util.remove_tree(egg_dir)
+ setup()
diff --git a/unittests/test_import_all.py b/unittests/test_import_all.py
index 1d4cd58..aa6b980 100644
--- a/unittests/test_import_all.py
+++ b/unittests/test_import_all.py
@@ -24,19 +24,5 @@ def test_import_all(self):
if os.environ.get('CONTINUOUS_INTEGRATION', 'false').lower() == 'true':
package_loader.load_module("spinn_gym", remove_pyc_files=False)
else:
- # Do a full stack cleanup
- package_loader.load_module(
- "spinn_utilities", remove_pyc_files=True)
- package_loader.load_module("spinn_machine", remove_pyc_files=True)
- package_loader.load_module("spinnman", remove_pyc_files=True)
- package_loader.load_module("pacman", remove_pyc_files=True)
- package_loader.load_module(
- "data_specification", remove_pyc_files=True)
- package_loader.load_module(
- "spalloc", remove_pyc_files=True)
- package_loader.load_module(
- "spinn_front_end_common", remove_pyc_files=True)
# Test the files
- package_loader.load_module("spynnaker", remove_pyc_files=True)
- package_loader.load_module("spynnaker8", remove_pyc_files=True)
package_loader.load_module("spinn_gym", remove_pyc_files=True)