Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

REL: release 1.7.0 #95

Merged
merged 89 commits into from
Dec 17, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
89 commits
Select commit Hold shift + click to select a range
baa7819
MNT: migrate setup.py -> setup.cfg
neutrinoceros Dec 16, 2023
69dc4b1
MNT: migrate setup.cfg -> pyproject.toml
neutrinoceros Dec 16, 2023
47d09d6
MNT: drop setup.py
neutrinoceros Dec 16, 2023
ef7c179
MNT: add dev comment
neutrinoceros Dec 16, 2023
13d69d0
Merge pull request #55 from neutrinoceros/modernize_project_metadata
neutrinoceros Dec 16, 2023
5d8fb0f
MNT: drop support for EOL Python versions 3.6 and 3.7
neutrinoceros Dec 16, 2023
00d38fb
Merge pull request #56 from neutrinoceros/drop_eol_pythons
neutrinoceros Dec 16, 2023
4c3c34d
MNT: fixup codespell check
neutrinoceros Dec 16, 2023
38a784a
Merge pull request #57 from 1313e/fix_linting
neutrinoceros Dec 16, 2023
613f145
MNT: enable dependabot
neutrinoceros Dec 16, 2023
e1483c4
Merge pull request #59 from neutrinoceros/deploy_dependabot
neutrinoceros Dec 16, 2023
f713c78
MNT: migrate linting and formatting to pre-commit + ruff
neutrinoceros Dec 16, 2023
a010823
STY: autofixes (ruff)
neutrinoceros Dec 16, 2023
7a7920d
MNT: add .git-blame-ignore-revs
neutrinoceros Dec 16, 2023
fdcd2fe
Merge pull request #60 from neutrinoceros/pre-commit
neutrinoceros Dec 16, 2023
746e963
MNT: upgrade GHA
neutrinoceros Dec 16, 2023
1968c74
Merge pull request #61 from neutrinoceros/ruff_lint
neutrinoceros Dec 16, 2023
2b1331d
MNT: temporarily deactivate cross-plateform CI
neutrinoceros Dec 16, 2023
a1bc1f8
MNT: exclude new dev-only files in MANIFEST.in
neutrinoceros Dec 16, 2023
a0dbac6
Merge pull request #62 from neutrinoceros/upgrade_actions
neutrinoceros Dec 16, 2023
7021083
Merge pull request #64 from neutrinoceros/deactivate-broken-ci
neutrinoceros Dec 16, 2023
fa09fdd
TST: add color to pytest output in CI
neutrinoceros Dec 16, 2023
86998ee
Merge pull request #63 from neutrinoceros/pre-commit
neutrinoceros Dec 16, 2023
89aeab5
Merge pull request #65 from neutrinoceros/colored-pytest-logs
neutrinoceros Dec 16, 2023
1c1956a
TST: fix utility tests
neutrinoceros Dec 16, 2023
d034eb2
Merge pull request #66 from neutrinoceros/fixup_tests
neutrinoceros Dec 16, 2023
0d6f921
STY: manually fix remaining ruff violations
neutrinoceros Dec 16, 2023
a71a91b
STY: fix EOF
neutrinoceros Dec 16, 2023
53a1962
ignore autofix in git blame
neutrinoceros Dec 16, 2023
8be853d
Merge pull request #67 from neutrinoceros/ruff_lint_manual
neutrinoceros Dec 16, 2023
3d5ed1e
Merge pull request #68 from neutrinoceros/fixup_eof
neutrinoceros Dec 16, 2023
1a885e2
STY: apply ruff-format
neutrinoceros Dec 16, 2023
b3290b0
ignore autofix in git blame
neutrinoceros Dec 16, 2023
68b9f2b
Merge pull request #69 from neutrinoceros/fixup_format
neutrinoceros Dec 16, 2023
bd2ceff
STY: fix trailing whitespaces
neutrinoceros Dec 16, 2023
9979b0f
ignore autofix in git blame
neutrinoceros Dec 16, 2023
b9543f4
MNT: fix bandit pre-commit hook
neutrinoceros Dec 16, 2023
7b06c54
Merge pull request #70 from neutrinoceros/fixup_trailing_whitespace
neutrinoceros Dec 16, 2023
c9597d2
Merge pull request #71 from neutrinoceros/fixup_bandit
neutrinoceros Dec 16, 2023
9cbafca
MNT: prettify yaml files
neutrinoceros Dec 16, 2023
9fc81e7
ignore autofix in git blame
neutrinoceros Dec 16, 2023
e7dbb87
add missing comment
neutrinoceros Dec 16, 2023
403b883
Merge pull request #72 from neutrinoceros/fixup_yaml
neutrinoceros Dec 16, 2023
30fc6a8
MNT: fixup codespell pre-commit hook
neutrinoceros Dec 16, 2023
5675b82
Merge pull request #73 from neutrinoceros/fixup_codespell
neutrinoceros Dec 16, 2023
f427fb7
MNT: temporarily disable safety check
neutrinoceros Dec 16, 2023
28f987b
DEP: bump minimal requirements on matplotlib 3.5 and numpy 1.17.3
neutrinoceros Dec 16, 2023
35f4df3
Merge pull request #75 from neutrinoceros/disable_safety_check
neutrinoceros Dec 16, 2023
b0c72e3
Merge pull request #76 from neutrinoceros/bump_requirements
neutrinoceros Dec 16, 2023
6c6872d
API: remove deprecated colormap alias (heat -> torch)
neutrinoceros Dec 16, 2023
ebd6a7e
Merge pull request #77 from neutrinoceros/honor_1.6_deprecations
neutrinoceros Dec 16, 2023
7ee0833
DEP: drop dependency on e13tools (broken on Python 3.12)
neutrinoceros Dec 16, 2023
783e769
Merge pull request #78 from neutrinoceros/drop_e13tools
neutrinoceros Dec 16, 2023
2afb4a5
MNT: fix deprecation warnings from matplotlib
neutrinoceros Dec 16, 2023
4f8e918
DEP: test against matplotlib/viscm instead of fork
neutrinoceros Dec 17, 2023
731cbb1
Merge pull request #79 from neutrinoceros/mpl_depr
neutrinoceros Dec 17, 2023
4bac245
Merge pull request #80 from neutrinoceros/root_viscm
neutrinoceros Dec 17, 2023
6ab1440
BUG: fix a future warning from numpy (avoid iterating over scalar array)
neutrinoceros Dec 17, 2023
2811d9c
Merge pull request #81 from neutrinoceros/iteration_over_scalar_array
neutrinoceros Dec 17, 2023
5be1c42
TST: treat warnings as errors
neutrinoceros Dec 16, 2023
9654599
Merge pull request #74 from neutrinoceros/warnings_as_errors
neutrinoceros Dec 17, 2023
0f3e8f5
MNT: drop support for Python 3.8
neutrinoceros Dec 17, 2023
9f8afca
STY: upgrade to Python 3.9 syntax
neutrinoceros Dec 17, 2023
d2b12fe
Merge pull request #83 from neutrinoceros/drop_py38
neutrinoceros Dec 17, 2023
7f27570
TST: add explicit support for Python 3.10 to 3.12
neutrinoceros Dec 17, 2023
c889ad3
Merge pull request #82 from neutrinoceros/test_more_pythons
neutrinoceros Dec 17, 2023
d92cebf
TST: drop support for Windows x86 (32 bits arch)
neutrinoceros Dec 17, 2023
5ce73e7
Merge pull request #85 from neutrinoceros/drop_win32
neutrinoceros Dec 17, 2023
fbaf21a
TST: re-enable tests on Windows and MacOS
neutrinoceros Dec 17, 2023
b718056
Merge pull request #84 from neutrinoceros/reenable_cross_platform_tests
neutrinoceros Dec 17, 2023
4d93397
MNT: cleanup unused requirement
neutrinoceros Dec 17, 2023
8e614b2
Merge pull request #87 from neutrinoceros/cleanup_requirements
neutrinoceros Dec 17, 2023
16e381a
MNT: bump minimal requirement for numpy
neutrinoceros Dec 17, 2023
f949dc7
Merge pull request #88 from neutrinoceros/bump_minimal_numpy
neutrinoceros Dec 17, 2023
69e8c42
BUG: fix compatibility with matplotlib 3.5
neutrinoceros Dec 17, 2023
ba4fb30
Merge pull request #89 from neutrinoceros/hotfix_mpl_compat
neutrinoceros Dec 17, 2023
3f0e8e4
ENH: delay expensive imports
neutrinoceros Dec 17, 2023
c9fe130
TST: filter a deprecation warning that we do not control
neutrinoceros Dec 17, 2023
b508e33
Merge pull request #90 from neutrinoceros/optimize_startup
neutrinoceros Dec 17, 2023
019f65c
TST: test against minimal env
neutrinoceros Dec 17, 2023
62bcbd1
Merge pull request #86 from neutrinoceros/test_min_env
neutrinoceros Dec 17, 2023
f0e1dd1
MNT: stop linting with flake8 (ruff is already doing the job)
neutrinoceros Dec 17, 2023
865eea7
Merge pull request #91 from neutrinoceros/drop_flake8
neutrinoceros Dec 17, 2023
369fbd4
TST: simplify pytest runs
neutrinoceros Dec 17, 2023
d581162
Merge pull request #92 from neutrinoceros/no_pytest_in_lint
neutrinoceros Dec 17, 2023
cf7c85a
TST: separate publication-related tasks from normal tests
neutrinoceros Dec 17, 2023
3d7f122
Merge pull request #93 from neutrinoceros/separate_ci_tasks
neutrinoceros Dec 17, 2023
368183e
REL: prepare release 1.7.0
neutrinoceros Dec 17, 2023
ea6cf47
Merge pull request #94 from neutrinoceros/rel_1.7.0
neutrinoceros Dec 17, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 13 additions & 13 deletions .codecov.yml
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
codecov:
notify:
require_ci_to_pass: yes
notify:
require_ci_to_pass: yes

