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

ReconstructSPI Workflow Infrastructure #33

Open
wants to merge 14 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions .codecov.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
coverage:
round: up
precision: 2
status:
patch:
default:
# basic
target: 90%
threshold: 2%
base: auto
flags:
- unit
# advanced
branches:
- master
thisFreya marked this conversation as resolved.
Show resolved Hide resolved
- dev
if_no_uploads: error
if_not_found: error
if_ci_failed: error
only_pulls: false

# Files to ignore
ignore:
- "data"
thisFreya marked this conversation as resolved.
Show resolved Hide resolved
- "notebooks"
3 changes: 3 additions & 0 deletions .coveragerc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[report]
fail_under = 90
show_missing = True
10 changes: 2 additions & 8 deletions .deepsource.toml
Original file line number Diff line number Diff line change
@@ -1,24 +1,18 @@
version = 1

test_patterns = ["test/**"]
test_patterns = ["tests/**"]

exclude_patterns = ["README.md"]

[[analyzers]]
name = "python"
enabled = true

[analyzers.meta]
runtime_version = "3.x.x"

[[analyzers]]
name = "test-coverage"
enabled = true

[[transformers]]
name = "isort"
enabled = true

[[transformers]]
name = "black"
enabled = true

6 changes: 6 additions & 0 deletions .flake8
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[flake8]
docstring-convention = numpy
import_order_style = smarkets
max-line-length = 88
extend-ignore = E203,I202,I100
exclude = reconstructSPI/__init__.py,reconstructSPI/iterative_refinement/__init.py,tests/__init__.py
4 changes: 2 additions & 2 deletions .github/auto-assign.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ addReviewers: true
addAssignees: false

# A list of reviewers to be added to pull requests (GitHub user name)
reviewers:
reviewers:
- fredericpoitevin

# A list of keywords to be skipped the process that add reviewers if pull requests include it
# A list of keywords to be skipped the process that add reviewers if pull requests include it
skipKeywords:
- wip

Expand Down
54 changes: 54 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
name: "Lint"
thisFreya marked this conversation as resolved.
Show resolved Hide resolved

on:
push:
branches: [master,github-actions-test,dev]
paths-ignore:
- 'README.md'
- '.deepsource.toml'
- '.gitignore'
- 'setup.py'


pull_request:
branches: [master,dev]
paths-ignore:
- 'README.md'
- '.deepsource.toml'
- '.gitignore'
- 'setup.py'


jobs:
build:

runs-on: ${{matrix.os}}
strategy:
matrix:
os: [ubuntu-18.04]
python-version: [3.9]
test-folder : ['tests']
fail-fast: false

steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Build using Python ${{matrix.python-version}}
uses: actions/setup-python@v2
with:
python-version: ${{matrix.python-version}}
- name: install dependencies [pip]
run: |
pip install --upgrade pip setuptools wheel
for req in dev-requirements.txt; do
pip install -q -r $req
done
pip install -e .
- name: linting [black and isort]
run: |
black . --check
isort --profile black --check .
- name: linting [flake8]
run: |
flake8 reconstructSPI tests
62 changes: 62 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
name: "Test"

on:
push:
branches: [master,github-actions-test,dev]
paths-ignore:
- 'README.md'
- '.deepsource.toml'
- '.gitignore'
- 'setup.py'


pull_request:
branches: [master,dev]
paths-ignore:
- 'README.md'
- '.deepsource.toml'
- '.gitignore'
- 'setup.py'


jobs:
build:

runs-on: ${{matrix.os}}
strategy:
matrix:
os: [ubuntu-18.04]
python-version: [3.7,3.8,3.9]
test-folder : ['tests']
fail-fast: false

steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Build using Python ${{matrix.python-version}}
uses: actions/setup-python@v2
with:
python-version: ${{matrix.python-version}}

- name: cache conda
uses: actions/cache@v1
with:
path: $CONDA
key: ${{ runner.os }}-conda-${{ hashFiles('environment.yml') }}
restore-keys: |
${{ runner.os }}-conda-
- name: install dependencies [conda]
run: |
# $CONDA is an environment variable pointing to the root of the miniconda directory
$CONDA/bin/conda env update --file environment.yml --name base
$CONDA/bin/pip install -e .
- name: unit testing [pytest]
env:
TEST_TOKEN: ${{ secrets.TEST_TOKEN }}
run: |
$CONDA/bin/pytest --cov-report term --cov-report xml:coverage.xml --cov=reconstructSPI ${{matrix.test-folder}}
- name: uploading code coverage [codecov]
if: ${{matrix.python-version == 3.7}}
run: |
bash <(curl -s https://codecov.io/bash) -c
42 changes: 42 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
default_language_version :
python : python3
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v3.1.0
hooks:
- id: check-byte-order-marker
- id: check-case-conflict
- id: check-merge-conflict
- id: check-yaml
- id: mixed-line-ending
args:
- --fix=no
- id: no-commit-to-branch
args:
- --branch=master
- id: check-added-large-files
args:
- --maxkb=2048
- id: trailing-whitespace
- repo: https://github.com/psf/black
rev: 21.8b0
hooks:
- id: black
- repo: https://github.com/pycqa/isort
rev: 5.9.3
hooks:
- id : isort
args : ["--profile", "black", "--filter-files"]
- repo: https://github.com/asottile/blacken-docs
rev: v1.8.0
hooks:
- id: blacken-docs
additional_dependencies: [black==20.8b0]
- repo: https://gitlab.com/pycqa/flake8
rev: 3.7.9
hooks:
- id: flake8
additional_dependencies:
- flake8-docstrings
- flake8-import-order
exclude: reconstructSPI/__init__.py,tests/__init__.py
5 changes: 5 additions & 0 deletions dev-requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
black
flake8
flake8-docstrings
isort
pre-commit
15 changes: 15 additions & 0 deletions environment.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
name: reconstructSPI
channels:
- conda-forge
- defaults
dependencies:
- codecov
- coverage
- pillow>=8.2.0
- pip
- pytest
- pytest-cov
- pytorch
- pip :
- git+https://github.com/compSPI/simSPI.git

4 changes: 4 additions & 0 deletions pytest.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
[pytest]
testpaths = tests
python_files = *.py
python_functions = test_*
1 change: 1 addition & 0 deletions reconstructSPI/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
"""Various particle reconstruction methods."""
1 change: 1 addition & 0 deletions reconstructSPI/iterative_refinement/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
"""Iterative refinement reconstruction methods."""
23 changes: 23 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
"""Create instructions to build the reconstructSPI package."""

import setuptools

requirements = []

setuptools.setup(
name="reconstructSPI",
maintainer="Frederic Poitevin",
version="0.0.1",
maintainer_email="[email protected]",
description="Reconstruction methods and tools for SPI",
long_description=open("README.md", encoding="utf8").read(),
long_description_content_type="text/markdown",
url="https://github.com/compSPI/reconstructSPI.git",
packages=setuptools.find_packages(),
install_requires=requirements,
classifiers=[
"Programming Language :: Python :: 3",
"Operating System :: OS Independent",
],
zip_safe=False,
)
Empty file added tests/__init__.py
Empty file.