Skip to content

Commit

Permalink
Merge pull request #37 from sunpy/gallery
Browse files Browse the repository at this point in the history
Added Gallery + Update Package template
  • Loading branch information
nabobalis committed Feb 7, 2024
2 parents a160328 + 3b4cf64 commit b5e800d
Show file tree
Hide file tree
Showing 26 changed files with 879 additions and 644 deletions.
3 changes: 1 addition & 2 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,7 @@ jobs:
type: string
docker:
- image: cimg/python:3.11.6
environment:
TOXENV=<< parameters.jobname >>
environment: TOXENV=<< parameters.jobname >>
steps:
- run: *no-backports
- checkout
Expand Down
20 changes: 10 additions & 10 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@ name: CI
on:
push:
branches:
- 'main'
- '*.*'
- '!*backport*'
- "main"
- "*.*"
- "!*backport*"
tags:
- 'v*'
- '!*dev*'
- '!*pre*'
- '!*post*'
- "v*"
- "!*dev*"
- "!*pre*"
- "!*post*"
pull_request:
# Allow manual runs through the web UI
workflow_dispatch:
Expand Down Expand Up @@ -50,7 +50,7 @@ jobs:
needs: [core]
uses: OpenAstronomy/github-actions-workflows/.github/workflows/tox.yml@main
with:
default_python: '3.9'
default_python: "3.9"
submodules: false
pytest: false
toxdeps: tox-pypi-filter
Expand All @@ -65,7 +65,7 @@ jobs:
needs: [test]
uses: OpenAstronomy/github-actions-workflows/.github/workflows/tox.yml@main
with:
default_python: '3.9'
default_python: "3.9"
submodules: false
coverage: codecov
toxdeps: tox-pypi-filter
Expand Down Expand Up @@ -93,7 +93,7 @@ jobs:
uses: OpenAstronomy/github-actions-workflows/.github/workflows/publish_pure_python.yml@main
with:
python-version: "3.10"
test_extras: 'all,tests'
test_extras: "all,tests"
test_command: 'pytest -p no:warnings -m "not mpl_image_compare" --pyargs mpl_animators'
submodules: false
secrets:
Expand Down
112 changes: 33 additions & 79 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,93 +1,47 @@
ci:
autofix_prs: false
autoupdate_schedule: "quarterly"
repos:
# The warnings/errors we check for here are:
# E101 - mix of tabs and spaces
# E11 - Fix indentation.
# E111 - 4 spaces per indentation level
# E112 - 4 spaces per indentation level
# E113 - 4 spaces per indentation level
# E121 - Fix indentation to be a multiple of four.
# E122 - Add absent indentation for hanging indentation.
# E123 - Align closing bracket to match opening bracket.
# E124 - Align closing bracket to match visual indentation.
# E125 - Indent to distinguish line from next logical line.
# E126 - Fix over-indented hanging indentation.
# E127 - Fix visual indentation.
# E128 - Fix visual indentation.
# E129 - Fix visual indentation.
# E131 - Fix hanging indent for unaligned continuation line.
# E133 - Fix missing indentation for closing bracket.
# E20 - Remove extraneous whitespace.
# E211 - Remove extraneous whitespace.
# E231 - Add missing whitespace.
# E241 - Fix extraneous whitespace around keywords.
# E242 - Remove extraneous whitespace around operator.
# E251 - Remove whitespace around parameter '=' sign.
# E252 - Missing whitespace around parameter equals.
# E26 - Fix spacing after comment hash for inline comments.
# E265 - Fix spacing after comment hash for block comments.
# E266 - Fix too many leading '#' for block comments.
# E27 - Fix extraneous whitespace around keywords.
# E301 - Add missing blank line.
# E302 - Add missing 2 blank lines.
# E303 - Remove extra blank lines.
# E304 - Remove blank line following function decorator.
# E305 - expected 2 blank lines after class or function definition
# E305 - Expected 2 blank lines after end of function or class.
# E306 - expected 1 blank line before a nested definition
# E306 - Expected 1 blank line before a nested definition.
# E401 - Put imports on separate lines.
# E402 - Fix module level import not at top of file
# E502 - Remove extraneous escape of newline.
# E701 - Put colon-separated compound statement on separate lines.
# E711 - Fix comparison with None.
# E712 - Fix comparison with boolean.
# E713 - Use 'not in' for test for membership.
# E714 - Use 'is not' test for object identity.
# E722 - Fix bare except.
# E731 - Use a def when use do not assign a lambda expression.
# E901 - SyntaxError or IndentationError
# E902 - IOError
# F822 - undefined name in __all__
# F823 - local variable name referenced before assignment
# W291 - Remove trailing whitespace.
# W292 - Add a single newline at the end of the file.
# W293 - Remove trailing whitespace on blank line.
# W391 - Remove trailing blank lines.
# W601 - Use "in" rather than "has_key()".
# W602 - Fix deprecated form of raising exception.
# W603 - Use "!=" instead of "<>"
# W604 - Use "repr()" instead of backticks.
# W605 - Fix invalid escape sequence 'x'.
# W690 - Fix various deprecated code (via lib2to3).
- repo: https://github.com/PyCQA/flake8
rev: 7.0.0
- repo: https://github.com/myint/docformatter
rev: v1.7.5
hooks:
- id: flake8
args: ['--count', '--select', 'E101,E11,E111,E112,E113,E121,E122,E123,E124,E125,E126,E127,E128,E129,E131,E133,E20,E211,E231,E241,E242,E251,E252,E26,E265,E266,E27,E301,E302,E303,E304,E305,E306,E401,E402,E502,E701,E711,E712,E713,E714,E722,E731,E901,E902,F822,F823,W191,W291,W292,W293,W391,W601,W602,W603,W604,W605,W690']
exclude: ".*(.fits|.fts|.fit|.txt|tca.*|extern.*|.rst|.md|mpl_animators/extern|docs/conf.py)$"
- repo: https://github.com/PyCQA/autoflake
- id: docformatter
args: ["--in-place", "--pre-summary-newline", "--make-summary-multi"]
- repo: https://github.com/myint/autoflake
rev: v2.2.1
hooks:
- id: autoflake
args: ['--in-place', '--remove-all-unused-imports', '--remove-unused-variable']
exclude: ".*(.fits|.fts|.fit|.txt|tca.*|extern.*|.rst|.md|__init__.py|mpl_animators/extern|docs/conf.py)$"
- repo: https://github.com/PyCQA/isort
rev: 5.13.2
args:
[
"--in-place",
"--remove-all-unused-imports",
"--remove-unused-variable",
]
exclude: ".*(.fits|.fts|.fit|.txt|tca.*|.*extern.*|.rst|.md)$"
- repo: https://github.com/charliermarsh/ruff-pre-commit
rev: "v0.2.1"
hooks:
- id: isort
args: ['--sp','setup.cfg']
exclude: ".*(.fits|.fts|.fit|.txt|tca.*|extern.*|.rst|.md|mpl_animators/extern|docs/conf.py)$"
- id: ruff
args: ["--fix", "--unsafe-fixes"]
exclude: ".*(.fits|.fts|.fit|.txt|tca.*|.*extern.*|.rst|.md)$"
- id: ruff-format
exclude: ".*(.fits|.fts|.fit|.txt|tca.*|.*extern.*|.rst|.md)$"
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.5.0
hooks:
- id: check-ast
- id: check-case-conflict
- id: trailing-whitespace
exclude: ".*(.fits|.fts|.fit|.txt)$"
exclude: ".*(.fits|.fts|.fit|.txt|.csv)$"
- id: mixed-line-ending
exclude: ".*(.fits|.fts|.fit|.txt|.csv)$"
- id: end-of-file-fixer
exclude: ".*(.fits|.fts|.fit|.txt|.csv)$"
- id: check-yaml
- id: debug-statements
- id: check-added-large-files
- id: end-of-file-fixer
exclude: ".*(.fits|.fts|.fit|.txt|tca.*)$"
- id: mixed-line-ending
exclude: ".*(.fits|.fts|.fit|.txt|tca.*)$"
- repo: https://github.com/codespell-project/codespell
rev: v2.2.6
hooks:
- id: codespell
additional_dependencies:
- tomli
1 change: 0 additions & 1 deletion .readthedocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ build:
tools:
python: "3.10"
jobs:

