aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBenjamin Klimczak <benjamin.klimczak@arm.com>2022-08-08 16:29:21 +0100
committerBenjamin Klimczak <benjamin.klimczak@arm.com>2022-09-14 09:29:18 +0000
commit61684f9a4691449dc8aa129976789e3feab2b713 (patch)
treecab7a21789ce08f18fd7ec1bd323da78262031eb
parentf5b293d0927506c2a979a091bf0d07ecc78fa181 (diff)
downloadmlia-61684f9a4691449dc8aa129976789e3feab2b713.tar.gz
MLIA-571 Use tox to run additional project tasks
- Remove coverage from the pre-commit hooks as it takes too long and is not really suited to be a pre-commit hook - Added tox environments: - 'coverage': Run the code coverage. The code coverage was moved from the pre-commit hooks to tox. - 'lint': Run the pre-commit hooks - 'build': Build a distribution of MLIA - 'docs': Create documentation from the source code. Directory docs/ was added and copyright and license information add to files. Change-Id: Ife92b68043295ce41a0f2352ee2b2878329f4953
-rw-r--r--.pre-commit-config.yaml11
-rw-r--r--docs/Makefile22
-rw-r--r--docs/source/_static/.gitignore3
-rw-r--r--docs/source/_templates/.gitignore3
-rw-r--r--docs/source/conf.py54
-rw-r--r--docs/source/index.rst23
-rw-r--r--setup.cfg2
-rw-r--r--tox.ini40
8 files changed, 145 insertions, 13 deletions
diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml
index 08f5f7e..2d4e450 100644
--- a/.pre-commit-config.yaml
+++ b/.pre-commit-config.yaml
@@ -104,14 +104,3 @@ repos:
entry: pylint
language: system
types: [python]
-
-- repo: local
- hooks:
- - id: pytest-cov
- name: pytest coverage
- stages: [push]
- language: system
- entry: pytest --cov=mlia --cov-report term-missing --cov-fail-under=95 tests
- types: [python]
- pass_filenames: false
- verbose: true
diff --git a/docs/Makefile b/docs/Makefile
new file mode 100644
index 0000000..3cd6a93
--- /dev/null
+++ b/docs/Makefile
@@ -0,0 +1,22 @@
+# SPDX-FileCopyrightText: Copyright 2022, Arm Limited and/or its affiliates.
+# SPDX-License-Identifier: Apache-2.0
+
+# Minimal makefile for Sphinx documentation
+
+# You can set these variables from the command line, and also
+# from the environment for the first two.
+SPHINXOPTS ?=
+SPHINXBUILD ?= sphinx-build
+SOURCEDIR = source
+BUILDDIR = build
+
+# Put it first so that "make" without argument is like "make help".
+help:
+ @$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
+
+.PHONY: help Makefile
+
+# Catch-all target: route all unknown targets to Sphinx using the new
+# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
+%: Makefile
+ @$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
diff --git a/docs/source/_static/.gitignore b/docs/source/_static/.gitignore
new file mode 100644
index 0000000..dce3494
--- /dev/null
+++ b/docs/source/_static/.gitignore
@@ -0,0 +1,3 @@
+# SPDX-FileCopyrightText: Copyright 2022, Arm Limited and/or its affiliates.
+# SPDX-License-Identifier: Apache-2.0
+# Placeholder
diff --git a/docs/source/_templates/.gitignore b/docs/source/_templates/.gitignore
new file mode 100644
index 0000000..dce3494
--- /dev/null
+++ b/docs/source/_templates/.gitignore
@@ -0,0 +1,3 @@
+# SPDX-FileCopyrightText: Copyright 2022, Arm Limited and/or its affiliates.
+# SPDX-License-Identifier: Apache-2.0
+# Placeholder
diff --git a/docs/source/conf.py b/docs/source/conf.py
new file mode 100644
index 0000000..1073089
--- /dev/null
+++ b/docs/source/conf.py
@@ -0,0 +1,54 @@
+# SPDX-FileCopyrightText: Copyright 2022, Arm Limited and/or its affiliates.
+# SPDX-License-Identifier: Apache-2.0
+"""Configuration file for the Sphinx documentation builder."""
+# This file only contains a selection of the most common options. For a full
+# list see the documentation:
+# https://www.sphinx-doc.org/en/master/usage/configuration.html
+# -- Path setup --------------------------------------------------------------
+# 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.
+#
+# import os
+# import sys
+# sys.path.insert(0, os.path.abspath('.'))
+import mlia
+
+# -- Project information -----------------------------------------------------
+"""The configuration file for sphinx."""
+# pylint: skip-file
+project = "mlia"
+copyright = "Copyright (C) 2021-2022, Arm Ltd."
+author = "Arm Ltd (mlia@arm.com)"
+
+# The full version, including alpha/beta/rc tags
+release = mlia.__version__
+
+
+# -- General configuration ---------------------------------------------------
+
+# Add any Sphinx extension module names here, as strings. They can be
+# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
+# ones.
+extensions = ["sphinx.ext.autodoc"]
+
+# Add any paths that contain templates here, relative to this directory.
+templates_path = ["_templates"]
+
+# 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 = [] # type: ignore
+
+
+# -- 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 = "sphinx_rtd_theme"
+
+# 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"]
diff --git a/docs/source/index.rst b/docs/source/index.rst
new file mode 100644
index 0000000..1b852b8
--- /dev/null
+++ b/docs/source/index.rst
@@ -0,0 +1,23 @@
+.. # SPDX-FileCopyrightText: Copyright 2022, Arm Limited and/or its affiliates.
+.. # SPDX-License-Identifier: Apache-2.0
+
+.. mlia documentation main file, created by
+ sphinx-quickstart on Thu Sep 30 13:32:29 2021.
+ You can adapt this file completely to your liking, but it should at least
+ contain the root `toctree` directive.
+
+Welcome to mlia's documentation!
+================================
+
+.. toctree::
+ :maxdepth: 2
+ :caption: Contents:
+
+
+
+Indices and tables
+==================
+
+* :ref:`genindex`
+* :ref:`modindex`
+* :ref:`search`
diff --git a/setup.cfg b/setup.cfg
index 10995f4..128574c 100644
--- a/setup.cfg
+++ b/setup.cfg
@@ -80,4 +80,4 @@ wordlist=he,she,him,her,his,hers
# Exact list: Words to lint as whole words exactly as entered
# exactlist=
# Files that should not be checked by blocklint.
-skip_files=LICENSES/CC-PDDC.txt
+skip_files=LICENSES/CC-PDDC.txt,docs/source/conf.py
diff --git a/tox.ini b/tox.ini
index 3838913..ce6f1a6 100644
--- a/tox.ini
+++ b/tox.ini
@@ -5,6 +5,44 @@ envlist = test
[testenv:test]
description = Run the unit tests.
-deps = pytest
+deps =
+ pytest==7.1.1
commands =
pytest {posargs:tests/}
+
+[testenv:coverage]
+description = Run the code coverage of the unit tests.
+deps =
+ {[testenv:test]deps}
+ pytest-cov==3.0.0
+
+commands =
+ pytest --cov=mlia --cov-report term-missing --cov-fail-under=95 tests/
+
+[testenv:lint]
+description = Run the pre-commit hooks.
+usedevelop = True
+extras =
+ dev
+# Workaround to resolve an issue with markdownlint in a docker environment
+passenv = HOME
+commands =
+ pre-commit run --all-files --hook-stage=push {posargs}
+
+[testenv:build]
+description = Build a wheel file (platform name as optional argument [manylinux2014_aarch64, manylinux2014_x86_64]).
+deps =
+ build
+commands =
+ python -m build --wheel --config-setting=--global-option=--plat-name={posargs:manylinux2014_x86_64}
+
+[testenv:docs]
+description = Create the documentation.
+allowlist_externals = make
+usedevelop = True
+deps =
+ Sphinx==4.5.0
+ sphinx-rtd-theme==1.0.0
+commands =
+ sphinx-apidoc -f -o docs/source src/mlia
+ make --directory docs html