Skip to content

Commit

Permalink
Add package and pre-commit files
Browse files Browse the repository at this point in the history
  • Loading branch information
hagenw committed Jan 8, 2024
1 parent 78e144a commit e95b92d
Show file tree
Hide file tree
Showing 3 changed files with 219 additions and 0 deletions.
26 changes: 26 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Configuration of checks run by pre-commit
#
# The tests are executed in the CI pipeline,
# see CONTRIBUTING.rst for further instructions.
# You can also run the checks directly at the terminal, e.g.
#
# $ pre-commit install
# $ pre-commit run --all-files
#
#
default_language_version:
python: python3.8

repos:
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.1.8
hooks:
- id: ruff
args: [ --fix ]
- id: ruff-format
- repo: https://github.com/codespell-project/codespell
rev: v2.2.4
hooks:
- id: codespell
additional_dependencies:
- tomli
192 changes: 192 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,192 @@
# ===== PROJECT ===========================================================
#
[project]
name = 'sphinx-apipages'
authors = [
{name = 'Hagen Wierstorf', email = '[email protected]'},
]
description = 'Sphinx extension for API documentation with sub-pages'
readme = 'README.rst'
license = {file = 'LICENSE'}
keywords = [
'documentation',
'sphinx',
'autosummary',
'autodoc',
'split',
'api',
]
classifiers = [
'Development Status :: 5 - Production/Stable',
'Intended Audience :: Science/Research',
'Intended Audience :: Developers',
'License :: OSI Approved :: MIT License',
'Operating System :: OS Independent',
'Programming Language :: Python',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.10',
'Topic :: Scientific/Engineering',
]
dependencies = [
'sphinx',
]
# Get version dynamically from git
# (needs setuptools_scm tools config below)
dynamic = ['version']

[project.urls]
repository = 'https://github.com/audeering/sphinx-apipages/'
documentation = 'https://audeering.github.io/audb/'


# ===== BUILD-SYSTEM ======================================================
#
# Requirements for building the Python package
[build-system]
requires = ['setuptools>=45', 'setuptools_scm[toml]>=6.2']
build-backend = 'setuptools.build_meta'


# ===== TOOL ==============================================================
#

# ----- codespell ---------------------------------------------------------
[tool.codespell]
builtin = 'clear,rare,informal,usage,names'
skip = './sphinx-apipages.egg-info,./build,./docs/api'
uri-ignore-words-list = 'master'


# ----- pytest ------------------------------------------------------------
#
[tool.pytest.ini_options]
cache_dir = '.cache/pytest'
xfail_strict = true
addopts = '''
--doctest-plus
--cov=sphinx-apipages
--cov-fail-under=100
--cov-report term-missing
'''


# ----- ruff --------------------------------------------------------------
#
[tool.ruff]
cache-dir = '.cache/ruff'

[tool.ruff.lint]
select = [
'D', # pydocstyle
'E', # pycodestyle errors
'F', # Pyflakes
'I', # isort
'N', # pep8-naming
'W', # pycodestyle warnings
]
extend-ignore = [
'D100', # Missing docstring in public module
'D101', # Missing docstring in public class
'D102', # Missing docstring in public method
'D103', # Missing docstring in public function
'D104', # Missing docstring in public package
'D107', # Missing docstring in `__init__`
]


[tool.ruff.lint.per-file-ignores]
'__init__.py' = [
'F401', # * imported but unused
]


# ----- I: isort -----
#
# Check correct order/syntax of import statements
#
[tool.ruff.lint.isort]

# All from imports have their own line, e.g.
#
# from .utils import util_a
# from .utils import util_b
#
force-single-line = true

# Sort by module names
# and not import before from, e.g.
#
# from datetime import date
# import os
#
force-sort-within-sections = true

# Ensure we have two empty lines
# after last import
lines-after-imports = 2

# Group all audEERING packages into a separate section, e.g.
#
# import os
#
# import numpy as np
#
# import audmath
#
section-order = [
'future',
'standard-library',
'third-party',
'audeering',
'first-party',
'local-folder',
]
[tool.ruff.lint.isort.sections]
'audeering' = [
'audb',
'audbackend',
'audeer',
'audfactory',
'audformat',
'audiofile',
'audinterface',
'audmath',
'audmetric',
'audobject',
'audonnx',
'audplot',
'audresample',
'audtorch',
'opensmile',
'sphinx-audeering-theme',
]


# ----- N: pep8-naming -----
#
# Check variable/class names follow PEP8 naming convention
#
[tool.ruff.lint.pep8-naming]
ignore-names = [
'config', # allow lowercase class name
'test_*', # allow uppercase name when testing a class
]


# ----- W: pycodestyle -----
#
# Check docstrings follow selected convention
#
[tool.ruff.lint.pydocstyle]
convention = 'google'


# ----- setuptools --------------------------------------------------------
#
# Find all (sub-)modules of the Python package
[tool.setuptools.packages.find]

# ----- setuptools_scm ----------------------------------------------------
#
# Use setuptools_scm to get version from git
[tool.setuptools_scm]
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
-e .

0 comments on commit e95b92d

Please sign in to comment.