Skip to content

Commit

Permalink
Merge pull request #27 from epfl-lts2/maintenance
Browse files Browse the repository at this point in the history
Some maintenance on the infrastructure. Kept in sync with
epfl-lts2/pygsp#81 to facilitate future maintenance by keeping their
infra similar.
  • Loading branch information
mdeff committed Dec 16, 2020
2 parents 892a0f6 + cf5a225 commit b0eb893
Show file tree
Hide file tree
Showing 17 changed files with 123 additions and 91 deletions.
15 changes: 11 additions & 4 deletions .readthedocs.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,15 @@
version: 2

formats:
- htmlzip

sphinx:
builder: html
configuration: doc/conf.py

python:
version: 3
pip_install: true
extra_requirements:
- dev
install:
- method: pip
path: .
extra_requirements:
- dev
4 changes: 2 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
language: python

python:
- 2.7
- 3.5
- 3.6
- 3.7
- 3.8
- 3.9

addons:
apt:
Expand Down
16 changes: 9 additions & 7 deletions doc/history.rst → CHANGELOG.rst
Original file line number Diff line number Diff line change
@@ -1,16 +1,18 @@
=======
History
=======
=========
Changelog
=========

Versions follow `SemVer <https://semver.org>`_ (we try our best).
All notable changes to this project will be documented in this file.
The format is based on `Keep a Changelog <https://keepachangelog.com>`_
and this project adheres to `Semantic Versioning <https://semver.org>`_.

Unreleased
----------

* Drop support of Python 3.4 and test with 3.7. Last version to support 2.7.
* New function: proj_positive.
* New function: structured_sparsity.
* Continuous integration with Python 3.6, 3.7, 3.8, 3.9. Dropped 2.7, 3.4, 3.5.
* Merged all the extra requirements in a single dev requirement.
* Addition of the proj_positive function
* Addition of the structured_sparsity function.

0.5.2 (2017-12-15)
------------------
Expand Down
4 changes: 2 additions & 2 deletions CONTRIBUTING.rst
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ If you have a nice example to demonstrate the use of the introduced
functionality, please consider adding a tutorial in ``doc/tutorials`` or a
short example in ``examples``.

Update ``README.rst`` and ``doc/history.rst`` if applicable.
Update ``README.rst`` and ``CHANGELOG.rst`` if applicable.

After making any change, please check the style, run the tests, and build the
documentation with the following (enforced by Travis CI)::
Expand All @@ -49,7 +49,7 @@ Making a release
----------------

