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/metadatakey.- 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/configkey. This function uses thenameattribute 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_metadataintegrates extensively with your package’s metadata. Typically this metadata is either set in thesetup.cfgorsetup.pyfile (for setuptools-based applications):- version
Used as the version metadata. This may be set automatically with
setuptools_scm.- summary
Use as the
descriptionmetadata.- url
Used as the
documentation_urlmetadata.- project_urls, Source code
Used as the
respository_url.
The configuration object (
app["safir/config"]) also provides metadata:- config.name
Used as the
namemetadata field.
Metadata schema
The metadata is stored as a
dictin 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" }