coverage:
round: nearest
precision: 2
status:
project:
default:
target: 99%
patch:
default:
target: 95%
changes: yes
round: nearest
precision: 2
status:
project:
default:
target: 99%
patch:
default:
target: 95%
changes: yes

comment:
require_changes: yes
require_changes: yes
14 changes: 14 additions & 0 deletions .git-blame-ignore-revs
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# ruff auto fixing lints
a010823543c72d4a92ed9994d690366ca5e02018

# ruff-format
1a885e2c1cc0c7808c0fc589a49465a61f31f2f0

# EOF autofix
a71a91b1c588d84bf1ab4cb3003a987b3c253f05

# trailing whitespace autofix
bd2ceff52a3a310e7bb31faaa85f75b24ef60a36

# prettify yaml files
9cbafca68712562e3e03b4023b11942cb6858050
16 changes: 16 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Please see the documentation for all configuration options:
# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates

version: 2
updates:
- package-ecosystem: pip
directory: /
target-branch: develop
schedule:
interval: monthly

- package-ecosystem: github-actions
directory: /.github/workflows
target-branch: develop
schedule:
interval: monthly
23 changes: 8 additions & 15 deletions .github/workflows/lint_python.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,11 @@ jobs:
lint_python:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
- run: pip install bandit black codespell flake8 isort mypy pytest pyupgrade safety
- run: bandit --recursive --skip B101 . # B101 is assert statements
- run: black --check . || true
- run: codespell --ignore-words-list="mutch"
- run: flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
- run: flake8 . --count --exit-zero --max-complexity=10 --max-line-length=88 --show-source --statistics
- run: isort --check-only --profile black . || true
- run: pip install -r requirements.txt || true
- run: mypy --ignore-missing-imports . || true
- run: pytest . || true
- run: pytest --doctest-modules . || true
- run: shopt -s globstar && pyupgrade --py36-plus **/*.py || true
- run: safety check
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
- run: pipx run pre-commit run --all-files
- run: pip install mypy pytest safety
- run: pip install -r requirements.txt || true
- run: mypy --ignore-missing-imports . || true
- run: shopt -s globstar
#- run: safety check
88 changes: 66 additions & 22 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,46 +7,90 @@ on: [push, pull_request]

jobs:
build:
name: ${{ matrix.os }} ${{ matrix.architecture }}, Python ${{ matrix.python-version }}
name: ${{ matrix.os }}, Python ${{ matrix.python-version }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
architecture: [x86, x64]
os: [ubuntu-latest, macos-latest, windows-latest]
python-version: [3.6, 3.7, 3.8, 3.9]
exclude:
- os: ubuntu-latest
architecture: x86
- os: macos-latest
architecture: x86
os:
- ubuntu-latest
- macos-latest
- windows-latest
python-version:
- '3.9'
- '3.10'
- '3.11'
- '3.12'
include:
- os: ubuntu-20.04
python-version: '3.9'
fail-fast: false

steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }} ${{ matrix.architecture }}
uses: actions/setup-python@v2
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
architecture: ${{ matrix.architecture }}
- name: Install dependencies
- if: ${{ matrix.os == 'ubuntu-20.04' }}
name: Install minimal env
run: |
python -m pip install --upgrade pip
python -m pip install tomli tomli_w
python scripts/pin_requirements.py
python -m pip uninstall --yes tomli tomli_w
python -m pip install -e . --only-binary ':all:'
python -m pip install pytest pytest-mpl pytest-cov
- if: ${{ matrix.os != 'ubuntu-20.04' }}
name: Install full test env
run: |
python -m pip install --upgrade pip setuptools wheel
pip install -r requirements_dev.txt
- name: Test deployment
run: |
check-manifest
python setup.py sdist bdist_wheel
twine check dist/*
- run: python -m pip freeze
- name: Test package
run: |
pytest
pytest --color=yes --mpl --cov --cov-config=pyproject.toml --cov-report=term-missing
- name: Upload coverage
run: |
curl -s https://codecov.io/bash | bash

check-manifest:
name: Check MANIFEST.in
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: 3.x
- run: pipx run check-manifest

check-twine:
name: Test deployment
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: 3.x
- run: |
pipx run build --sdist
pipx run twine check dist/*

publish:
name: Publish to PyPI
runs-on: ubuntu-latest
needs:
- build
- check-manifest
- check-twine
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: 3.x
- name: Deploy package
if: ${{ success() && matrix.os == 'ubuntu-latest' && github.event_name == 'push' && github.ref == 'refs/heads/master' }}
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' }}
env:
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
run: |
twine upload --skip-existing dist/*
pipx twine upload
40 changes: 40 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
ci:
autofix_prs: false
autoupdate_schedule: quarterly

repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
hooks:
- id: no-commit-to-branch
- id: debug-statements
- id: check-merge-conflict
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-toml

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.1.3
hooks:
- id: ruff-format
- id: ruff
args: [--fix]

- repo: https://github.com/codespell-project/codespell
rev: v2.2.4
hooks:
- id: codespell
args: [--ignore-words-list, 'mutch, ore']

- repo: https://github.com/PyCQA/bandit
rev: 1.7.6
hooks:
- id: bandit
# B101 is assert statements
args: [--recursive, --skip, B101, .]

- repo: https://github.com/macisamuele/language-formatters-pre-commit-hooks
rev: v2.11.0
hooks:
- id: pretty-format-yaml
args: [--autofix, --indent, '2']
2 changes: 1 addition & 1 deletion CITATION
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,4 @@ archivePrefix = {arXiv},
primaryClass = {eess.IV},
adsurl = {https://ui.adsabs.harvard.edu/abs/2020JOSS....5.2004V},
adsnote = {Provided by the SAO/NASA Astrophysics Data System}
}
}
5 changes: 3 additions & 2 deletions MANIFEST.in
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,11 @@ recursive-include cmasher data/*
recursive-exclude cmasher/colormaps *
recursive-include cmasher/colormaps cm_*

exclude docs joss_paper .github
exclude docs joss_paper .git* scripts/*
recursive-exclude docs *
recursive-exclude joss_paper *
recursive-exclude .github *
exclude *.yml
exclude *.yml *.yaml

recursive-exclude * __pycache__
recursive-exclude * *.py[co]
5 changes: 3 additions & 2 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ Let's get rid of all bad colormaps in the world together!
.. _issue: https://github.com/1313e/CMasher/issues
.. _online documentation: https://cmasher.readthedocs.io
.. _matplotlib: https://github.com/matplotlib/matplotlib
.. _viscm: https://github.com/1313e/viscm
.. _viscm: https://github.com/matplotlib/viscm

Colormap overview
-----------------
Expand Down Expand Up @@ -73,12 +73,13 @@ So, for example, if one were to use the *rainforest* colormap, this could be don
import cmasher as cmr

# Import packages for plotting
import matplotlib as mpl
import matplotlib.pyplot as plt
import numpy as np

# Access rainforest colormap through CMasher or MPL
cmap = cmr.rainforest # CMasher
cmap = plt.get_cmap('cmr.rainforest') # MPL
cmap = mpl.colormaps['cmr.rainforest'] # MPL

# Generate some data to plot
x = np.random.rand(100)
Expand Down
10 changes: 3 additions & 7 deletions cmasher/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
# -*- coding: utf-8 -*-

"""
CMasher
=======
Expand All @@ -10,15 +8,13 @@

# %% IMPORTS AND DECLARATIONS
# CMasher imports
from . import app_usage, cm, utils
from .__version__ import __version__
from . import utils
from .utils import *
from . import cm
from .cm import *
from . import app_usage
from .utils import *

# All declaration
__all__ = ['app_usage', 'cm', 'utils']
__all__ = ["app_usage", "cm", "utils"]
__all__.extend(cm.__all__)
__all__.extend(utils.__all__)

Expand Down
4 changes: 1 addition & 3 deletions cmasher/__version__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
# -*- coding: utf-8 -*-

"""
CMasher Version
===============
Expand All @@ -10,4 +8,4 @@

# %% VERSIONS
# Default/Latest/Current version
__version__ = '1.6.3'
__version__ = "1.7.0" # keep in sync with pyproject.toml
28 changes: 28 additions & 0 deletions cmasher/_handlercolorpolycollection.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import numpy as np
from matplotlib.legend_handler import HandlerBase


# Define legend handler class for artists that use colormaps
class _HandlerColorPolyCollection(HandlerBase):
# Override create_artists to create an AxesImage resembling a colormap
def create_artists(
self, legend, artist, xdescent, ydescent, width, height, fontsize, trans
):
from matplotlib.image import AxesImage

# Obtain the Axes object of this legend
ax = legend.axes

# Obtain the colormap of the artist
cmap = artist.cmap

# Create an AxesImage to contain the colormap with proper dimensions
image = AxesImage(
ax, cmap=cmap, transform=trans, extent=[xdescent, width, ydescent, height]
)

# Set the data of the image
image.set_data(np.arange(cmap.N)[np.newaxis, ...])

# Return the AxesImage object
return [image]
Loading
Loading