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

Infrastructure #75

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from
Draft
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
10 changes: 5 additions & 5 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ repos:
args: ['--fix=no']

- repo: https://github.com/PyCQA/flake8
rev: '6.1.0' # pick a git hash / tag to point to
rev: '7.0.0' # pick a git hash / tag to point to
hooks:
- id: flake8
additional_dependencies:
Expand All @@ -35,7 +35,7 @@ repos:
- flake8-copyright

- repo: https://github.com/psf/black
rev: 23.9.1
rev: 24.2.0
hooks:
- id: black

Expand All @@ -45,20 +45,20 @@ repos:
- id: rst-backticks

- repo: https://github.com/PyCQA/isort
rev: 5.12.0
rev: 5.13.2
hooks:
- id: isort
args: ["--profile", "black"]


- repo: https://github.com/asottile/pyupgrade
rev: v3.15.0
rev: v3.15.1
hooks:
- id: pyupgrade
args: [--py38-plus]

- repo: https://github.com/commitizen-tools/commitizen
rev: 3.10.0
rev: v3.18.4
hooks:
- id: commitizen
stages: [commit-msg]
78 changes: 44 additions & 34 deletions docs/conf.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
# -*- coding: utf-8 -*-

import sys, os
"""Configuration for Sphinx documentation."""
import os
import sys
import time

try:
from importlib.metadata import version as _version
except ImportError:
Expand All @@ -10,7 +11,7 @@
# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here.
sys.path.insert(0, os.path.abspath('../'))
sys.path.insert(0, os.path.abspath("../"))

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

Expand Down Expand Up @@ -40,20 +41,20 @@
autosummary_generate = True

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

# The suffix of source filenames.
source_suffix = '.rst'
source_suffix = ".rst"

# The encoding of source files.
# source_encoding = 'utf-8-sig'

# The master toctree document.
master_doc = 'index'
master_doc = "index"

# General information about the project.
project = u'pspec_likelihood'
copyright = u'%s, HERA-Team' % (time.localtime()[0])
project = "pspec_likelihood"
copyright = "%s, HERA-Team" % (time.localtime()[0])

# The version info for the project you're documenting, acts as replacement for
# |version| and |release|, also used in various other places throughout the
Expand All @@ -68,11 +69,10 @@
]



# The short X.Y version.
version = _version('pspec_likelihood')
version = _version("pspec_likelihood")
# The full version, including alpha/beta/rc tags.
release = _version('pspec_likelihood')
release = _version("pspec_likelihood")


# The language for content autogenerated by Sphinx. Refer to documentation
Expand All @@ -87,7 +87,7 @@

# List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files.
exclude_patterns = ['_build']
exclude_patterns = ["_build"]

# The reST default role (used for this markup: `text`) to use for all documents.
# default_role = None
Expand All @@ -104,7 +104,7 @@
# show_authors = False

# The name of the Pygments (syntax highlighting) style to use.
pygments_style = 'sphinx'
pygments_style = "sphinx"

# A list of ignored prefixes for module index sorting.
# modindex_common_prefix = []
Expand All @@ -114,7 +114,7 @@

# The theme to use for HTML and HTML Help pages. See the documentation for
# a list of builtin themes.
html_theme = 'furo'
html_theme = "furo"

# Theme options are theme-specific and customize the look and feel of a theme
# further. For a list of options available for each theme, see the
Expand Down Expand Up @@ -143,7 +143,7 @@
# 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']
html_static_path = ["_static"]

# If not '', a 'Last updated on:' timestamp is inserted at every page bottom,
# using the given strftime format.
Expand Down Expand Up @@ -187,27 +187,30 @@
# html_file_suffix = None

# Output file base name for HTML help builder.
htmlhelp_basename = 'pspec_likelihood_doc'
htmlhelp_basename = "pspec_likelihood_doc"


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

latex_elements = {
# The paper size ('letterpaper' or 'a4paper').
# 'papersize': 'letterpaper',

# The font size ('10pt', '11pt' or '12pt').
# 'pointsize': '10pt',

# Additional stuff for the LaTeX preamble.
# 'preamble': '',
# The paper size ('letterpaper' or 'a4paper').
# 'papersize': 'letterpaper',
# The font size ('10pt', '11pt' or '12pt').
# 'pointsize': '10pt',
# Additional stuff for the LaTeX preamble.
# 'preamble': '',
}

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

