Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pyproject.toml #79

Merged
merged 13 commits into from
Apr 11, 2023
23 changes: 15 additions & 8 deletions .github/workflows/python_actions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,10 @@ jobs:
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}

- name: Checkout
uses: actions/checkout@v3

- name: Checkout SupportScripts
uses: actions/checkout@v3
with:
Expand All @@ -39,14 +41,17 @@ 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
install: true
- name: Setup
uses: ./support/actions/run-setup
- name: Extra setup

- name: Install
uses: ./support/actions/run-install

- name: Docs requirements Install
run: pip install -r requirements-docs.txt

- name: Test with pytest
Expand All @@ -59,18 +64,20 @@ jobs:
coveralls-token: ${{ secrets.GITHUB_TOKEN }}

- name: Lint with flake8
run: flake8 spalloc tests
run: flake8 spalloc_client tests

- name: Lint with pylint
uses: ./support/actions/pylint
with:
package: spalloc
with:
package: spalloc_client
exitcheck: 39

- name: Run rat copyright enforcement
if: matrix.python-version == 3.8
uses: ./support/actions/check-copyrights
with:
config_file: rat_asl20.xml

- name: Build documentation with sphinx
if: matrix.python-version == 3.8
uses: ./support/actions/sphinx
Expand All @@ -79,4 +86,4 @@ jobs:

- name: Validate CITATION.cff
if: matrix.python-version == 3.8
uses: dieghernan/cff-validator@main
uses: dieghernan/cff-validator@main
2 changes: 1 addition & 1 deletion MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1 +1 @@
include CITATION.cff LICENSE.md requirements.txt pypi_to_import
include LICENSE LICENSE_POLICY.md README.rst CITATION.cff
2 changes: 1 addition & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ three-board machine::

::

>>> from spalloc import Job
>>> from spalloc_client import Job
>>> with Job(3) as j:
... my_boot(j.hostname, j.width, j.height)
... my_application(j.hostname)
8 changes: 4 additions & 4 deletions docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,8 @@ def __getattr__(cls, name):

# Note that this has to go AFTER we have updated sys.path!
# This is because RTD doesn't actually install our checkout.
import spalloc # noqa: E402
from spalloc import __version__ as release # noqa: E402
import spalloc_client # noqa: E402
from spalloc_client import __version__ as release # noqa: E402

# -- General configuration ------------------------------------------------

Expand Down Expand Up @@ -158,8 +158,8 @@ def __getattr__(cls, name):

# -- linkcode GitHub link generator ---------------------------------------

local_module_path = spalloc.__file__
github_module_path = "spalloc/"
local_module_path = spalloc_client.__file__
github_module_path = "spalloc_client/"
github_repo = "SpiNNakerManchester/spalloc"


Expand Down
44 changes: 22 additions & 22 deletions docs/source/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ three-board machine::

::

>>> from spalloc import Job
>>> from spalloc_client import Job
>>> with Job(3) as j:
... my_boot(j.hostname, j.width, j.height)
... my_application(j.hostname)
Expand All @@ -62,40 +62,40 @@ three-board machine::
Configuration file format and defaults
--------------------------------------

.. automodule:: spalloc.config
.. automodule:: spalloc_client.config


``spalloc``: Allocate SpiNNaker machines
----------------------------------------
.. automodule:: spalloc.scripts.alloc
.. automodule:: spalloc_client.scripts.alloc

``spalloc-job``: Manage and reset existing jobs and their boards
----------------------------------------------------------------
.. automodule:: spalloc.scripts.job
.. automodule:: spalloc_client.scripts.job

``spalloc-ps``: List all running jobs
-------------------------------------
.. automodule:: spalloc.scripts.ps
.. automodule:: spalloc_client.scripts.ps

``spalloc-machine``: List available machines and their running jobs
-------------------------------------------------------------------
.. automodule:: spalloc.scripts.machine
.. automodule:: spalloc_client.scripts.machine

``spalloc-where-is``: Query the server for the physical/logical locations of boards/chips
-----------------------------------------------------------------------------------------
.. automodule:: spalloc.scripts.where_is
.. automodule:: spalloc_client.scripts.where_is


Python library
--------------

Spalloc provides a pair of Python libraries which enable basic high- and
low-level interaction with a spalloc server. The high-level
:py:class:`~spalloc.Job` interface makes the task of creating jobs (and keeping
them alive) straight-forward but only facilitates basic job management
functions such as resetting boards and getting their IP addresses. The
low-level :py:class:`~spalloc.ProtocolClient` provides an RPC-like interface to
the spalloc server enabling any spalloc server command to be sent.
:py:class:`~spalloc_client.Job` interface makes the task of creating jobs
(and keeping them alive) straight-forward but only facilitates basic job
management functions such as resetting boards and getting their IP addresses.
The low-level :py:class:`~spalloc_client.ProtocolClient` provides an RPC-like
interface to the spalloc server enabling any spalloc server command to be sent.

