Skip to content

Commit

Permalink
bump version, merge pull request #15 from NiftyPET/dev2
Browse files Browse the repository at this point in the history
  • Loading branch information
casperdcl committed Jan 5, 2021
2 parents da052e2 + 4b41b0c commit d27b3d2
Show file tree
Hide file tree
Showing 84 changed files with 5,197 additions and 6,482 deletions.
50 changes: 50 additions & 0 deletions .github/workflows/comment-bot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
name: Comment Bot
on:
issue_comment:
types: [created]
pull_request_review_comment:
types: [created]
jobs:
tag: # /tag <tagname> <commit>
if: startsWith(github.event.comment.body, '/tag ')
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: React Seen
uses: actions/github-script@v2
with:
script: |
const perm = await github.repos.getCollaboratorPermissionLevel({
owner: context.repo.owner, repo: context.repo.repo,
username: context.payload.comment.user.login})
post = (context.eventName == "issue_comment"
? github.reactions.createForIssueComment
: github.reactions.createForPullRequestReviewComment)
if (!["admin", "write"].includes(perm.data.permission)){
post({
owner: context.repo.owner, repo: context.repo.repo,
comment_id: context.payload.comment.id, content: "laugh"})
throw "Permission denied for user " + context.payload.comment.user.login
}
post({
owner: context.repo.owner, repo: context.repo.repo,
comment_id: context.payload.comment.id, content: "eyes"})
- name: Tag Commit
run: |
git clone https://${GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY} repo
git -C repo tag $(echo "$BODY" | awk '{print $2" "$3}')
git -C repo push --tags
rm -rf repo
env:
BODY: ${{ github.event.comment.body }}
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
- name: React Success
uses: actions/github-script@v2
with:
script: |
post = (context.eventName == "issue_comment"
? github.reactions.createForIssueComment
: github.reactions.createForPullRequestReviewComment)
post({
owner: context.repo.owner, repo: context.repo.repo,
comment_id: context.payload.comment.id, content: "rocket"})
81 changes: 81 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
name: Test
on:
- push
jobs:
check:
runs-on: ubuntu-latest
strategy:
matrix:
python: [3.6, 3.9]
name: Check py${{ matrix.python }}
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python }}
- name: set PYSHA
run: echo "PYSHA=$(python -VV | sha256sum | cut -d' ' -f1)" >> $GITHUB_ENV
- uses: actions/cache@v1
with:
path: ~/.cache/pre-commit
key: pre-commit|${{ env.PYSHA }}|${{ hashFiles('.pre-commit-config.yaml') }}
- run: pip install -U pre-commit twine setuptools wheel setuptools_scm[toml] ninst scikit-build
- run: HMUDIR=$HOME python setup.py sdist
- run: twine check dist/*
- run: pre-commit run -a --show-diff-on-failure
test:
runs-on: [self-hosted, cuda]
name: Test
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- run: pip install -U -e .[dev]
- run: pytest
- run: codecov
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
deploy:
if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags')
needs: [check, test]
name: PyPI Deploy
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- uses: actions/setup-python@v2
with:
python-version: '3.x'
- run: pip install -U twine setuptools wheel setuptools_scm[toml] ninst scikit-build
- run: HMUDIR=$HOME python setup.py sdist
- run: twine upload dist/*
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }}
skip_existing: true
- id: collect_assets
name: Collect assets
run: |
echo "::set-output name=asset_path::$(ls dist/*.tar.gz)"
echo "::set-output name=asset_name::$(basename dist/*.tar.gz)"
git log --pretty='format:%d%n- %s%n%b---' $(git tag --sort=v:refname | tail -n2 | head -n1)..HEAD > _CHANGES.md
- id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: ninst ${{ github.ref }} beta
body_path: _CHANGES.md
draft: true
- uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ${{ steps.collect_assets.outputs.asset_path }}
asset_name: ${{ steps.collect_assets.outputs.asset_name }}
asset_content_type: application/gzip
25 changes: 13 additions & 12 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
*.py[co]
__pycache__/

# build
MANIFEST
*.so
*.png
*.pdf
*.eps
*.log
/docs/
/niftypet/nipet/cmake/
/niftypet/nipet/_dist_ver.py
/build/
/dist/
/nipet.egg*/
/output/
/niftyout/
.ipynb_checkpoints/
Makefile
.DS_Store
.gitignore
/_skbuild/
/_cmake_test_compile/
/*.egg*/
/.eggs/

/.coverage
/coverage.xml
19 changes: 19 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
default_language_version:
python: python3
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v3.3.0
hooks:
- id: check-added-large-files
- id: check-case-conflict
- id: check-docstring-first
- id: check-executables-have-shebangs
- id: check-toml
- id: check-yaml
- id: end-of-file-fixer
- id: mixed-line-ending
- id: trailing-whitespace
- hooks:
- id: isort
repo: https://github.com/timothycrosley/isort
rev: 5.6.4
2 changes: 1 addition & 1 deletion LICENCE
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@

END OF TERMS AND CONDITIONS

Copyright 2018 Pawel Markiewicz
Copyright 2018-20 Pawel Markiewicz, Casper da Costa-Luis

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand Down
14 changes: 0 additions & 14 deletions MANIFEST.in

