Skip to content
This repository has been archived by the owner on Feb 11, 2023. It is now read-only.

Commit

Permalink
update CI/dockers
Browse files Browse the repository at this point in the history
* drop tox
* install py27
  • Loading branch information
Borda committed Oct 28, 2020
1 parent 1705b95 commit af909ee
Show file tree
Hide file tree
Showing 15 changed files with 61 additions and 105 deletions.
21 changes: 11 additions & 10 deletions .github/workflows/ci-testing.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@ jobs:
if: matrix.python-version == 2.7
run: |
cp -r requirements-py27.txt requirements.txt
# required for matplotlib @py2
pip install -U backports.functools_lru_cache
- name: Set min. dependencies
if: matrix.requires == 'minimal'
Expand All @@ -66,8 +68,6 @@ jobs:
- name: Install dependencies
run: |
pip install $(grep "numpy" requirements.txt)
# required for matplotlib @py2
pip install -U backports.functools_lru_cache
# v46 crashes openslide-python install
pip install "setuptools<46" -U
pip install --requirement requirements.txt --quiet --upgrade
Expand All @@ -77,15 +77,18 @@ jobs:
pip list
shell: bash

- name: Tests
env:
DISPLAY: ""
- name: Pkg install
run: |
check-manifest --ignore tox.ini
check-manifest
python setup.py check --metadata --strict
python setup.py install --dry-run --user
coverage run --source birl -m py.test birl tests bm_dataset bm_experiments bm_ANHIR -v --doctest-modules --durations=25 --junitxml=junit/test-results-${{ runner.os }}-${{ matrix.python-version }}-${{ matrix.requires }}.xml
flake8 .
- name: Tests and coverage
env:
DISPLAY: ""
run: |
coverage run --source birl -m pytest birl tests bm_dataset bm_experiments bm_ANHIR -v --durations=25 --junitxml=junit/test-results-${{ runner.os }}-${{ matrix.python-version }}-${{ matrix.requires }}.xml
# flake8 .
- name: Upload pytest test results
uses: actions/upload-artifact@master
Expand All @@ -107,8 +110,6 @@ jobs:
with:
token: ${{ secrets.CODECOV_TOKEN }}
file: coverage.xml
flags: cpu,pytest
name: CPU-coverage
fail_ci_if_error: false

- name: Run sample experiment
Expand Down
11 changes: 4 additions & 7 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ matrix:
language: python
python: 2.7
dist: xenial # Ubuntu 16.04
env: TOXENV=py27
#- os: linux
# language: python
# python: 3.5
Expand All @@ -30,21 +29,17 @@ matrix:
language: python
python: 3.6
dist: bionic # Ubuntu 18.04
env: TOXENV=py36
- os: linux
language: python
python: 3.7
dist: bionic # Ubuntu 18.04
env: TOXENV=py37
- os: linux
language: python
python: 3.8
dist: bionic # Ubuntu 18.04
env: TOXENV=py38
- os: osx
osx_image: xcode10.3
language: generic
env: TOXENV=py37
addons:
homebrew:
# update: true
Expand All @@ -69,7 +64,6 @@ matrix:
- python -m pip install --upgrade pip
- choco install -y opencv
env:
- TOXENV=py37
- PATH=/c/Python37:/c/Python37/Scripts:%OPENCV_DIR%/bin:$PATH
# https://towardsdatascience.com/extensive-python-testing-on-travis-ci-4c24db9bf961
allow_failures:
Expand Down Expand Up @@ -97,7 +91,10 @@ install:

script:
# integration
- tox -v
- check-manifest
- python setup.py check --metadata --strict
- python setup.py install --dry-run
- coverage run --source birl -m pytest birl tests bm_dataset bm_experiments bm_ANHIR -v
# sample run
- mkdir results && touch configs/sample_config.yaml
- python bm_experiments/bm_comp_perform.py -o ./results -n 1
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# BIRL: Benchmark on Image Registration methods with Landmark validation

