diff --git a/.github/workflows/python_actions.yml b/.github/workflows/python_actions.yml index 0c3ddd7b..c9ce3921 100644 --- a/.github/workflows/python_actions.yml +++ b/.github/workflows/python_actions.yml @@ -42,9 +42,9 @@ jobs: path: support - name: Install pip, etc. uses: ./support/actions/python-tools - - name: Setup - uses: ./support/actions/run-setup + - name: Run Install + uses: ./support/actions/run-install - name: Test with pytest uses: ./support/actions/pytest with: diff --git a/MANIFEST.in b/MANIFEST.in index 86061928..4e4eef7b 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 LICENSE LICENSE_POLICY.md README.md CITATION.cff \ No newline at end of file diff --git a/requirements.txt b/pyproject.toml similarity index 76% rename from requirements.txt rename to pyproject.toml index 76d79181..ddb15f36 100644 --- a/requirements.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,8 +12,6 @@ # See the License for the specific language governing permissions and # limitations under the License. -appdirs -numpy > 1.13, < 1.21; python_version == '3.7' -numpy < 1.24; python_version >= '3.8' -pyyaml -requests >= 2.4.1 +[build-system] +requires = ["setuptools"] +build-backend = "setuptools.build_meta" diff --git a/requirements-test.txt b/requirements-test.txt deleted file mode 100644 index b3a5c683..00000000 --- a/requirements-test.txt +++ /dev/null @@ -1,23 +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. - --r requirements.txt -flake8 -coverage >= 4.4, < 5.0 -# pytest will be brought in by pytest-cov -pytest-cov -testfixtures -sphinx >= 2 -pyyaml -httpretty != 1.0.0 diff --git a/setup.cfg b/setup.cfg new file mode 100644 index 00000000..4b5f65c6 --- /dev/null +++ b/setup.cfg @@ -0,0 +1,72 @@ +# 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 = SpiNNUtilities +version = attr: spinn_utilities._version.__version__ +description = Utility classes and functions for SpiNNaker projects +#long_description = file: README.md +#long_description_content_type = text/markdown +url = https://github.com/SpiNNakerManchester/SpiNNUtils +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 + utilities + +[options] +python_requires = >=3.7, <4 +packages = find_namespace: +zip_safe = True +include_package_data = True +install_requires = + appdirs + numpy < 1.24 + pyyaml + requests + +[options.packages.find] +include = + spinn_utilities + spinn_utilities.* + +[options.package_data] +* = + spinn_utilities.cfg + progress_bar.txt + db.sql + +[options.extras_require] +test = + # pytest will be brought in by pytest-cov + pytest-cov + testfixtures + httpretty != 1.0.0 + diff --git a/setup.py b/setup.py index 301d73c9..5df3ee70 100644 --- a/setup.py +++ b/setup.py @@ -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,73 +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 -exec(open("spinn_utilities/_version.py").read()) -assert __version__ - -# Build a list of all project modules, as well as supplementary files -main_package = "spinn_utilities" -extensions = {".aplx", ".boot", ".cfg", ".json", ".sql", ".template", ".txt", - ".xml", ".xsd"} -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="SpiNNUtilities", - version=__version__, - description="Utility classes and functions for SpiNNaker projects", - url="https://github.com/SpiNNakerManchester/SpiNNUtils", - license="Apache License 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", - ], - packages=packages, - package_data=package_data, - install_requires=[ - "appdirs", - "numpy > 1.13, < 1.21; python_version == '3.7'", - "numpy < 1.24; python_version >= '3.8'", - "pyyaml", - "requests >= 2.4.1", - ], - maintainer="SpiNNakerTeam", - maintainer_email="spinnakerusers@googlegroups.com" -) +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, "SpiNNUtilities.egg-info") + if os.path.isdir(egg_dir): + distutils.dir_util.remove_tree(egg_dir) + setup()