Skip to content

Commit

Permalink
Ruff codechecks (#1307)
Browse files Browse the repository at this point in the history
* Removed old python versions from black

* Replaced most precommit hooks for ruff.

* Changed to ruff. Currently only checking for F rules

* Solved F errors

* Solved I errors

* Solved D413 error

* Solved D errors. (Ignoring for example python files) with correct line length

* Included flake8-bandit

* Included flake8-bugbear

* Included flake8-comprehensions

* Included juypternotebooks, added pycodestyyle. Removed flake8 nd nbqa from pre-commits

* small formatting

* correct tmpfile handling

* Add D413 (blank line after last section) to ignore

* Removed non existing file from excludes

* Removed D107 from file specific, as it is in all files ignored

* Removed black and isort from pyproject.toml

* Revert D413

* removed flake8 and project from tox.removed .flake8

* fixed {} to dict()

* Added two missing notebooks to test.

* Removed depracated force_compile

* corrected workflow_comparison

* removed manual profiling from running and only as comment

* removed outputs

* removed workflow_comparison.ipynb

---------

Co-authored-by: Daniel Weindl <daniel.weindl@helmholtz-munich.de>
  • Loading branch information
PaulJonasJost and dweindl committed Mar 5, 2024
1 parent f9231f2 commit 82b7d5d
Show file tree
Hide file tree
Showing 150 changed files with 2,588 additions and 4,853 deletions.
41 changes: 0 additions & 41 deletions .flake8

This file was deleted.

46 changes: 15 additions & 31 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,29 +10,6 @@
# `pre-commit run --all-files` as by default only changed files are checked

repos:
- repo: https://github.com/psf/black
rev: 23.1.0
hooks:
- id: black
description: The uncompromising code formatter
- repo: https://github.com/pycqa/isort
rev: 5.12.0
hooks:
- id: isort
name: isort (python)
- id: isort
name: isort (cython)
types: [cython]
- id: isort
name: isort (pyi)
types: [pyi]
- repo: https://github.com/nbQA-dev/nbQA
rev: 1.6.3
hooks:
- id: nbqa-black
- id: nbqa-pyupgrade
args: [--py36-plus]
- id: nbqa-isort
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
hooks:
Expand All @@ -54,12 +31,19 @@ repos:
description: Replace or check mixed line endings
- id: trailing-whitespace
description: Trim trailing whitespaces
- repo: local
- repo: https://github.com/astral-sh/ruff-pre-commit
# Ruff version.
rev: v0.1.11
hooks:
- id: style
name: Check style
description: Check style
pass_filenames: false
entry: tox -e project,flake8
language: system
types: [python]
# Run the linter.
- id: ruff
args:
- --fix
- --config
- pyproject.toml

# Run the formatter.
- id: ruff-format
args:
- --config
- pyproject.toml
1 change: 0 additions & 1 deletion doc/api.rst
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ API reference
pypesto.profile.profile_next_guess
pypesto.result
pypesto.sample
pypesto.sample.pymc
pypesto.select
pypesto.select.postprocessors
pypesto.startpoint
Expand Down
118 changes: 59 additions & 59 deletions doc/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
import os
import sys

sys.path.insert(0, os.path.abspath('../'))
sys.path.insert(0, os.path.abspath("../"))

# Silence:
# Debugger warning: It seems that frozen modules are being used, which may
Expand All @@ -40,49 +40,49 @@
# -- General configuration ------------------------------------------------

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

# Add any Sphinx extension module names here, as strings. They can be
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
# ones.
extensions = [
# include documentation from docstrings
'sphinx.ext.autodoc',
"sphinx.ext.autodoc",
# generate autodoc summaries
'sphinx.ext.autosummary',
"sphinx.ext.autosummary",
# use mathjax for latex formulas
'sphinx.ext.mathjax',
"sphinx.ext.mathjax",
# link to code
'sphinx.ext.viewcode',
"sphinx.ext.viewcode",
# link to other projects' docs
'sphinx.ext.intersphinx',
"sphinx.ext.intersphinx",
# support numpy and google style docstrings
'sphinx.ext.napoleon',
"sphinx.ext.napoleon",
# support todo items
'sphinx.ext.todo',
"sphinx.ext.todo",
# source parser for jupyter notebook files
'nbsphinx',
"nbsphinx",
# code highlighting in jupyter cells
'IPython.sphinxext.ipython_console_highlighting',
"IPython.sphinxext.ipython_console_highlighting",
# support markdown-based docs
'myst_parser',
"myst_parser",
# bibtex references
'sphinxcontrib.bibtex',
"sphinxcontrib.bibtex",
# ensure that jQuery is installed
'sphinxcontrib.jquery',
"sphinxcontrib.jquery",
# type hint formatting
'sphinx_autodoc_typehints',
"sphinx_autodoc_typehints",
]

# default autodoc options
# list for special-members seems not to be possible before 1.8
autodoc_default_options = {
'members': True,
'undoc-members': True,
'special-members': '__init__, __call__',
'imported-members': True,
'show-inheritance': True,
'autodoc_inherit_docstrings': True,
"members": True,
"undoc-members": True,
"special-members": "__init__, __call__",
"imported-members": True,
"show-inheritance": True,
"autodoc_inherit_docstrings": True,
}
autodoc_class_signature = "separated"

Expand All @@ -91,18 +91,18 @@

# links for intersphinx
intersphinx_mapping = {
'amici': ('https://amici.readthedocs.io/en/latest/', None),
'fides': ('https://fides-optimizer.readthedocs.io/en/latest/', None),
'matplotlib': ('https://matplotlib.org/stable/', None),
'numpy': ('https://numpy.org/devdocs/', None),
'pandas': ('https://pandas.pydata.org/docs/', None),
'petab': (
'https://petab.readthedocs.io/projects/libpetab-python/en/latest/',
"amici": ("https://amici.readthedocs.io/en/latest/", None),
"fides": ("https://fides-optimizer.readthedocs.io/en/latest/", None),
"matplotlib": ("https://matplotlib.org/stable/", None),
"numpy": ("https://numpy.org/devdocs/", None),
"pandas": ("https://pandas.pydata.org/docs/", None),
"petab": (
"https://petab.readthedocs.io/projects/libpetab-python/en/latest/",
None,
),
'petab_select': ('https://petab-select.readthedocs.io/en/develop/', None),
'python': ('https://docs.python.org/3', None),
'scipy': ('https://docs.scipy.org/doc/scipy/', None),
"petab_select": ("https://petab-select.readthedocs.io/en/develop/", None),
"python": ("https://docs.python.org/3", None),
"scipy": ("https://docs.scipy.org/doc/scipy/", None),
}


Expand All @@ -112,21 +112,21 @@
bibtex_bibfiles = ["using_pypesto.bib", "references.bib"]

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

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

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

# General information about the project.
project = 'pyPESTO'
copyright = '2018, The pyPESTO developers'
author = 'The pyPESTO developers'
project = "pyPESTO"
copyright = "2018, The pyPESTO developers"
author = "The pyPESTO developers"

# 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 @@ -150,16 +150,16 @@
# directories to ignore when looking for source files.
# This patterns also effect to html_static_path and html_extra_path
exclude_patterns = [
'_build',
'Thumbs.db',
'.DS_Store',
'**.ipynb_checkpoints',
'example/tmp',
'README.md',
"_build",
"Thumbs.db",
".DS_Store",
"**.ipynb_checkpoints",
"example/tmp",
"README.md",
]

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

# If true, `todo` and `todoList` produce output, else they produce nothing.
todo_include_todos = False
Expand All @@ -183,15 +183,15 @@
# The theme to use for HTML and HTML Help pages. See the documentation for
# a list of builtin themes.
#
html_theme = 'sphinx_rtd_theme'
html_theme = "sphinx_rtd_theme"

# 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
# documentation.
#
html_theme_options = {
'collapse_navigation': False,
'navigation_depth': -1,
"collapse_navigation": False,
"navigation_depth": -1,
}

# Title
Expand All @@ -202,15 +202,15 @@
# 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"]

# Favicon
html_favicon = "logo/logo_favicon.png"

# -- Options for HTMLHelp output ------------------------------------------

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


# -- Options for LaTeX output ---------------------------------------------
Expand All @@ -236,10 +236,10 @@
latex_documents = [
(
master_doc,
'pyPESTO.tex',
'pyPESTO Documentation',
'The pyPESTO developers',
'manual',
"pyPESTO.tex",
"pyPESTO Documentation",
"The pyPESTO developers",
"manual",
),
]

Expand All @@ -248,7 +248,7 @@

# One entry per manual page. List of tuples
# (source start file, name, description, authors, manual section).
man_pages = [(master_doc, 'pypesto', 'pyPESTO Documentation', [author], 1)]
man_pages = [(master_doc, "pypesto", "pyPESTO Documentation", [author], 1)]


# -- Options for Texinfo output -------------------------------------------
Expand All @@ -259,11 +259,11 @@
texinfo_documents = [
(
master_doc,
'pyPESTO',
'pyPESTO Documentation',
"pyPESTO",
"pyPESTO Documentation",
author,
'pyPESTO',
'One line description of project.',
'Miscellaneous',
"pyPESTO",
"One line description of project.",
"Miscellaneous",
),
]
1 change: 0 additions & 1 deletion doc/example.rst
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ Getting started

example/getting_started.ipynb
example/custom_objective_function.ipynb
example/workflow_comparison.ipynb

PEtab and AMICI
---------------
Expand Down
Loading

0 comments on commit 82b7d5d

Please sign in to comment.