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

Blackify code #214

Merged
merged 3 commits into from
Dec 16, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 2 additions & 0 deletions .git-blame-ignore-revs
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Ignore black formatting changes
c47587cbfa829b03be1dc2e5a79dc96af6ea712f
11 changes: 11 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
repos:
# Using this mirror lets us use mypyc-compiled black, which is about 2x faster
- repo: https://github.com/psf/black-pre-commit-mirror
rev: 23.12.0
hooks:
- id: black
# It is recommended to specify the latest version of Python
# supported by your project here, or alternatively use
# pre-commit's default_language_version, see
# https://pre-commit.com/#top_level-default_language_version
language_version: python3.11
55 changes: 28 additions & 27 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,9 @@
try:
from sphinx_astropy.conf.v1 import * # noqa
except ImportError:
print('ERROR: the documentation requires the sphinx-astropy package to be installed')
print(
"ERROR: the documentation requires the sphinx-astropy package to be installed"
)
sys.exit(1)

if sys.version_info < (3, 11):
Expand All @@ -51,18 +53,18 @@
# -- General configuration ----------------------------------------------------

# By default, highlight as Python 3.
highlight_language = 'python3'
highlight_language = "python3"

# If your documentation needs a minimal Sphinx version, state it here.
#needs_sphinx = '1.2'
# needs_sphinx = '1.2'

# To perform a Sphinx version check that needs to be more specific than
# major.minor, call `check_sphinx_version("x.y.z")` here.
# check_sphinx_version("1.2.1")

# List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files.
exclude_patterns.append('_templates')
exclude_patterns.append("_templates")

# This is added to the end of RST files - a good place to put substitutions to
# be used globally.
Expand All @@ -72,20 +74,19 @@
# -- Project information ------------------------------------------------------

# This does not *have* to match the package name, but typically does
project = pyproject['project']['name']
author = ", ".join(v['name'] for v in pyproject['project']['authors'])
copyright = '{0}, {1}'.format(
datetime.datetime.now().year, author)
project = pyproject["project"]["name"]
author = ", ".join(v["name"] for v in pyproject["project"]["authors"])
copyright = "{0}, {1}".format(datetime.datetime.now().year, author)

# The version info for the project you're documenting, acts as replacement for
# |version| and |release|, also used in various other places throughout the
# built documents.

import_module(pyproject['project']['name'])
package = sys.modules[pyproject['project']['name']]
import_module(pyproject["project"]["name"])
package = sys.modules[pyproject["project"]["name"]]

# The short X.Y version.
version = package.__version__.split('-', 1)[0]
version = package.__version__.split("-", 1)[0]
# The full version, including alpha/beta/rc tags.
release = package.__version__

Expand All @@ -102,59 +103,59 @@

# Add any paths that contain custom themes here, relative to this directory.
# To use a different custom theme, add the directory containing the theme.
#html_theme_path = []
# html_theme_path = []

# The theme to use for HTML and HTML Help pages. See the documentation for
# a list of builtin themes. To override the custom theme, set this to the
# name of a builtin theme or the name of a custom theme in html_theme_path.
#html_theme = None
# html_theme = None


html_theme_options = {
'logotext1': 'stellarphot', # white, semi-bold
'logotext2': '', # orange, light
'logotext3': ':docs' # white, light
}
"logotext1": "stellarphot", # white, semi-bold
"logotext2": "", # orange, light
"logotext3": ":docs", # white, light
}


# Custom sidebar templates, maps document names to template names.
#html_sidebars = {}
# html_sidebars = {}

# The name of an image file (relative to this directory) to place at the top
# of the sidebar.
#html_logo = ''
# html_logo = ''

# The name of an image file (within the static path) to use as favicon of the
# docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32
# pixels large.
#html_favicon = ''
# html_favicon = ''

# If not '', a 'Last updated on:' timestamp is inserted at every page bottom,
# using the given strftime format.
#html_last_updated_fmt = ''
# html_last_updated_fmt = ''

# The name for this set of Sphinx documents. If None, it defaults to
# "<project> v<release> documentation".
html_title = '{0} v{1}'.format(project, release)
html_title = "{0} v{1}".format(project, release)

# Output file base name for HTML help builder.
htmlhelp_basename = project + 'doc'
htmlhelp_basename = project + "doc"


# -- Options for LaTeX output -------------------------------------------------

# Grouping the document tree into LaTeX files. List of tuples
# (source start file, target name, title, author, documentclass [howto/manual]).
latex_documents = [('index', project + '.tex', project + u' Documentation',
author, 'manual')]
latex_documents = [
("index", project + ".tex", project + " Documentation", author, "manual")
]


# -- Options for manual page output -------------------------------------------

# One entry per manual page. List of tuples
# (source start file, name, description, authors, manual section).
man_pages = [('index', project.lower(), project + u' Documentation',
[author], 1)]
man_pages = [("index", project.lower(), project + " Documentation", [author], 1)]

# -- Turn on nitpicky mode for sphinx (to warn about references not found) ----
#
Expand Down
3 changes: 2 additions & 1 deletion stellarphot/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
# Packages may add whatever they like to this file, but
# should keep this content at the top.
# ----------------------------------------------------------------------------
from ._astropy_init import * # noqa
from ._astropy_init import * # noqa

# ----------------------------------------------------------------------------

from .core import *
4 changes: 2 additions & 2 deletions stellarphot/_astropy_init.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@

from astropy.tests.runner import TestRunner

__all__ = ['__version__', 'test']
__all__ = ["__version__", "test"]

try:
from .version import version as __version__
except ImportError:
__version__ = ''
__version__ = ""

# Create the test function for self test
test = TestRunner.make_test_runner_in(os.path.dirname(__file__))
Expand Down
3 changes: 2 additions & 1 deletion stellarphot/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,10 @@ def pytest_configure(config):
iers_conf.auto_download = False

config.option.astropy_header = True
PYTEST_HEADER_MODULES.pop('h5py', None)
PYTEST_HEADER_MODULES.pop("h5py", None)

from .version import version

packagename = os.path.basename(os.path.dirname(__file__))
TESTED_VERSIONS[packagename] = version

Expand Down
Loading