Metadata-Version: 2.4
Name: risclog.batou
Version: 3.20.5
Summary: batou extensions used by risclog
Home-page: https://github.com/risclog-solution/risclog.batou
Author: riscLOG Solution GmbH
Author-email: info@risclog.de
Keywords: risclog.batou
Classifier: Development Status :: 2 - Pre-Alpha
Classifier: Intended Audience :: Developers
Classifier: Natural Language :: German
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.12
Requires-Python: >=3.10
License-File: AUTHORS.rst
Requires-Dist: requirements-parser
Requires-Dist: six
Requires-Dist: batou>=2.3b5
Requires-Dist: batou_ext>=2.4.27
Provides-Extra: docs
Requires-Dist: Sphinx; extra == "docs"
Provides-Extra: test
Requires-Dist: pytest-cache; extra == "test"
Requires-Dist: pytest-cov; extra == "test"
Requires-Dist: pytest-rerunfailures; extra == "test"
Requires-Dist: pytest-sugar; extra == "test"
Requires-Dist: pytest; extra == "test"
Requires-Dist: coverage; extra == "test"
Requires-Dist: flake8<4; extra == "test"
Requires-Dist: mock; extra == "test"
Dynamic: author
Dynamic: author-email
Dynamic: classifier
Dynamic: description
Dynamic: home-page
Dynamic: keywords
Dynamic: license-file
Dynamic: provides-extra
Dynamic: requires-dist
Dynamic: requires-python
Dynamic: summary

=============
risclog.batou
=============

.. image:: https://github.com/risclog-solution/risclog.batou/workflows/Test/badge.svg?branch=master
     :target: https://github.com/risclog-solution/risclog.batou/actions?workflow=Test
     :alt: CI Status

batou extensions used by risclog


Features
========

Frontend release versions
-------------------------

``GithubReleaseDownload("latest-testing", ...)`` selects the highest published
numeric ``v...-TESTING`` tag during deployment, after its GitHub authentication
files have been installed. Releases are queried from
``risclog-solution/<package>`` with pagination; drafts are excluded and
published prereleases are included. Tags must match in full and versions are
compared as integer tuples, not strings. ``version`` remains the configured
selector; ``resolved_version`` exposes the selected tag after the download
update. Fixed pins are returned unchanged and do not require a release lookup.

For other testing tag formats, set ``testing_tag_pattern``. The regular
expression must have exactly one capturing group containing a dotted numeric
version; use non-capturing groups for other grouping. For example::

    GithubReleaseDownload(
        "latest-testing",
        package="risclog.ruv-travel-insurance.client",
        file="client.zip",
        testing_tag_pattern=r"v([0-9]+(?:\.[0-9]+)*)-RUV-TESTING",
    )

The default pattern remains ``v([0-9]+(?:\.[0-9]+)*)-TESTING``. Invalid patterns,
invalid captured versions, missing matching releases and API failures are
reported as errors.

For multiple archives, pass ``release=first_download`` to subsequent
``GithubReleaseDownload`` instances with the same package, selector and
``testing_tag_pattern``. Add the first download before the others so that all
archives use one selected release.

Ordinary batou ``File`` templates render during configuration, before aliases
have been resolved. Use ``GithubReleaseContent`` after the download and
extraction to render release-dependent configuration during deployment::

    from risclog.batou.github import (
        GithubReleaseContent,
        GithubReleaseDownload,
    )

    self.frontend_release = GithubReleaseDownload(
        self.frontend_version,
        package="risclog.frontend",
        file="claimx.zip",
    )
    self += self.frontend_release
    # Add archive extraction here, before rendering its configuration.
    self += GithubReleaseContent(
        "frontend/config.js",
        release=self.frontend_release,
        source="config.js",
        template_context=self,
    )

In ``config.js``, use ``{{args.release.resolved_version}}`` for ``appVersion``.
The usual ``component`` template context and other ``template_args`` remain
available. Like batou ``Content``, this helper manages file contents only; the
target directory must already exist. An unresolved alias fails explicitly
during deployment rather than writing ``latest-testing``. Prediction reports
a pending change without looking up an unresolved alias or writing the config.

Tests
-----

Run tests::

    $ ./pytest


Credits
=======

This package was created with Cookiecutter_ and the `risclog-solution/risclog-cookiecutter-pypackage`_ project template.

.. _Cookiecutter: https://github.com/audreyr/cookiecutter
.. _`risclog-solution/risclog-cookiecutter-pypackage`: https://github.com/risclog-solution/risclog-cookiecutter-pypackage


This package uses AppEnv_ for running tests inside this package.

.. _AppEnv: https://github.com/flyingcircusio/appenv