This file was deleted.

65 changes: 47 additions & 18 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
NIPET: high-throughput Neuro-Image PET reconstruction
===========================================================

|Docs| |PyPI-Status| |PyPI-Downloads|
|Docs| |Version| |Downloads| |Py-Versions| |DOI| |Licence| |Tests|

NIPET is a Python sub-package of NiftyPET_, offering high-throughput PET image reconstruction as well as image processing and analysis (``nimpa``: https://github.com/NiftyPET/NIMPA) for PET/MR imaging with high quantitative accuracy and precision. The software is written in CUDA C and embedded in Python C extensions.

Expand All @@ -25,41 +25,70 @@ In order to facilitate all the functionality, *NiftyPET* relies on third-party s
Quick Install
~~~~~~~~~~~~~

Note that installation prompts for setting the path to `NiftyPET_tools` and
Note that installation prompts for setting the path to ``NiftyPET_tools`` and
hardware attenuation maps. This can be avoided by setting the environment
variables `PATHTOOLS` and `HMUDIR`, respectively.
variables ``PATHTOOLS`` and ``HMUDIR``, respectively.
It's also recommended (but not required) to use `conda`.

.. code:: sh
# optional (Linux syntax) to avoid prompts
export PATHTOOLS=$HOME/NiftyPET_tools
export HMUDIR=$HOME/mmr_hardwareumaps
# cross-platform install
conda create -n niftypet -c conda-forge python=2.7 \
ipykernel matplotlib numpy scikit-image ipywidgets
git clone https://github.com/NiftyPET/NIMPA.git nimpa
git clone https://github.com/NiftyPET/NIPET.git nipet
conda activate niftypet
pip install --no-binary :all: --verbose -e ./nimpa
pip install --no-binary :all: --verbose -e ./nipet
conda install -c conda-forge python=3 \
ipykernel numpy scipy scikit-image matplotlib ipywidgets
pip install "nipet>=2"
External CMake Projects
~~~~~~~~~~~~~~~~~~~~~~~

The raw C/CUDA libraries may be included in external projects using ``cmake``.
Simply build the project and use ``find_package(NiftyPETnipet)``.

.. code:: sh
# print installation directory (after `pip install nipet`)...
python -c "from niftypet.nipet import cmake_prefix; print(cmake_prefix)"
# ... or build & install directly with cmake
mkdir build && cd build
cmake ../niftypet && cmake --build . && cmake --install . --prefix /my/install/dir
At this point any external project may include NIPET as follows
(Once setting ``-DCMAKE_PREFIX_DIR=<installation prefix from above>``):

.. code:: cmake
cmake_minimum_required(VERSION 3.3 FATAL_ERROR)
project(myproj)
find_package(NiftyPETnipet COMPONENTS mmr_auxe mmr_lmproc petprj nifty_scatter REQUIRED)
add_executable(myexe ...)
target_link_libraries(myexe PRIVATE
NiftyPET::mmr_auxe NiftyPET::mmr_lmproc NiftyPET::petprj NiftyPET::nifty_scatter)
Licence
~~~~~~~

|Licence|

- Author: `Pawel J. Markiewicz <https://github.com/pjmark>`__ @ University College London
- `Contributors <https://github.com/NiftyPET/NIPET/graphs/contributors>`__:
|Licence| |DOI|

- `Casper O. da Costa-Luis <https://github.com/casperdcl>`__ @ King's College London
Copyright 2018-21

Copyright 2018-19
- `Pawel J. Markiewicz <https://github.com/pjmark>`__ @ University College London
- `Casper O. da Costa-Luis <https://github.com/casperdcl>`__ @ King's College London
- `Contributors <https://github.com/NiftyPET/NIPET/graphs/contributors>`__

.. |Docs| image:: https://readthedocs.org/projects/niftypet/badge/?version=latest
:target: https://niftypet.readthedocs.io/en/latest/?badge=latest
.. |DOI| image:: https://zenodo.org/badge/DOI/10.5281/zenodo.4417680.svg
:target: https://doi.org/10.5281/zenodo.4417680
.. |Licence| image:: https://img.shields.io/pypi/l/nipet.svg?label=licence
:target: https://github.com/NiftyPET/NIPET/blob/master/LICENCE
.. |PyPI-Downloads| image:: https://img.shields.io/pypi/dm/nipet.svg?label=PyPI%20downloads
.. |Tests| image:: https://img.shields.io/github/workflow/status/NiftyPET/NIPET/Test?logo=GitHub
:target: https://github.com/NiftyPET/NIPET/actions
.. |Downloads| image:: https://img.shields.io/pypi/dm/nipet.svg?logo=pypi&logoColor=white&label=PyPI%20downloads
:target: https://pypi.org/project/nipet
.. |PyPI-Status| image:: https://img.shields.io/pypi/v/nipet.svg?label=latest
.. |Version| image:: https://img.shields.io/pypi/v/nipet.svg?logo=python&logoColor=white
:target: https://github.com/NiftyPET/NIPET/releases
.. |Py-Versions| image:: https://img.shields.io/pypi/pyversions/nipet.svg?logo=python&logoColor=white
:target: https://pypi.org/project/nipet
Loading

0 comments on commit d27b3d2

Please sign in to comment.