diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 154f2da..65865d9 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -72,7 +72,7 @@ jobs: - id: create_release uses: actions/create-release@v1 env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + GITHUB_TOKEN: ${{ secrets.GH_TOKEN }} with: tag_name: ${{ github.ref }} release_name: ninst ${{ github.ref }} beta @@ -80,7 +80,7 @@ jobs: draft: true - uses: actions/upload-release-asset@v1 env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + GITHUB_TOKEN: ${{ secrets.GH_TOKEN }} with: upload_url: ${{ steps.create_release.outputs.upload_url }} asset_path: ${{ steps.collect_assets.outputs.asset_path }} diff --git a/README.rst b/README.rst index 74856cf..dd95c6e 100644 --- a/README.rst +++ b/README.rst @@ -1,8 +1,8 @@ ================================== -ninst: NiftyPET Installation Tools +NINST: NiftyPET Installation Tools ================================== -|Docs| |PyPI-Status| +|Docs| |Version| |Py-Versions| |Tests| |Coverage| ``ninst`` is a stand-alone Python sub-package of NiftyPET_, dedicated to helping with installation of other sub-packages. Although it is an essential part of NiftyPET_ packaging, ``ninst`` could be used in other projects. @@ -23,9 +23,13 @@ Copyright 2018-20 .. |Docs| image:: https://readthedocs.org/projects/niftypet/badge/?version=latest :target: https://niftypet.readthedocs.io/en/latest/?badge=latest -.. |Licence| image:: https://img.shields.io/pypi/l/ninst.svg?label=licence - :target: https://github.com/NiftyPET/ninst/blob/master/LICENCE -.. |PyPI-Downloads| image:: https://img.shields.io/pypi/dm/ninst.svg?label=PyPI%20downloads - :target: https://pypi.org/project/ninst -.. |PyPI-Status| image:: https://img.shields.io/pypi/v/ninst.svg?label=latest +.. |Licence| image:: https://img.shields.io/pypi/l/ninst.svg + :target: https://raw.githubusercontent.com/NiftyPET/ninst/master/LICENCE +.. |Tests| image:: https://img.shields.io/github/workflow/status/NiftyPET/ninst/Test?logo=GitHub + :target: https://github.com/NiftyPET/ninst/actions +.. |Coverage| image:: https://codecov.io/gh/NiftyPET/ninst/branch/master/graph/badge.svg + :target: https://codecov.io/gh/NiftyPET/ninst +.. |Version| image:: https://img.shields.io/pypi/v/ninst.svg?logo=python&logoColor=white + :target: https://github.com/NiftyPET/ninst/releases +.. |Py-Versions| image:: https://img.shields.io/pypi/pyversions/ninst.svg?logo=python&logoColor=white :target: https://pypi.org/project/ninst diff --git a/niftypet/ninst/cudasetup.py b/niftypet/ninst/cudasetup.py index fbd3aea..cd7303e 100644 --- a/niftypet/ninst/cudasetup.py +++ b/niftypet/ninst/cudasetup.py @@ -1,9 +1,8 @@ #!/usr/bin/env python """Tools for CUDA compilation and set-up for Python 3.""" +import importlib import logging import os - -# from pkg_resources import resource_filename import platform import re import shutil @@ -11,6 +10,7 @@ from distutils.sysconfig import get_python_inc from textwrap import dedent +# from pkg_resources import resource_filename try: from numpy import get_include as get_numpy_inc except ImportError: @@ -168,7 +168,7 @@ def resources_setup(gpu=True): return dev_setup() if gpu else "" -def get_resources(sys_append=True): +def get_resources(sys_append=True, reload=True): path_resources = path_niftypet_local() if sys_append: if path_resources not in sys.path: @@ -189,4 +189,4 @@ def get_resources(sys_append=True): ) raise else: - return resources + return importlib.reload(resources) if reload else resources diff --git a/setup.cfg b/setup.cfg index f73dcfe..a34252c 100644 --- a/setup.cfg +++ b/setup.cfg @@ -20,6 +20,9 @@ classifiers= Programming Language :: C Programming Language :: C++ Programming Language :: Python :: 3 + Programming Language :: Python :: 3.6 + Programming Language :: Python :: 3.7 + Programming Language :: Python :: 3.8 Programming Language :: Python :: 3 :: Only Topic :: Scientific/Engineering :: Medical Science Apps. Topic :: Software Development :: Libraries @@ -33,7 +36,7 @@ install_requires=tqdm; miutil[cuda]>=0.4.2 packages=find: python_requires=>=3.6 [options.extras_require] -dev = +dev= pre-commit twine wheel @@ -43,16 +46,16 @@ dev = pytest-xdist codecov [options.package_data] -* = *.md, *.rst +*=*.md, *.rst [flake8] -max_line_length = 88 -extend-ignore = E203,P1 -exclude = .git,__pycache__,build,dist,.eggs +max_line_length=88 +extend-ignore=E203,P1 +exclude=.git,__pycache__,build,dist,.eggs [isort] -profile = black -known_first_party = niftypet,tests +profile=black +known_first_party=niftypet,tests [coverage:paths] rsrc= @@ -62,4 +65,4 @@ rsrc= c:\*\.niftypet [tool:pytest] -addopts=-v --cov=niftypet --cov-report=term-missing --cov-report=xml +addopts=-v -rxs --cov=niftypet --cov-report=term-missing --cov-report=xml diff --git a/tests/conftest.py b/tests/conftest.py index f488f33..2af7730 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -1,6 +1,14 @@ +import os + import pytest +@pytest.fixture(scope="session", autouse=True) +def noninteractive(): + if os.getenv("DISPLAY", False): + pytest.skip("Need to call pytest with DISPLAY=''") + + @pytest.fixture(scope="session") def nvml(): import pynvml