get_metadata¶
- safir.metadata.get_metadata(*, package_name, application_name)¶
Retrieve metadata for the application.
- Parameters:
pacakge_name – The name of the package (Python namespace). This name is used to look up metadata about the package.
application_name (
str
) – The value to return as the application name (thename
metadata field).
- Returns:
The package metadata as a Pydantic model, suitable for returning as the result of a FastAPI route.
- Return type:
Notes
get_metadata
integrates extensively with your package’s metadata. Typically this metadata is set inpyproject.toml
,setup.cfg
,setup.py
file (for setuptools-based applications). Thepyproject.toml
fields used are:- version
Used as the version metadata. This may be set automatically with
setuptools_scm
.- description
Use as the
description
metadata.- project.urls, Homepage
Used as the
documentation_url
metadata.- project.urls, Source
Used as the
respository_url
.
Packages using
setup.cfg
orsetup.py
get the last three items of metadata from different sources:- summary
Use as the
description
metadata.- url
Used as the
documentation_url
metadata.- project_urls, Source code
Used as the
respository_url
.
- Parameters:
package_name (
str
)