post_checkout:
- git fetch --unshallow || true
pre_install:
Expand Down
1 change: 1 addition & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
## v1.1.1 - 2023-11-17

<!-- Release notes generated using configuration in .github/release.yml at main -->

### What's Changed

#### Other Changes
Expand Down
1 change: 1 addition & 0 deletions docs/api.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.. automodapi:: mpl_animators
96 changes: 38 additions & 58 deletions docs/conf.py
Original file line number Diff line number Diff line change
@@ -1,63 +1,37 @@
# -*- coding: utf-8 -*-
#
# Configuration file for the Sphinx documentation builder.
#
# This file does only contain a selection of the most common options. For a
# full list see the documentation:
# http://www.sphinx-doc.org/en/master/config
import datetime
from pathlib import Path

from sunpy_sphinx_theme import PNG_ICON

# -- Project information -----------------------------------------------------

project = 'mpl-animators'
copyright = '2021, The SunPy Developers'
author = 'The SunPy Developers'

# The full version, including alpha/beta/rc tags
from mpl_animators import __version__
release = __version__
project = "mpl-animators"
author = "The SunPy Community"
copyright = f"{datetime.datetime.now(datetime.timezone.utc).year}, {author}" # NOQA: A001
author = "The SunPy Developers"

# -- General configuration ---------------------------------------------------

