Skip to content

Commit

Permalink
Merge pull request #72 from SpiNNakerManchester/pyproject.toml
Browse files Browse the repository at this point in the history
Pyproject.toml
  • Loading branch information
Christian-B authored Apr 11, 2023
2 parents 1550c4f + dbe9689 commit e4ceda9
Show file tree
Hide file tree
Showing 9 changed files with 125 additions and 126 deletions.
14 changes: 9 additions & 5 deletions .github/workflows/c_actions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 6 additions & 2 deletions .github/workflows/python_actions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
1 change: 1 addition & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
include LICENSE LICENSE_POLICY.md README.md CITATION.cff
17 changes: 17 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -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:"
21 changes: 0 additions & 21 deletions requirements-test.txt

This file was deleted.

23 changes: 0 additions & 23 deletions requirements.txt

This file was deleted.

65 changes: 65 additions & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
@@ -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="[email protected]"

[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
88 changes: 27 additions & 61 deletions setup.py
Original file line number Diff line number Diff line change
@@ -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 <https://www.gnu.org/licenses/>.
# 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()
14 changes: 0 additions & 14 deletions unittests/test_import_all.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

0 comments on commit e4ceda9

Please sign in to comment.