[![Build Status](https://travis-ci.org/Borda/BIRL.svg?branch=master)](https://travis-ci.org/Borda/BIRL)
[![Build Status](https://travis-ci.com/Borda/BIRL.svg?branch=master)](https://travis-ci.com/Borda/BIRL)
[![CircleCI](https://circleci.com/gh/Borda/BIRL.svg?style=svg&circle-token=e58b9845aab1b02d749df60060afbac54138ea28)](https://circleci.com/gh/Borda/BIRL)
[![Build status](https://ci.appveyor.com/api/projects/status/rmfvuxix379eu6fh/branch/master?svg=true)](https://ci.appveyor.com/project/Borda/birl/branch/master)
[![codecov](https://codecov.io/gh/Borda/BIRL/branch/master/graph/badge.svg?token=JZwA1rlUGA)](https://codecov.io/gh/Borda/BIRL)
Expand Down
7 changes: 1 addition & 6 deletions appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,22 +14,18 @@ environment:
#- PYTHON: "C:\\Python27"
# PYTHON_VERSION: "2.7.x"
# PYTHON_ARCH: "32"
# TOXENV: "py27"

#- PYTHON: "C:\\Python27-x64"
# PYTHON_VERSION: "2.7.x"
# PYTHON_ARCH: "64"
# TOXENV: "py27"

#- PYTHON: "C:\\Python36-x64"
# PYTHON_VERSION: "3.6.x"
# PYTHON_ARCH: "64"
# TOXENV: "py36"

- PYTHON: "C:\\Python37-x64"
PYTHON_VERSION: "3.7.x"
PYTHON_ARCH: "64"
TOXENV: "py37"

build: off

Expand All @@ -55,7 +51,6 @@ install:
- pip install "setuptools<46" -U # v46 crashes openslide-python install
- pip install -r requirements.txt
- pip install -r ./tests/requirements.txt
- pip install tox

# scripts to run before tests (working directory and environment changes are persisted from the previous steps such as "before_build")
before_test:
Expand All @@ -66,7 +61,7 @@ before_test:

# to run your custom scripts instead of automatic tests
test_script:
- tox -v --sitepackages --parallel auto
- coverage run --source birl -m pytest birl tests bm_dataset bm_experiments bm_ANHIR -v
- mkdir results && touch configs/sample_config.yaml
- python bm_experiments/bm_comp_perform.py -o ./results -n 1
- python birl/bm_template.py -n anhir -t ./data-images/pairs-imgs-lnds_mix.csv -o ./results --preprocessing matching-rgb gray --unique --visual -cfg configs/sample_config.yaml
Expand Down
14 changes: 8 additions & 6 deletions birl/utilities/drawing.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,21 +32,21 @@ def draw_image_points(image, points, color='green', marker_size=5, shape='o'):
:return: np.ndarray
>>> image = np.zeros((10, 10, 3))
>>> points = np.array([[7, 9], [2, 2], [5, 5]])
>>> img = draw_image_points(image, points, marker_size=1)
>>> points = np.array([[9, 1], [2, 2], [5, 5]])
>>> img = draw_image_points(image, points, marker_size=1, shape='s')
>>> img.shape == (10, 10, 3) # Windows x64 returns (10L, 10L, 3L)
True
>>> np.round(img[:, :, 1], 2)
array([[ 0. , 0. , 0. , 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0.5, 0.5, 0.5, 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0.5, 0. , 0.5, 0. , 0. , 0. , 0. , 0. , 0. ],
array([[ 0. , 0. , 0. , 0. , 0. , 0. , 0. , 0. , 0.5, 0.5],
[ 0. , 0.5, 0.5, 0.5, 0. , 0. , 0. , 0. , 0.5, 0. ],
[ 0. , 0.5, 0. , 0.5, 0. , 0. , 0. , 0. , 0.5, 0.5],
[ 0. , 0.5, 0.5, 0.5, 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0.5, 0.5, 0.5, 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0.5, 0. , 0.5, 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0.5, 0.5, 0.5, 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. , 0. , 0.5, 0. ]])
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. , 0. , 0. , 0. ]])
>>> img = draw_image_points(None, points, marker_size=1)
"""
assert list(points), 'missing points'
Expand All @@ -64,6 +64,8 @@ def draw_image_points(image, points, color='green', marker_size=5, shape='o'):
draw.ellipse(pos_marker, outline=color)
elif shape == '.':
draw.ellipse(pos_marker, fill=color)
elif shape == 's':
draw.rectangle(pos_marker, outline=color)
else:
draw.ellipse(pos_marker, fill=color, outline=color)
draw.text(pos_text, str(i + 1), fill=(0, 0, 0))
Expand Down
2 changes: 2 additions & 0 deletions bm_ANHIR/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
FROM python:3.7-slim-stretch
#FROM borda/docker_python-opencv-ffmpeg:py3

LABEL maintainer="[email protected]"

# Install packages
RUN apt-get update -qq && apt-get install -y --no-install-recommends \
git>=2.0 \
Expand Down
3 changes: 2 additions & 1 deletion bm_experiments/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
#FROM ubuntu:bionic
FROM ubuntu:20.04


ARG PYTHON_VERSION=3.7

LABEL maintainer="[email protected]"

SHELL ["/bin/bash", "-c"]

# for installing tzdata see: https://stackoverflow.com/a/58264927/4521646
Expand Down
2 changes: 1 addition & 1 deletion circle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ references:
unset DISPLAY
pip install -r ./tests/requirements.txt
mkdir test-reports && mkdir results
coverage run --source birl -m py.test birl tests bm_dataset bm_experiments bm_ANHIR -v --doctest-modules --junitxml=test-reports/pytest_junit.xml
coverage run --source birl -m pytest birl tests bm_dataset bm_experiments bm_ANHIR -v --junitxml=test-reports/pytest_junit.xml
coverage report
codecov
rm -rf results
Expand Down
5 changes: 3 additions & 2 deletions docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,9 @@

import m2r

PATH_ROOT = os.path.join('..', '..')
PATH_UP = os.path.join('..', '..')
PATH_HERE = os.path.abspath(os.path.dirname(__file__))
PATH_ROOT = os.path.abspath(os.path.join(PATH_HERE, PATH_UP))
sys.path.insert(0, os.path.abspath(PATH_ROOT))

import birl # noqa: E402
Expand Down Expand Up @@ -65,7 +66,7 @@
readme = re.sub(r'(!\[.*.gif\))', '', readme)
for dir_name in (os.path.basename(p) for p in glob.glob(os.path.join(PATH_ROOT, '*'))
if os.path.isdir(p)):
readme = readme.replace('](%s/' % dir_name, '](%s/%s/' % (PATH_ROOT, dir_name))
readme = readme.replace('](%s/' % dir_name, '](%s/%s/' % (PATH_UP, dir_name))
with open('readme.md', 'w') as fp:
fp.write(readme)

Expand Down
6 changes: 3 additions & 3 deletions requirements-py27.txt
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
numpy>=1.8.2
numpy>=1.9
scipy>=0.10.0
pandas>=0.17.1
six>=1.7.3
pillow>=2.1.0, !=7.1 # 7.x fails to load PNG via skimage
pillow>=4.0, <7 # 7.x fails to load PNG via skimage
matplotlib>=2.0.2, <3.0.0 # new version does not support py2
tqdm>=4.7.4, <=4.30 # higher fails ascii for py2
pyyaml
scikit-image
opencv-python-headless<4.3
openslide-python<=1.1.1
nibabel
nibabel<3.0
SimpleITK
psutil
pathos
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ numpy>=1.13.3
scipy>=1.0
pandas>=0.21
six>=1.10
pillow>=4.0, !=7.1 # 7.x fails to load PNG via skimage
pillow>=4.0, !=7 # 7.x fails to load PNG via skimage
matplotlib>=2.0.2
tqdm>=4.7.4
pyyaml>=3.12
Expand Down
14 changes: 10 additions & 4 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,22 @@ requirements-file = requirements.txt

[flake8]
# http://flake8.pycqa.org/en/latest/user/configuration.html
ignore = E402,E731
max-line-length = 100
exclude = .tox,*.egg,build,temp
select = E,W,F
doctests = True
verbose = 2
# max-complexity = 10
# https://pep8.readthedocs.io/en/latest/intro.html#error-codes
ignore =
E402
E501
format = pylint
max-line-length = 100

[tool:pytest]
log_cli = 1
addopts =
--doctest-modules
--color=yes
log_cli = 0
log_cli_level = CRITICAL
#log_cli_format = %(message)s
log_file = pytest.log
Expand Down
17 changes: 14 additions & 3 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
"""

# Always prefer setuptools over distutils
import sys
from os import path
from setuptools import setup
# io.open is needed for projects that support Python 2.7
Expand All @@ -21,10 +22,20 @@

PATH_HERE = path.abspath(path.dirname(__file__))

with open(path.join(PATH_HERE, 'requirements.txt'), encoding='utf-8') as fp:
reqs = [rq.rstrip() for rq in fp.readlines()]

def load_requirements(fname='requirements.txt'):
with open(path.join(PATH_HERE, fname), encoding='utf-8') as fp:
reqs = [rq.rstrip() for rq in fp.readlines()]
reqs = [ln[:ln.index('#')] if '#' in ln else ln for ln in reqs]
requirements = [ln for ln in reqs if ln]
reqs = [ln for ln in reqs if ln]
return reqs


if sys.version_info.major == 2:
requirements = load_requirements('requirements-py27.txt')
else:
requirements = load_requirements('requirements.txt')


# Get the long description from the README file
# with open(path.join(PATH_HERE, 'README.md'), encoding='utf-8') as fp:
Expand Down
1 change: 0 additions & 1 deletion tests/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,4 @@ flake8
check-manifest
codacy-coverage
parameterized
tox
mock
59 changes: 0 additions & 59 deletions tox.ini

This file was deleted.

0 comments on commit af909ee

Please sign in to comment.