Skip to content

Commit

Permalink
Merge pull request #31 from astrofrog/update-infrastructure
Browse files Browse the repository at this point in the history
Update package infrastructure
  • Loading branch information
astrofrog authored Aug 3, 2020
2 parents 5f39a17 + e95aaa0 commit c88a110
Show file tree
Hide file tree
Showing 17 changed files with 138 additions and 149 deletions.
43 changes: 0 additions & 43 deletions .circleci/config.yml

This file was deleted.

35 changes: 0 additions & 35 deletions .travis.yml

This file was deleted.

33 changes: 0 additions & 33 deletions appveyor.yml

This file was deleted.

38 changes: 38 additions & 0 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
resources:
repositories:
- repository: OpenAstronomy
type: github
endpoint: astrofrog
name: OpenAstronomy/azure-pipelines-templates
ref: master

jobs:

- template: run-tox-env.yml@OpenAstronomy
parameters:

coverage: codecov

envs:

# PEP8 checks
- linux: codestyle
coverage: 'false'

# Linux builds - test on all supported Matplotlib versions
- linux: py36-test-mpl30
- linux: py37-test-mpl31
- linux: py37-test-mpl32
- linux: py38-test-mpl33
- linux: py38-test-mpldev

# MacOS X and Windows builds - alternative Matplotlib versions
- windows: py36-test-mpl30
- macos: py37-test-mpl31
- windows: py37-test-mpl32
- macos: py38-test-mpl33
- windows: py38-test-mpldev

# Image tests
- linux: py37-test-mpl30-image
- linux: py37-test-mpl31-image
11 changes: 8 additions & 3 deletions mpl_scatter_density/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
from .scatter_density_artist import *
from .scatter_density_axes import *
from .scatter_density_artist import * # noqa
from .scatter_density_axes import * # noqa

__version__ = '0.7.dev0'
from pkg_resources import get_distribution, DistributionNotFound

try:
__version__ = get_distribution('mpl-scatter-density').version
except DistributionNotFound:
__version__ = 'undefined'
2 changes: 0 additions & 2 deletions mpl_scatter_density/base_image_artist.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
from __future__ import division, print_function

import inspect

import numpy as np
Expand Down
2 changes: 0 additions & 2 deletions mpl_scatter_density/color.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
from __future__ import division, print_function

import matplotlib.colors as colors

__all__ = ['make_cmap']
Expand Down
2 changes: 0 additions & 2 deletions mpl_scatter_density/fixed_data_density_helper.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
from __future__ import division, print_function

from math import log10

import numpy as np
Expand Down
11 changes: 7 additions & 4 deletions mpl_scatter_density/generic_density_artist.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
from __future__ import division, print_function

import numpy as np

from .color import make_cmap
Expand Down Expand Up @@ -48,12 +46,17 @@ class GenericDensityArtist(BaseImageArtist):
Any additional keyword arguments are passed to AxesImage.
"""

def __init__(self, ax, dpi=72, color=None, vmin=None, vmax=None, norm=None, histogram2d_func=None, update_while_panning=True, **kwargs):
def __init__(self, ax, dpi=72, color=None, vmin=None, vmax=None, norm=None,
histogram2d_func=None, update_while_panning=True, **kwargs):

self._density_vmin = np.nanmin
self._density_vmax = np.nanmax

super(GenericDensityArtist, self).__init__(ax, array_func=histogram2d_func, dpi=dpi, update_while_panning=update_while_panning, **kwargs)
super(GenericDensityArtist, self).__init__(ax,
array_func=histogram2d_func,
dpi=dpi,
update_while_panning=update_while_panning,
**kwargs)

if color is not None:
self.set_color(color)
Expand Down
9 changes: 5 additions & 4 deletions mpl_scatter_density/scatter_density_artist.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
from __future__ import division, print_function

from .generic_density_artist import GenericDensityArtist
from .fixed_data_density_helper import FixedDataDensityHelper

Expand Down Expand Up @@ -54,8 +52,11 @@ class ScatterDensityArtist(GenericDensityArtist):
"""

