Skip to content

Commit

Permalink
code cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
paulmueller committed Apr 12, 2021
1 parent 2877d8c commit b822858
Show file tree
Hide file tree
Showing 14 changed files with 228 additions and 254 deletions.
42 changes: 42 additions & 0 deletions .github/workflows/check.yml
@@ -0,0 +1,42 @@
name: Checks

on:
push:
pull_request:
schedule:
- cron: "0 0 1 * *"

jobs:
build:

runs-on: ${{ matrix.os }}
strategy:
matrix:
python-version: ['3.7', '3.8']
os: [ubuntu-latest, windows-latest]

steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
# prerequisites
python -m pip install --upgrade pip wheel
python -m pip install codecov coverage flake8 pytest
# install dependencies
pip install -e .
# show installed packages
pip freeze
- name: Test with pytest
run: |
coverage run --source=qpsphere -m pytest tests
- name: Lint with flake8
run: |
flake8 .
- name: Submit code coverage
run: |
coverage report -m
codecov
44 changes: 44 additions & 0 deletions .github/workflows/deploy_pypi.yml
@@ -0,0 +1,44 @@
name: Release to PyPI

on:
push:
tags:
- '*'

jobs:
deploy:

runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, windows-latest]
steps:
- uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: 3.8
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install setuptools wheel twine
pip install -e .
- name: Build and publish (Linux)
if: runner.os == 'Linux'
env:
TWINE_USERNAME: ci_qpi
TWINE_PASSWORD: ${{ secrets.PYPI_PWD }}
run: |
# give the wheel a specific platform name for linux
python setup.py bdist_wheel --plat-name manylinux1_x86_64
python setup.py sdist
twine upload --skip-existing dist/*
- name: Build and publish (Windows)
if: runner.os == 'Windows'
env:
TWINE_USERNAME: ci_qpi
TWINE_PASSWORD: ${{ secrets.PYPI_PWD }}
run: |
# platform name for Windows
python setup.py bdist_wheel --plat-name win_amd64
twine upload --skip-existing dist/*
1 change: 1 addition & 0 deletions .gitignore
Expand Up @@ -109,3 +109,4 @@ _version_save.py
qpsphere/resources/*.bin
qpsphere/resources/*.exe
qpsphere/resources/*.dll
.idea
9 changes: 7 additions & 2 deletions .readthedocs.yml
@@ -1,5 +1,10 @@
version: 2
formats:
- pdf
requirements_file: docs/requirements.txt
python:
version: 3
version: 3.8
install:
- requirements: docs/requirements.txt
- method: pip
path: .
system_packages: false
41 changes: 0 additions & 41 deletions .travis.yml

This file was deleted.

4 changes: 4 additions & 0 deletions CHANGELOG
@@ -1,3 +1,7 @@
0.5.8
- build: migrate to GitHub Actions
- tests: setup.py test is deprecated
- docs: refurbish docs
0.5.7
- setup: bump qpimage from 0.4.0 to 0.6.1
0.5.6
Expand Down
14 changes: 7 additions & 7 deletions README.rst
@@ -1,10 +1,11 @@
qpsphere
========

|PyPI Version| |Tests Status Linux| |Tests Status Win| |Coverage Status| |Docs Status|
|PyPI Version| |Tests Status| |Coverage Status| |Docs Status|


**qpsphere** is a Python3 library for analyzing spherical objects in quantitative phase imaging.
**qpsphere** is a Python3 library for analyzing spherical objects in
quantitative phase imaging.


Documentation
Expand All @@ -28,7 +29,8 @@ Testing
::

pip install -e .
python setup.py test
pip install pytest
pytest tests


Releases to PyPI
Expand All @@ -47,10 +49,8 @@ command line argument must be set.

.. |PyPI Version| image:: https://img.shields.io/pypi/v/qpsphere.svg
:target: https://pypi.python.org/pypi/qpsphere
.. |Tests Status Linux| image:: https://img.shields.io/travis/RI-imaging/qpsphere.svg?label=tests_linux
:target: https://travis-ci.com/RI-imaging/qpsphere
.. |Tests Status Win| image:: https://img.shields.io/appveyor/ci/paulmueller/qpsphere/master.svg?label=tests_win
:target: https://ci.appveyor.com/project/paulmueller/qpsphere
.. |Tests Status| image:: https://img.shields.io/github/workflow/status/RI-Imaging/qpsphere/Checks
:target: https://github.com/RI-Imaging/qpsphere/actions?query=workflow%3AChecks
.. |Coverage Status| image:: https://img.shields.io/codecov/c/github/RI-imaging/qpsphere/master.svg
:target: https://codecov.io/gh/RI-imaging/qpsphere
.. |Docs Status| image:: https://readthedocs.org/projects/qpsphere/badge/?version=latest
Expand Down
57 changes: 0 additions & 57 deletions appveyor.yml

This file was deleted.

55 changes: 18 additions & 37 deletions docs/conf.py
Expand Up @@ -22,10 +22,12 @@
# sys.path.insert(0, os.path.abspath('.'))

# Get version number from qpsphere._version file
import mock
import os
import os.path as op
import sys

import qpsphere

# include parent directory
pdir = op.dirname(op.dirname(op.abspath(__file__)))
sys.path.insert(0, pdir)
Expand All @@ -40,21 +42,9 @@
# Used for linking to libraries in the qpimage universe
rtd_link = "stable" if rtd_version != "latest" else "latest"


# Mock all dependencies
install_requires = ["lmfit", "matplotlib", "matplotlib.pylab",
"nrefocus", "numpy", "scipy", "h5py",
"scipy.interpolate", "scipy.special",
"skimage", "skimage.restoration",
"qpimage"]

for mod_name in install_requires:
sys.modules[mod_name] = mock.Mock()

# http://www.sphinx-doc.org/en/stable/ext/autodoc.html#confval-autodoc_member_order
# Order class attributes and functions in separate blocks
autodoc_member_order = 'bysource'
autodoc_mock_imports = install_requires
autoclass_content = 'both'

# Display link to GitHub repo instead of doc on rtfd
Expand All @@ -81,6 +71,9 @@
'fancy_include',
]

# specify bibtex files (required for sphinxcontrib.bibtex>=2.0)
bibtex_bibfiles = ['qpsphere.bib']

# Add any paths that contain templates here, relative to this directory.
templates_path = ['_templates']

Expand All @@ -103,11 +96,11 @@
# built documents.
#
# The short X.Y version.
#
#
# The full version, including alpha/beta/rc tags.
# This gets 'version'
exec(open(op.join(pdir, "qpsphere/_version.py")).read())
release = version #@UndefinedVariable
version = qpsphere.__version__
release = version
# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
#
Expand All @@ -134,17 +127,6 @@
#
html_theme = 'default'

# Theme options are theme-specific and customize the look and feel of a theme
# further. For a list of options available for each theme, see the
# documentation.
#
# html_theme_options = {}

# Add any paths that contain custom static files (such as style sheets) here,
# relative to this directory. They are copied after the builtin static files,
# so a file named "default.css" will overwrite the builtin "default.css".
#html_static_path = ['_static']


# -- Options for HTMLHelp output ------------------------------------------

Expand Down Expand Up @@ -203,14 +185,13 @@
]




# Example configuration for intersphinx: refer to the Python standard library.
intersphinx_mapping = {"python": ('https://docs.python.org/', None),
"numpy": ('http://docs.scipy.org/doc/numpy', None),
"scipy": ('https://docs.scipy.org/doc/scipy/reference/', None),
"skimage": ('http://scikit-image.org/docs/stable/', None),
"lmfit": ('http://lmfit.github.io/lmfit-py/', None),
"qpimage": ('http://qpimage.readthedocs.io/en/'+rtd_link, None),
"qpformat": ('http://qpformat.readthedocs.io/en/'+rtd_link, None),
}
intersphinx_mapping = {
"python": ('https://docs.python.org/', None),
"numpy": ('http://docs.scipy.org/doc/numpy', None),
"scipy": ('https://docs.scipy.org/doc/scipy/reference/', None),
"skimage": ('http://scikit-image.org/docs/stable/', None),
"lmfit": ('http://lmfit.github.io/lmfit-py/', None),
"qpimage": ('http://qpimage.readthedocs.io/en/'+rtd_link, None),
"qpformat": ('http://qpformat.readthedocs.io/en/'+rtd_link, None),
}
2 changes: 1 addition & 1 deletion docs/sec_z_bib.rst
Expand Up @@ -2,4 +2,4 @@
Bilbliography
=============

.. bibliography:: qpsphere.bib
.. bibliography::
2 changes: 1 addition & 1 deletion qpsphere/models/mod_mie_avg.py
Expand Up @@ -137,7 +137,7 @@ def mie_avg(radius=5e-6, sphere_index=1.339, medium_index=1.333,
d=-((radius+focus) / pixel_size) * interpolate,
nm=medium_index,
res=wavelength / pixel_size * interpolate
)
)

# Phase (2PI offset corrected) and amplitude
ampli, phase = field2ap_corr(refoc_field2d)
Expand Down
3 changes: 0 additions & 3 deletions setup.cfg
@@ -1,6 +1,3 @@
[aliases]
test = pytest

[metadata]
license_file = LICENSE

0 comments on commit b822858

Please sign in to comment.