setup_metadata¶
-
safir.metadata.
setup_metadata
(*, package_name: str, app: aiohttp.web_app.Application, **kwargs: Any) → None¶ Add a metadata object to the application under the
safir/metadata
key.- Parameters
pacakge_name (
str
) – The name of the package (Python namespace). This name is used to look up metadata about the package.app (
aiohttp.web.Application
) – The application, which must already have a standard configuration object at thesafir/config
key. This function uses thename
attribute of the configuration.**kwargs – Add additional metadata keys, and their values, as keyword arguments. In practice, values must be JSON-serializable.
Notes
Metadata sources
setup_metadata
integrates extensively with your package’s metadata. Typically this metadata is either set in thesetup.cfg
orsetup.py
file (for setuptools-based applications):- version
Used as the version metadata. This may be set automatically with
setuptools_scm
.- summary
Use as the
description
metadata.- url
Used as the
documentation_url
metadata.- project_urls, Source code
Used as the
respository_url
.
The configuration object (
app["safir/config"]
) also provides metadata:- config.name
Used as the
name
metadata field.
Metadata schema
The metadata is stored as a
dict
in the"safir/metadata"
key of the application:{ "name": "safirdemo", "version": "0.1.0", "description": "Demonstration of a Safir-based app.", "repository_url": "https://github.com/lsst-sqre/safirdemo", "documentation_url": "https://github.com/lsst-sqre/safirdemo" }