Skip to content

Commit

Permalink
Updates from the package template (#160)
Browse files Browse the repository at this point in the history
Co-authored-by: nabobalis <[email protected]>
Co-authored-by: Stuart Mumford <[email protected]>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
  • Loading branch information
4 people authored Oct 21, 2024
1 parent b985048 commit 17f7979
Show file tree
Hide file tree
Showing 4 changed files with 75 additions and 59 deletions.
2 changes: 1 addition & 1 deletion .cruft.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"template": "https://github.com/sunpy/package-template",
"commit": "dd830771f0bb01d5313912e0082f3434715e474a",
"commit": "7b0225e0a206b7b6249752991334dea7e9ffcfd4",
"checkout": null,
"context": {
"cookiecutter": {
Expand Down
77 changes: 27 additions & 50 deletions .ruff.toml
Original file line number Diff line number Diff line change
@@ -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"
Expand Down
53 changes: 46 additions & 7 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -31,6 +30,7 @@
author = "The SunPy Community"

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

extensions = [
"sphinx_gallery.gen_gallery",
"matplotlib.sphinxext.plot_directive",
Expand All @@ -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/",
Expand All @@ -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",
Expand All @@ -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
Expand All @@ -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_).)*$",
Expand Down
2 changes: 1 addition & 1 deletion sunpy_soar/_dev/__init__.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down

0 comments on commit 17f7979

Please sign in to comment.