#. Update the version number and release date in ``setup.py``,
``pyunlocbox/__init__.py`` and ``doc/history.rst``.
``pyunlocbox/__init__.py`` and ``CHANGELOG.rst``.
#. Create a git tag with ``git tag -a v0.5.0 -m "PyUNLocBox v0.5.0"``.
#. Push the tag to GitHub with ``git push github v0.5.0``. The tag should now
appear in the releases and tags tab.
Expand Down
1 change: 1 addition & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
include LICENSE.txt
include README.rst
include CHANGELOG.rst
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
NB = $(sort $(wildcard *.ipynb))
NB = $(sort $(wildcard examples/*.ipynb))
.PHONY: help clean lint test doc dist release

help:
Expand Down
12 changes: 6 additions & 6 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,14 @@ A (mostly unmaintained) `Matlab version <https://lts2.epfl.ch/unlocbox>`_ exists
:target: https://github.com/epfl-lts2/pyunlocbox/blob/master/LICENSE.txt
.. |pyversions| image:: https://img.shields.io/pypi/pyversions/pyunlocbox.svg
:target: https://pypi.org/project/pyunlocbox
.. |travis| image:: https://img.shields.io/travis/epfl-lts2/pyunlocbox.svg
:target: https://travis-ci.org/epfl-lts2/pyunlocbox
.. |travis| image:: https://img.shields.io/travis/com/epfl-lts2/pyunlocbox.svg
:target: https://travis-ci.com/epfl-lts2/pyunlocbox
.. |coveralls| image:: https://img.shields.io/coveralls/epfl-lts2/pyunlocbox.svg
:target: https://coveralls.io/github/epfl-lts2/pyunlocbox
.. |github| image:: https://img.shields.io/github/stars/epfl-lts2/pyunlocbox.svg?style=social
:target: https://github.com/epfl-lts2/pyunlocbox
.. |binder| image:: https://mybinder.org/badge_logo.svg
:target: https://mybinder.org/v2/gh/epfl-lts2/pyunlocbox/master?filepath=playground.ipynb
.. |binder| image:: https://static.mybinder.org/badge_logo.svg
:target: https://mybinder.org/v2/gh/epfl-lts2/pyunlocbox/master?urlpath=lab/tree/examples/playground.ipynb
.. |conda| image:: https://anaconda.org/conda-forge/pyunlocbox/badges/installer/conda.svg
:target: https://anaconda.org/conda-forge/pyunlocbox

Expand Down Expand Up @@ -115,7 +115,7 @@ Solution found after 9 iterations:
array([3.99990766, 4.99988458, 5.99986149, 6.99983841])

You can
`try it online <https://mybinder.org/v2/gh/epfl-lts2/pyunlocbox/master?filepath=playground.ipynb>`_,
`try it online <https://mybinder.org/v2/gh/epfl-lts2/pyunlocbox/master?urlpath=lab/tree/examples/playground.ipynb>`_,
look at the
`tutorials <https://pyunlocbox.readthedocs.io/en/stable/tutorials/index.html>`_
to learn how to use it, or look at the
Expand Down Expand Up @@ -144,7 +144,7 @@ Acknowledgments
The PyUNLocBoX was started in 2014 as an academic open-source project for
research purpose at the `EPFL LTS2 laboratory <https://lts2.epfl.ch>`_.

The code in this repository is released under the terms of the `BSD 3-Clause license <LICENSE.txt>`_.
It is released under the terms of the BSD 3-Clause license.

If you are using the library for your research, for the sake of
reproducibility, please cite the version you used as indexed by
Expand Down
1 change: 1 addition & 0 deletions doc/changelog.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.. include:: ../CHANGELOG.rst
34 changes: 27 additions & 7 deletions doc/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,29 @@

import pyunlocbox

extensions = ['sphinx.ext.viewcode',
'sphinx.ext.autosummary',
'sphinx.ext.mathjax',
'sphinx.ext.inheritance_diagram',
'sphinxcontrib.bibtex']
extensions = [
'sphinx.ext.viewcode',
'sphinx.ext.autosummary',
'sphinx.ext.mathjax',
'sphinx.ext.inheritance_diagram',
]

extensions.append('sphinx.ext.autodoc')
autodoc_default_flags = ['members', 'undoc-members', 'show-inheritance']
autodoc_member_order = 'bysource' # alphabetical, groupwise, bysource
autodoc_default_options = {
'members': True,
'undoc-members': True,
'show-inheritance': True,
'member-order': 'bysource', # alphabetical, groupwise, bysource
}

extensions.append('sphinx.ext.intersphinx')
intersphinx_mapping = {
'python': ('https://docs.python.org/3', None),
'numpy': ('https://numpy.org/doc/stable', None),
'scipy': ('https://docs.scipy.org/doc/scipy/reference', None),
'matplotlib': ('https://matplotlib.org', None),
'pygsp': ('https://pygsp.readthedocs.io/en/stable', None),
}

extensions.append('numpydoc')
numpydoc_show_class_members = False
Expand All @@ -21,6 +35,12 @@
plot_html_show_formats = False
plot_working_directory = '.'

extensions.append('sphinx_copybutton')
copybutton_prompt_text = ">>> "

extensions.append('sphinxcontrib.bibtex')
bibtex_bibfiles = ['references.bib']

exclude_patterns = ['_build']
source_suffix = '.rst'
master_doc = 'index'
Expand Down
2 changes: 1 addition & 1 deletion doc/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@
Home <self>
tutorials/index
reference/index
changelog
contributing
history
references
6 changes: 3 additions & 3 deletions doc/reference/index.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
===============
Reference guide
===============
=============
API reference
=============

.. automodule:: pyunlocbox

Expand Down
14 changes: 10 additions & 4 deletions playground.ipynb → examples/playground.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@
"source": [
"## 3 Tutorials\n",
"\n",
"Try to follow one of our [tutorials](https://pyunlocbox.readthedocs.io/en/stable/tutorials/index.html)."
"Try our [tutorials](https://pyunlocbox.readthedocs.io/en/stable/tutorials/index.html)."
]
},
{
Expand All @@ -122,8 +122,8 @@
"source": [
"## 4 Playground\n",
"\n",
"Or try anything that goes through your mind!\n",
"Look at the [reference guide](https://pyunlocbox.readthedocs.io/en/stable/reference/index.html) to know more about the API."
"Try something of your own!\n",
"The [API reference](https://pyunlocbox.readthedocs.io/en/stable/reference/index.html) is your friend."
]
},
{
Expand Down Expand Up @@ -152,7 +152,13 @@
]
}
],
"metadata": {},
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
}
},
"nbformat": 4,
"nbformat_minor": 4
}
23 changes: 12 additions & 11 deletions pyunlocbox/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,18 @@
"""

# When importing the toolbox, you surely want these modules.
from pyunlocbox import functions
from pyunlocbox import solvers
from pyunlocbox import operators
from pyunlocbox import acceleration

# Silence the code checker warning about unused symbols.
assert functions
assert solvers
assert operators
assert acceleration
from pyunlocbox import functions # noqa: F401
from pyunlocbox import solvers # noqa: F401
from pyunlocbox import acceleration # noqa: F401
from pyunlocbox import operators # noqa: F401

__version__ = '0.5.2'
__release_date__ = '2017-12-15'


def test(): # pragma: no cover
"""Run the test suite."""
import unittest
# Lazy as it might be slow and require additional dependencies.
from pyunlocbox.tests import suite
unittest.TextTestRunner(verbosity=2).run(suite)
24 changes: 24 additions & 0 deletions pyunlocbox/tests/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-

"""
Test suite for the pyunlocbox package, broken by modules.
"""

import unittest

from . import test_functions
from . import test_operators
from . import test_solvers
from . import test_acceleration
from . import test_docstrings


suite = unittest.TestSuite([
test_functions.suite,
test_operators.suite,
test_solvers.suite,
test_acceleration.suite,
test_docstrings.suite,
])
32 changes: 0 additions & 32 deletions pyunlocbox/tests/test_all.py

This file was deleted.

2 changes: 1 addition & 1 deletion pyunlocbox/tests/test_docstrings.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ def test_docstrings(root, ext):
return doctest.DocFileSuite(*files, module_relative=False)


# Docstrings from reference documentation.
# Docstrings from API reference.
suite_reference = test_docstrings('pyunlocbox', '.py')

# Docstrings from tutorials.
Expand Down
22 changes: 12 additions & 10 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,32 +14,34 @@
url='https://github.com/epfl-lts2/pyunlocbox',
project_urls={
'Documentation': 'https://pyunlocbox.readthedocs.io',
'Download': 'https://pypi.org/project/pyunlocbox',
'Source Code': 'https://github.com/epfl-lts2/pyunlocbox',
'Bug Tracker': 'https://github.com/epfl-lts2/pyunlocbox/issues',
'Try It Online': 'https://mybinder.org/v2/gh/epfl-lts2/pyunlocbox/master?filepath=playground.ipynb', # noqa
'Try It Online': 'https://mybinder.org/v2/gh/epfl-lts2/pyunlocbox/master?urlpath=lab/tree/examples/playground.ipynb', # noqa
},
packages=[
'pyunlocbox',
'pyunlocbox.tests'
],
test_suite='pyunlocbox.tests.test_all.suite',
test_suite='pyunlocbox.tests.suite',
install_requires=[
'numpy',
'scipy'
],
extras_require={
'dev': [
# Testing dependencies.
# Run the tests.
'flake8',
'coverage',
'coveralls',
# Dependencies to build the documentation.
# Build the documentation.
'sphinx',
'numpydoc',
'sphinxcontrib-bibtex',
'sphinx-rtd-theme',
'sphinx-copybutton',
'matplotlib',
# Dependencies to build and upload packages.
# Build and upload packages.
'wheel',
'twine',
],
Expand All @@ -48,18 +50,18 @@
keywords='convex optimization',
platforms='any',
classifiers=[
'Topic :: Scientific/Engineering :: Mathematics',
'Environment :: Console',
'Development Status :: 4 - Beta',
'Topic :: Scientific/Engineering',
'Intended Audience :: Developers',
'Intended Audience :: Education',
'Intended Audience :: Science/Research',
'License :: OSI Approved :: BSD License',
'Natural Language :: English',
'Operating System :: OS Independent',
'Programming Language :: Python :: 2.7',
'Programming Language :: Python :: 3.5',
'Programming Language :: Python',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: 3.7',
'Programming Language :: Python :: 3.8',
'Programming Language :: Python :: 3.9',
],
)

0 comments on commit b0eb893

Please sign in to comment.