From 17f7979921167a6fb093b7121632026767f26fc0 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Mon, 21 Oct 2024 10:30:03 +0100 Subject: [PATCH] Updates from the package template (#160) Co-authored-by: nabobalis <1392107+nabobalis@users.noreply.github.com> Co-authored-by: Stuart Mumford Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> --- .cruft.json | 2 +- .ruff.toml | 77 +++++++++++++------------------------ docs/conf.py | 53 +++++++++++++++++++++---- sunpy_soar/_dev/__init__.py | 2 +- 4 files changed, 75 insertions(+), 59 deletions(-) diff --git a/.cruft.json b/.cruft.json index e3f7003..b030b85 100644 --- a/.cruft.json +++ b/.cruft.json @@ -1,6 +1,6 @@ { "template": "https://github.com/sunpy/package-template", - "commit": "dd830771f0bb01d5313912e0082f3434715e474a", + "commit": "7b0225e0a206b7b6249752991334dea7e9ffcfd4", "checkout": null, "context": { "cookiecutter": { diff --git a/.ruff.toml b/.ruff.toml index a882a2d..d1c4ead 100644 --- a/.ruff.toml +++ b/.ruff.toml @@ -1,61 +1,38 @@ -# Allow unused variables when underscore-prefixed. -lint.dummy-variable-rgx = "^(_+|(_+[a-zA-Z0-9_]*[a-zA-Z0-9]+?))$" target-version = "py310" -line-length = 120 -extend-exclude=[ - "__pycache__", - "build", - "tools/**", +line-length = 110 +exclude = [ + ".git,", + "__pycache__", + "build", + "sunpy_soar/version.py", + "tools/**", ] -lint.select = [ - "ALL", -] -lint.extend-ignore = [ - "ANN001", # Missing type annotation for function argument - "ANN002", # Missing type annotation for variable - "ANN003", # Missing type annotation for keyword - "ANN201", # Missing return type annotation for public function - "ANN202", # Missing return type annotation for private function - "ANN205", # Missing return type annotation for staticmethod - "ANN206", # Missing return type annotation for classmethod - "COM812", # May cause conflicts when used with the formatter - "C901", # Function exceeds acceptable complexity limits - "D200", # One-line docstring should fit on one line - "D205", # 1 blank line required between summary line and description - "D400", # First line should end with a period - "D401", # First line should be in imperative mood - "D404", # First word of the docstring should not be "This" - "ISC001", # May cause conflicts when used with the formatter + +[lint] +select = ["E", "F", "W", "UP", "PT"] +extend-ignore = [ + # pycodestyle (E, W) + "E501", # LineTooLong # TODO! fix + # pytest (PT) + "PT001", # Always use pytest.fixture() + "PT004", # Fixtures which don't return anything should have leading _ + "PT007", # Parametrize should be lists of tuples # TODO! fix + "PT011", # Too broad exception assert # TODO! fix + "PT023", # Always use () on pytest decorators ] [lint.per-file-ignores] -"examples/*.py" = [ - "B018", # Not print but display - "D400", # First line should end with a period, question mark, or exclamation point - "ERA001", # Commented out code - "INP001", # Implicit namespace package - "T201", # Use print -] +# Part of configuration, not a package. +"setup.py" = ["INP001"] +"conftest.py" = ["INP001"] "docs/conf.py" = [ - "D100", # Missing docstring in public module - "INP001", # conf.py is part of an implicit namespace package -] -"setup.py" = [ - "D100", # Missing docstring in public module -] -"test_*.py" = [ - "D100", # Missing docstring in public module - "D103", # Missing docstring in public function - "N806", # in function should be lowercase - "PLR2004", # Magic value used in comparison - "S101", # Use of `assert` detected -] -"sunpy_soar/version.py" = [ - "D100", # Missing docstring in public module + "E402" # Module imports not at top of file ] -"sunpy_soar/conftest.py" = [ - "D100", # Missing docstring in public module +"docs/*.py" = [ + "INP001", # Implicit-namespace-package. The examples are not a package. ] +"__init__.py" = ["E402", "F401", "F403"] +"test_*.py" = ["B011", "D", "E402", "PGH001", "S101"] [lint.pydocstyle] convention = "numpy" diff --git a/docs/conf.py b/docs/conf.py index f7deb39..fd1fa6d 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -4,7 +4,6 @@ # full list see the documentation: # http://www.sphinx-doc.org/en/master/config -# -- Project information ----------------------------------------------------- import datetime from pathlib import Path @@ -31,6 +30,7 @@ author = "The SunPy Community" # -- General configuration --------------------------------------------------- + extensions = [ "sphinx_gallery.gen_gallery", "matplotlib.sphinxext.plot_directive", @@ -48,16 +48,27 @@ "sphinx.ext.viewcode", "sphinx_copybutton", ] + +# Add any paths that contain templates here, relative to this directory. +# templates_path = ["_templates"] # NOQA: ERA001 + +# 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" -napoleon_use_rtype = False -napoleon_google_docstring = False # Treat everything in single ` as a Python reference. default_role = "py:obj" # -- Options for intersphinx extension --------------------------------------- + intersphinx_mapping = { "python": ( "https://docs.python.org/3/", @@ -81,8 +92,14 @@ } # -- Options for HTML output ------------------------------------------------- + +# The theme to use for HTML and HTML Help pages. See the documentation for +# a list of builtin themes. html_theme = "sunpy" + +# Render inheritance diagrams in SVG graphviz_output_format = "svg" + graphviz_dot_args = [ "-Nfontsize=10", "-Nfontname=Helvetica Neue, Helvetica, Arial, sans-serif", @@ -92,10 +109,25 @@ "-Gfontname=Helvetica Neue, Helvetica, Arial, sans-serif", ] -# -- Options for sphinx-copybutton --------------------------------------------- -# Python Repl + continuation, Bash, ipython and qtconsole + continuation, jupyter-console + continuation -copybutton_prompt_text = r">>> |\.\.\. |\$ |In \[\d*\]: | {2,5}\.\.\.: | {5,8}: " -copybutton_prompt_is_regexp = True +# 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"] # NOQA: ERA001 + +# By default, when rendering docstrings for classes, sphinx.ext.autodoc will +# make docs with the class-level docstring and the class-method docstrings, +# but not the __init__ docstring, which often contains the parameters to +# class constructors across the scientific Python ecosystem. The option below +# will append the __init__ docstring to the class-level docstring when rendering +# the docs. For more options, see: +# https://www.sphinx-doc.org/en/master/usage/extensions/autodoc.html#confval-autoclass_content +autoclass_content = "both" + +# -- Other options ---------------------------------------------------------- + +napoleon_use_rtype = False + +napoleon_google_docstring = False # Enable nitpicky mode, which forces links to be non-broken nitpicky = True @@ -109,7 +141,14 @@ target = target.strip() nitpick_ignore.append((dtype, target)) +# -- Options for sphinx-copybutton --------------------------------------------- + +# Python Repl + continuation, Bash, ipython and qtconsole + continuation, jupyter-console + continuation +copybutton_prompt_text = r">>> |\.\.\. |\$ |In \[\d*\]: | {2,5}\.\.\.: | {5,8}: " +copybutton_prompt_is_regexp = True + # -- Options for the Sphinx gallery ------------------------------------------- + sphinx_gallery_conf = { "backreferences_dir": Path("generated") / "modules", "filename_pattern": "^((?!skip_).)*$", diff --git a/sunpy_soar/_dev/__init__.py b/sunpy_soar/_dev/__init__.py index 0b585ca..73872a1 100644 --- a/sunpy_soar/_dev/__init__.py +++ b/sunpy_soar/_dev/__init__.py @@ -1,5 +1,5 @@ """ -This subpackage contains utilities that are only used when developing muse in a +This package contains utilities that are only used when developing in a copy of the source repository. These files are not installed, and should not be assumed to exist at