.. note::

Expand All @@ -106,28 +106,28 @@ the spalloc server enabling any spalloc server command to be sent.

.. _protocol: https://spalloc-server.readthedocs.org/en/stable/protocol.html

High level interface (:py:class:`spalloc.Job`)
``````````````````````````````````````````````
High level interface (:py:class:`spalloc_client.Job`)
`````````````````````````````````````````````````````

.. autoclass:: spalloc.Job
.. autoclass:: spalloc_client.Job
:members:
:special-members:

.. autoclass:: spalloc.JobState
.. autoclass:: spalloc_client.JobState
:members:

.. autoexception:: spalloc.JobDestroyedError
.. autoexception:: spalloc_client.JobDestroyedError

.. autoexception:: spalloc.StateChangeTimeoutError
.. autoexception:: spalloc_client.StateChangeTimeoutError

Lower level interface (:py:class:`spalloc.ProtocolClient`)
``````````````````````````````````````````````````````````
Lower level interface (:py:class:`spalloc_client.ProtocolClient`)
`````````````````````````````````````````````````````````````````

.. autoclass:: spalloc.ProtocolClient
.. autoclass:: spalloc_client.ProtocolClient
:members:
:special-members:

.. autoexception:: spalloc.ProtocolTimeoutError
.. autoexception:: spalloc_client.ProtocolTimeoutError


Indicies and Tables
Expand Down
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"
64 changes: 64 additions & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
# 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 = spalloc
version = attr: spalloc_client._version.__version__
description = A client for the spalloc_server SpiNNaker machine partitioning and allocation system.
#long_description = file: README.rst
#long_description_content_type = text/x-rst
url = https://github.com/SpiNNakerManchester/spalloc
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 = [email protected]
keywords =
spinnaker
allocation
packing management
supercomputer

[options]
python_requires = >=3.7, <4
packages = find:
zip_safe = True
include_package_data = True
install_requires =
jsonschema
SpiNNUtilities == 1!6.0.1

[options.packages.find]
include =
spalloc_client
spalloc_client.*

[options.extras_require]
test =
# pytest will be brought in by pytest-cov
pytest-cov
mock
80 changes: 19 additions & 61 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,64 +12,22 @@
# See the License for the specific language governing permissions and
# limitations under the License.

from setuptools import setup, find_packages

__version__ = None
exec(open("spalloc/_version.py").read())
assert __version__

setup(
name="spalloc",
version=__version__,
packages=find_packages(),

# Metadata for PyPi
url="https://github.com/SpiNNakerManchester/spalloc",
description="A client for the spalloc_server SpiNNaker machine "
"partitioning and allocation system.",
license="GPLv2",
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",
],
keywords="spinnaker allocation packing management supercomputer",

# Requirements
install_requires=['SpiNNUtilities == 1!6.0.1'],
# Scripts
entry_points={
"console_scripts": [
"spalloc = spalloc.scripts.alloc:main",
"spalloc-ps = spalloc.scripts.ps:main",
"spalloc-job = spalloc.scripts.job:main",
"spalloc-machine = spalloc.scripts.machine:main",
"spalloc-where-is = spalloc.scripts.where_is:main",
],
},
# Booting directly needs rig; not recommended! Use SpiNNMan instead, as
# that has an up-to-date boot image pre-built
# Note rig does not work with python 3.11 and there are NO plans to fix it
extras_require={
'boot': [
'rig',
]},
maintainer="SpiNNakerTeam",
maintainer_email="[email protected]"
)
import distutils.dir_util
from setuptools import setup
import os
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, "spalloc.egg-info")
if os.path.isdir(egg_dir):
distutils.dir_util.remove_tree(egg_dir)
setup()
12 changes: 6 additions & 6 deletions spalloc/__init__.py → spalloc_client/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,14 @@
# See the License for the specific language governing permissions and
# limitations under the License.

from spalloc._version import __version__ # noqa: F401
from spalloc_client._version import __version__ # noqa: F401

# Alias useful objects
from spalloc.protocol_client import ProtocolClient, ProtocolError
from spalloc.protocol_client import ProtocolTimeoutError
from spalloc.protocol_client import SpallocServerException
from spalloc.job import Job, JobDestroyedError, StateChangeTimeoutError
from spalloc.states import JobState
from spalloc_client.protocol_client import ProtocolClient, ProtocolError
from spalloc_client.protocol_client import ProtocolTimeoutError
from spalloc_client.protocol_client import SpallocServerException
from spalloc_client.job import Job, JobDestroyedError, StateChangeTimeoutError
from spalloc_client.states import JobState

__all__ = [
"Job", "JobDestroyedError", "JobState", "ProtocolClient",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"""
import sys
import threading
from spalloc.protocol_client import ProtocolClient, ProtocolTimeoutError
from spalloc_client.protocol_client import ProtocolClient, ProtocolTimeoutError


def wait_for_exit(stop_event):
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
Loading