# The name of an image file (relative to this directory) to place at the top of
Expand Down Expand Up @@ -236,8 +239,7 @@
# One entry per manual page. List of tuples
# (source start file, name, description, authors, manual section).
man_pages = [
('index', 'pspec_likelihood', u'pspec_likelihood Documentation',
[u'HERA-Team'], 1)
("index", "pspec_likelihood", "pspec_likelihood Documentation", ["HERA-Team"], 1)
]

# If true, show URL addresses after external links.
Expand All @@ -250,9 +252,15 @@
# (source start file, target name, title, author,
# dir menu entry, description, category)
texinfo_documents = [
('index', 'pspec_likelihood', u'pspec_likelihood Documentation',
u'Steven Murray', 'pspec_likelihood', 'Likelihoods from UVPSpec objects.',
'Miscellaneous'),
(
"index",
"pspec_likelihood",
"pspec_likelihood Documentation",
"Steven Murray",
"pspec_likelihood",
"Likelihoods from UVPSpec objects.",
"Miscellaneous",
),
]

# Documents to append as an appendix to all manuals.
Expand All @@ -266,9 +274,11 @@


# Example configuration for intersphinx: refer to the Python standard library.
intersphinx_mapping = {'http://docs.python.org/': None}
intersphinx_mapping = {"http://docs.python.org/": None}

mathjax_path = "http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML"
mathjax_path = (
"http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML"
)

#
# #===============================================================================
Expand Down
112 changes: 111 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,65 @@
[build-system]
requires = ["setuptools>=45", "wheel"]
requires = ["setuptools>=60", "wheel", "setuptools_scm>=8.0", "numpy"]
build-backend = "setuptools.build_meta"

[project]
name = "pspec-likelihood"
description = "A flexible likelihood for 21cm power spectrum estimates"
readme = "README.rst"
authors = [
{name="Steven Murray", email="[email protected]"},
{name="Adelie Gorce", email="[email protected]"}
]
license = {text="MIT"}
requires-python = ">=3.9"
classifiers = [
"Development Status :: 4 - Beta",
"Intended Audience :: Science/Research",
"License :: OSI Approved :: MIT License",
"Operating System :: POSIX",
"Operating System :: Unix",
"Topic :: Scientific/Engineering",
"Topic :: Scientific/Engineering :: Astronomy",
"Topic :: Scientific/Engineering :: Physics",
"Programming Language :: Python",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3 :: Only",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: Implementation :: CPython",
]
dependencies = [
"hera_pspec",
"hera_sim",
"pyuvdata",
"attrs",
"astropy",
"numpy",
"scipy",
]
dynamic = ["version"]

[project.optional-dependencies]
docs = [
"sphinx>=1.7.5",
"numpydoc",
"nbsphinx",
"furo",
"ipython"
]
tests = [
"pytest",
"pytest-cov",
"pytest-xdist",
"pre-commit"
]
dev = [
"setuptools_scm",
"ruff",
"pspec-likelihood[docs,tests]"
]

[tool.pytest.ini_options]
minversion = "6.0"
Expand All @@ -21,3 +79,55 @@ version_variable = [
]
upload_to_repository = false
branch = "main"


[tool.ruff]
line-length = 88
target-version = "py39"

[tool.ruff.lint]
extend-select = [
"UP", # pyupgrade
"E", # pycodestyle
"W", # pycodestyle warning
"C90", # mccabe complexity
"I", # isort
"N", # pep8-naming
"D", # docstyle
# "ANN" # type annotations
"B", # bugbear
"A", # builtins
"C4", # comprehensions
"DTZ", # datetime
"FA", # future annotations
"PIE", # flake8-pie
"T", # print statements
"PT", # pytest-style
"Q", # quotes
"SIM", # simplify
"PTH", # use Pathlib
"ERA", # kill commented code
"NPY", # numpy-specific rules
"PERF", # performance
# "FURB", # refurb
"RUF", # ruff-specific rules
]
ignore = [
"A003", # class attribute shadows python builtin
"B008", # function call in argument defaults
]
[tool.ruff.lint.per-file-ignores]
"tests/*.py" = [
"D103", # ignore missing docstring in tests
"T", # print statements
]
"docs/conf.py" = [
"A", # conf.py can shadow builtins
"ERA",
]

[tool.ruff.lint.pydocstyle]
convention = 'numpy'

[tool.ruff.lint.mccabe]
max-complexity = 15
Loading
Loading