Skip to content

Commit

Permalink
Modernizing the infrastructure (#135)
Browse files Browse the repository at this point in the history
* Fixed incorrect calls to label_kwargs and title_kwargs and added labelpad keyword argument

* added separate titles keyword

* added description of titles kwarg

* Support passing an empty Figure as the `fig` kwarg.

Small helper to support passing a new, empty Figure as the `fig` kwarg
(useful e.g. when embedding Matplotlib in a GUI -- the empty Figure
object may be created as part of the GUI setup).

Also document the supported values for `fig` -- in particular that if it
is unset, a *new* figure will be created, rather than overplotting the
current figure (which is a quite common behavior for libraries built
over Matplotlib, even though it doesn't really make sense here).

Matplotlib minimum version was bumped to 2.1 (2017) as that's what added
`Figure.subplots`.

* starting to modernize

* updating test infrastructe and baseline images

* adding github action for unit tests

* running isort

* don't capture warnings

* fixing warnings on gh actions?

* upload the images on failure

* experimenting with freetype

* removing travis build

* update matplotlib for better baseline images

* skip windows tests

* adding sdist build to tests

* cleaning up manifest and testing build

* run action on releases

Co-authored-by: Daniela Huppenkothen <dhuppenk@uw.edu>
Co-authored-by: Dominic Pesce <dom.pesce@gmail.com>
Co-authored-by: Antony Lee <anntzer.lee@gmail.com>
  • Loading branch information
4 people committed Jul 9, 2020
1 parent 07fe09c commit 6c70eb6
Show file tree
Hide file tree
Showing 82 changed files with 838 additions and 461 deletions.
93 changes: 93 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
name: Tests
on:
push:
branches: [main]
pull_request:
branches: [main]
release:
types: [published]

jobs:
tests:
name: "py${{ matrix.python-version }} on ${{ matrix.os }}"
runs-on: ${{ matrix.os }}
strategy:
matrix:
python-version: [3.7, 3.8]
os: [ubuntu-latest, macos-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: |
python -m pip install -U pip
python -m pip install ".[test]"
- name: Check the style
run: |
isort -c src/corner
isort -c tests
black --check src/corner
black --check tests
- name: Run the unit tests
run: python -m pytest -v tests

- uses: actions/upload-artifact@v2
if: ${{ failure() }}
with:
path: ./result_images

build:
name: Build source distribution
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2

- uses: actions/setup-python@v2
name: Install Python
with:
python-version: "3.8"

- name: Build
run: |
python -m pip install -U pip pep517 twine setuptools_scm
python -m pep517.build .
- name: Test the sdist
run: |
python -m venv venv-sdist
venv-sdist/bin/python -m pip install dist/corner*.tar.gz
venv-sdist/bin/python -c "import corner;print(corner.__version__)"
- name: Test the wheel
run: |
python -m venv venv-wheel
venv-wheel/bin/python -m pip install dist/corner*.whl
venv-wheel/bin/python -c "import corner;print(corner.__version__)"
- uses: actions/upload-artifact@v2
with:
path: dist/*

upload_pypi:
needs: [tests, build]
runs-on: ubuntu-latest
if: github.event_name == 'release' && github.event.action == 'published'
steps:
- uses: actions/download-artifact@v2
with:
name: artifact
path: dist

- uses: pypa/gh-action-pypi-publish@master
with:
user: __token__
password: ${{ secrets.pypi_password }}
# To test: repository_url: https://test.pypi.org/legacy/
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,4 @@ test_figures
.coverage
!corner/tests/baseline_images/*/*.png
.pytest_cache
corner_version.py
35 changes: 0 additions & 35 deletions .travis.yml

This file was deleted.

3 changes: 2 additions & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
Copyright (c) 2013-2016 Daniel Foreman-Mackey
Copyright (c) 2013-2020 Daniel Foreman-Mackey

All rights reserved.

Redistribution and use in source and binary forms, with or without
Expand Down
5 changes: 5 additions & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1 +1,6 @@
include README.rst LICENSE

exclude corner.png demo.py *.yml
recursive-exclude docs *
recursive-exclude tests *
recursive-exclude paper *
8 changes: 3 additions & 5 deletions README.rst
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
corner.py
=========

.. image:: http://img.shields.io/travis/dfm/corner.py/master.svg?style=flat
:target: https://travis-ci.org/dfm/corner.py
.. image:: https://coveralls.io/repos/github/dfm/corner.py/badge.svg?branch=master&style=flat
:target: https://coveralls.io/github/dfm/corner.py?branch=master&style=flat
.. image:: https://github.com/dfm/corner.py/workflows/Tests/badge.svg?style=flat
:target: https://github.com/dfm/corner.py/actions
.. image:: http://img.shields.io/badge/license-BSD-blue.svg?style=flat
:target: https://github.com/dfm/corner.py/blob/master/LICENSE
:target: https://github.com/dfm/corner.py/blob/main/LICENSE
.. image:: https://zenodo.org/badge/4729/dfm/corner.py.svg?style=flat
:target: https://zenodo.org/badge/latestdoi/4729/dfm/corner.py
.. image:: http://joss.theoj.org/papers/10.21105/joss.00024/status.svg?style=flat
Expand Down
47 changes: 0 additions & 47 deletions corner/__init__.py

This file was deleted.

Empty file removed corner/tests/__init__.py
Empty file.
Binary file removed corner/tests/baseline_images/test_corner/basic.png
Binary file not shown.
Binary file removed corner/tests/baseline_images/test_corner/color.png
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file removed corner/tests/baseline_images/test_corner/labels.png
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file removed corner/tests/baseline_images/test_corner/pandas.png
Binary file not shown.
Binary file not shown.
Binary file removed corner/tests/baseline_images/test_corner/reverse.png
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file removed corner/tests/baseline_images/test_corner/smooth2.png
Binary file not shown.
Binary file removed corner/tests/baseline_images/test_corner/tight.png
Binary file not shown.
Binary file removed corner/tests/baseline_images/test_corner/titles1.png
Binary file not shown.
Binary file removed corner/tests/baseline_images/test_corner/titles2.png
Binary file not shown.
Binary file not shown.
Binary file removed corner/tests/baseline_images/test_corner/truths.png
Binary file not shown.
Binary file removed corner/tests/baseline_images/test_hist2d/basic.png
Binary file not shown.
Binary file removed corner/tests/baseline_images/test_hist2d/color.png
Binary file not shown.
Binary file not shown.
Binary file removed corner/tests/baseline_images/test_hist2d/cutoff2.png
Binary file not shown.
Binary file removed corner/tests/baseline_images/test_hist2d/filled.png
Binary file not shown.
Binary file removed corner/tests/baseline_images/test_hist2d/levels1.png
Binary file not shown.
Binary file not shown.
Binary file removed corner/tests/baseline_images/test_hist2d/lowN.png
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
120 changes: 0 additions & 120 deletions corner/tests/test_corner.py

This file was deleted.

0 comments on commit 6c70eb6

Please sign in to comment.