Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • workers/base-worker
1 result
Show changes
Commits on Source (5)
......@@ -2,3 +2,5 @@
*.pyc
.tox/
test-report.xml
docs/_build/
docs/generated/
......@@ -135,6 +135,37 @@ pypi-publication:
- python setup.py sdist bdist_wheel
- twine upload dist/* -r pypi
.docs:
image: python:3
artifacts:
paths:
- public
before_script:
- pip install -e .[docs]
script:
- cd docs
- make html
- mv _build/html ../public
docs-build:
extends: .docs
stage: build
# Test job outside of tags to ensure the docs still can build before merging
# Does not use the `pages` name, therefore will be ignored by GitLab Pages
except:
- tags
- schedules
pages:
extends: .docs
stage: release
only:
- tags
release-notes:
stage: release
image: registry.gitlab.com/teklia/devops:latest
......@@ -153,4 +184,4 @@ bump-python-deps:
- schedules
script:
- devops python-deps requirements.txt tests-requirements.txt "worker-{{cookiecutter.slug}}/requirements.txt"
- devops python-deps requirements.txt tests-requirements.txt docs-requirements.txt "worker-{{cookiecutter.slug}}/requirements.txt"
......@@ -8,4 +8,4 @@ line_length = 88
default_section=FIRSTPARTY
known_first_party = arkindex,arkindex_common
known_third_party =PIL,apistar,gitlab,gnupg,peewee,playhouse,pytest,requests,setuptools,sh,tenacity,yaml
known_third_party =PIL,apistar,gitlab,gnupg,peewee,playhouse,pytest,recommonmark,requests,setuptools,sh,tenacity,yaml
......@@ -8,7 +8,7 @@ repos:
hooks:
- id: isort
- repo: https://github.com/ambv/black
rev: 20.8b1
rev: 22.3.0
hooks:
- id: black
- repo: https://gitlab.com/pycqa/flake8
......@@ -42,6 +42,10 @@ repos:
hooks:
- id: codespell
args: ['--write-changes']
- repo: https://github.com/PyCQA/doc8
rev: 0.11.1
hooks:
- id: doc8
- repo: meta
hooks:
- id: check-useless-excludes
doc8==0.11.1
recommonmark==0.7.1
Sphinx==4.5.0
sphinx-rtd-theme==1.0.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 = .
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)
# -*- coding: utf-8 -*-
# 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
from recommonmark.transform import AutoStructify
sys.path.insert(0, os.path.abspath(".."))
# -- Project information -----------------------------------------------------
project = "Arkindex Base Worker"
copyright = "2022, Teklia"
author = "Teklia"
# The full version, including alpha/beta/rc tags
with open("../VERSION") as f:
release = f.read().strip()
# -- 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",
"sphinx.ext.autosummary",
"sphinx.ext.coverage",
"sphinx.ext.viewcode",
"recommonmark",
]
# 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 = ["_build", "Thumbs.db", ".DS_Store", "README.md"]
# The name of the Pygments (syntax highlighting) style to use.
pygments_style = "sphinx"
source_suffix = {
".rst": "restructuredtext",
".md": "markdown",
}
# -- 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"]
# -- Extension configuration -------------------------------------------------
autodoc_default_options = {
"members": True,
"undoc-members": True,
"member-order": "bysource",
}
def setup(app):
app.add_config_value(
"recommonmark_config", {"auto_toc_tree_section": "Contents"}, True
)
app.add_transform(AutoStructify)
# Building the documentation
## Setup
Add the `docs` extra when installing `arkindex-base-worker`:
``` sh
# In a clone of the Git repository
pip install .[docs]
```
Build the documentation using `make html`.
## Writing documentation
This documentation uses [Sphinx](http://www.sphinx-doc.org/) and has been
configured to allow using both [CommonMark][1] and reStructuredText. There are
some special considerations when using Markdown, because its syntax is too
simple to normally allow using Sphinx features.
You can use [reStructuredText directives][2] in Markdown docs by using fenced
code blocks:
~~~ markdown
``` autoclass:: arkindex_worker.worker.base.BaseWorker
:members:
```
~~~
For evaluating whole chunks of reST syntax and inserting them in your file,
you can use the `eval_rst` info string in your code blocks:
~~~ markdown
``` eval_rst
Here's a :cls:`link to a class <arkindex_worker.worker.base.BaseWorker>`
.. important:: This an important notice!
```
~~~
Another important consideration is the `Contents` section: a section with this
name should hold a list of links to other files, to be used as the main table
of contents:
``` markdown
## Contents
* [A file](file1)
* [Another file](file2)
```
This list will become the table of contents in the sidebar.
See `recommonmark`'s [AutoStructify documentation][3] for more information.
## Linting
This documentation is subject to linting using `doc8`, integrated into
`pre-commit`. You can run it locally by typing `pre-commit run`. You should use
`pre-commit install` to have the pre-commit hook run before each Git commit.
The linting rules that `doc8` applies can be found on [its documentation][4].
[1]: https://commonmark.org/help/
[2]: https://www.sphinx-doc.org/en/master/usage/restructuredtext/basics.html
[3]: https://recommonmark.readthedocs.io/en/latest/auto_structify.html
[4]: https://doc8.readthedocs.io/en/latest/readme.html#usage
Welcome to the Arkindex Base Worker documentation!
==================================================
Python API
----------
.. autosummary::
:toctree: generated
:caption: Python API
:recursive:
arkindex_worker.cache
arkindex_worker.git
arkindex_worker.image
arkindex_worker.models
arkindex_worker.reporting
arkindex_worker.utils
arkindex_worker.worker
.. toctree::
:maxdepth: 2
:caption: Development
dev/build_docs
@ECHO OFF
pushd %~dp0
REM Command file for Sphinx documentation
if "%SPHINXBUILD%" == "" (
set SPHINXBUILD=sphinx-build
)
set SOURCEDIR=.
set BUILDDIR=_build
%SPHINXBUILD% >NUL 2>NUL
if errorlevel 9009 (
echo.
echo.The 'sphinx-build' command was not found. Make sure you have Sphinx
echo.installed, then set the SPHINXBUILD environment variable to point
echo.to the full path of the 'sphinx-build' executable. Alternatively you
echo.may add the Sphinx directory to PATH.
echo.
echo.If you don't have Sphinx installed, grab it from
echo.https://www.sphinx-doc.org/
exit /b 1
)
if "%1" == "" goto help
%SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%
goto end
:help
%SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%
:end
popd
arkindex-client==1.0.8
peewee==3.14.10
Pillow==9.0.1
Pillow==9.1.0
python-gitlab==2.7.1
python-gnupg==0.4.8
sh==1.14.2
......
[doc8]
ignore-path=*.egg-info,docs/_build,venv,.git
extensions=.md
......@@ -25,5 +25,6 @@ setup(
url="https://teklia.com",
python_requires=">=3.6",
install_requires=install_requires,
extras_require={"docs": requirements("docs-requirements.txt")},
packages=find_packages(),
)
......@@ -8,7 +8,7 @@ repos:
hooks:
- id: isort
- repo: https://github.com/ambv/black
rev: 20.8b1
rev: 22.3.0
hooks:
- id: black
- repo: https://gitlab.com/pycqa/flake8
......
......@@ -14,15 +14,19 @@ if [ -z "$VERSION" -o -z "$CI_PROJECT_DIR" -o -z "$CI_REGISTRY_IMAGE" ]; then
exit 1
fi
if [ -n "$CI_REGISTRY" -a -n "$CI_REGISTRY_USER" -a -n "$CI_REGISTRY_PASSWORD" ]; then
echo Logging in to container registry…
echo $CI_REGISTRY_PASSWORD | docker login -u $CI_REGISTRY_USER --password-stdin $CI_REGISTRY
fi
IMAGE_TAG="$CI_REGISTRY_IMAGE:$VERSION"
cd $CI_PROJECT_DIR
docker build -f Dockerfile . -t "$IMAGE_TAG"
if [ -n "$CI_REGISTRY" ]; then
docker push "$IMAGE_TAG"
# Publish the image on the main branch or on a tag
if [ "$CI_COMMIT_REF_NAME" = "main" -o -n "$CI_COMMIT_TAG" ]; then
if [ -n "$CI_REGISTRY" -a -n "$CI_REGISTRY_USER" -a -n "$CI_REGISTRY_PASSWORD" ]; then
echo $CI_REGISTRY_PASSWORD | docker login -u $CI_REGISTRY_USER --password-stdin $CI_REGISTRY
docker push $IMAGE_TAG
else
echo "Missing environment variables to log in to the container registry…"
fi
else
echo "The build was not published to the repository registry (only for main branch or tags)…"
fi
arkindex-base-worker==0.2.2
arkindex-base-worker==0.2.3
......@@ -6,7 +6,7 @@ import pytest
@pytest.fixture(autouse=True)
def setup_environment(responses):
"""Setup needed environment variables """
"""Setup needed environment variables"""
# Allow accessing remote API schemas
# defaulting to the prod environment
......