# Add any Sphinx extension module names here, as strings. They can be
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
# ones.
extensions = [
'sphinx.ext.autodoc',
'sphinx.ext.intersphinx',
'sphinx.ext.todo',
'sphinx.ext.coverage',
'sphinx.ext.inheritance_diagram',
'sphinx.ext.viewcode',
'sphinx.ext.napoleon',
'sphinx.ext.doctest',
'sphinx.ext.mathjax',
'sphinx_automodapi.automodapi',
'sphinx_automodapi.smart_resolver',
"sphinx_gallery.gen_gallery",
"sphinx_automodapi.automodapi",
"sphinx_automodapi.smart_resolver",
"sphinx.ext.autodoc",
"sphinx.ext.coverage",
"sphinx.ext.doctest",
"sphinx.ext.inheritance_diagram",
"sphinx.ext.intersphinx",
"sphinx.ext.mathjax",
"sphinx.ext.napoleon",
"sphinx.ext.todo",
"sphinx.ext.viewcode",
]

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

# List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files.
# This pattern also affects html_static_path and html_extra_path.
exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store']

# The suffix(es) of source filenames.
# You can specify multiple suffix as a list of string:
source_suffix = '.rst'

# The master toctree document.
master_doc = 'index'

# The reST default role (used for this markup: `text`) to use for all
# documents. Set to the "smart" one.
default_role = 'obj'
exclude_patterns = ["_build", "Thumbs.db", ".DS_Store"]
source_suffix = ".rst"
master_doc = "index"
default_role = "obj"
html_theme = "sunpy"

# -- Options for intersphinx extension ---------------------------------------

# Example configuration for intersphinx: refer to the Python standard library.
intersphinx_mapping = {
"python": (
"https://docs.python.org/3/",
Expand All @@ -74,11 +48,17 @@
"astropy": ("https://docs.astropy.org/en/stable/", None),
}

# -- Options for HTML output -------------------------------------------------

from sunpy_sphinx_theme.conf import * # NOQA

# 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']
# -- Sphinx Gallery ------------------------------------------------------------
sphinx_gallery_conf = {
"backreferences_dir": (Path("generated") / "modules").absolute(),
"filename_pattern": "^((?!skip_).)*$",
"examples_dirs": (Path("..") / "examples").absolute(),
"gallery_dirs": (Path("generated") / "gallery").absolute(),
"matplotlib_animations": True,
"default_thumb_file": PNG_ICON,
"abort_on_example_error": False,
"plot_gallery": "True",
"remove_config_comments": True,
"doc_module": ("mpl_animators"),
"only_warn_on_example_error": True,
}
9 changes: 4 additions & 5 deletions docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,8 @@ The ``mpl_animators`` package provides a set of classes which allow the easy con
As well as this there is a specialised `.ArrayAnimatorWCS` class which can make line or image plots for a numpy array and associated World Coordinate System (WCS) object from `astropy`.
Finally, there are two base classes: `.BaseFuncAnimator` which can be extended to generate an interactive visualization from any data structure and set of functions to update the plot, and `.ArrayAnimator` which can be extended to generate any visualisation based on the axes of a numpy array.


.. automodapi:: mpl_animators

.. toctree::
:maxdepth: 2
:caption: Contents:
:maxdepth: 1

generated/gallery/index
api
6 changes: 6 additions & 0 deletions examples/README.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
***************
Example Gallery
***************

The gallery contains examples of how to use mpl-animators.
Each example is a short and self contained how-to guide for performing a specific task.

0 comments on commit b5e800d

Please sign in to comment.