def __init__(self, ax, x, y, downres_factor=4, c=None, **kwargs):
self.histogram2d_helper = FixedDataDensityHelper(ax, x, y, c=c, downres_factor=downres_factor)
super(ScatterDensityArtist, self).__init__(ax, histogram2d_func=self.histogram2d_helper, **kwargs)
self.histogram2d_helper = FixedDataDensityHelper(ax, x, y, c=c,
downres_factor=downres_factor)
super(ScatterDensityArtist, self).__init__(ax,
histogram2d_func=self.histogram2d_helper,
**kwargs)

def set_xy(self, x, y):
self.histogram2d_helper.set_xy(x, y)
Expand Down
2 changes: 0 additions & 2 deletions mpl_scatter_density/scatter_density_axes.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
from __future__ import division, print_function

import numpy as np

import matplotlib.pyplot as plt
Expand Down
4 changes: 1 addition & 3 deletions mpl_scatter_density/tests/test_scatter_density_artist.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
from __future__ import division, print_function

import time
from mock import MagicMock, Mock
from unittest.mock import MagicMock, Mock
import pytest
import numpy as np
import matplotlib.pyplot as plt
Expand Down
2 changes: 0 additions & 2 deletions mpl_scatter_density/tests/test_scatter_density_axes.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
from __future__ import division, print_function

import pytest
import numpy as np
import matplotlib.pyplot as plt
Expand Down
5 changes: 5 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
[build-system]
requires = ["setuptools",
"setuptools_scm",
"wheel"]
build-backend = 'setuptools.build_meta'
26 changes: 26 additions & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
[metadata]
name = mpl-scatter-density
url = https://github.com/astrofrog/mpl-scatter-density
author = Thomas Robitaille
author_email = [email protected]
license = BSD
description = Matplotlib helpers to make density scatter plots
long_description = file: README.rst

[options]
zip_safe = True
packages = find:
python_requires = >=3.6
install_requires =
numpy
matplotlib>=3.0
fast-histogram>=0.3

[options.extras_require]
test =
pytest
pytest-cov
pytest-mpl

[options.package_data]
mpl_scatter_density.tests = baseline/*/*.png
29 changes: 15 additions & 14 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
from setuptools import setup, find_packages

setup(name='mpl-scatter-density',
version='0.7.dev0',
description='Matplotlib helpers to make density scatter plots',
long_description=open('README.rst').read(),
install_requires=['numpy', 'matplotlib>=3.0', 'fast-histogram>=0.3'],
python_requires='>=3.6',
author='Thomas Robitaille',
author_email='[email protected]',
license='BSD',
url='https://github.com/astrofrog/mpl-scatter-density',
package_data={'mpl_scatter_density.tests': ['baseline/*/*.png']},
packages=find_packages())
#!/usr/bin/env python

import sys
from distutils.version import LooseVersion

try:
import setuptools
assert LooseVersion(setuptools.__version__) >= LooseVersion('30.3')
except (ImportError, AssertionError):
sys.stderr.write("ERROR: setuptools 30.3 or later is required\n")
sys.exit(1)

from setuptools import setup

setup(use_scm_version=True)
33 changes: 33 additions & 0 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
[tox]
envlist =
py{36,37,38}-test{-mpl30,-mpl31,-mpl32,-mpl33,-mpldev}{,-image}
codestyle
requires =
setuptools >= 30.3.0
pip >= 19.3.1
isolated_build = true

[testenv]
setenv =
image: MPLFLAGS = --mpl
!image: MPLFLAGS =
changedir = .tmp/{envname}
deps =
mpl30: matplotlib==3.0.*
mpl31: matplotlib==3.1.*
mpl32: matplotlib==3.2.*
mpl33: matplotlib==3.3.*
mpldev: git+https://github.com/matplotlib/matplotlib.git#egg=matplotlib
extras =
test

commands =
pip freeze
pytest --pyargs mpl_scatter_density {env:MPLFLAGS} --cov mpl_scatter_density --cov-config={toxinidir}/setup.cfg {posargs}

[testenv:codestyle]
skip_install = true
description = check code style
deps = flake8
changedir = {toxinidir}
commands = flake8 mpl_scatter_density --count --max-line-length=100

0 comments on commit c88a110

Please sign in to comment.