get_project_url¶
- safir.metadata.get_project_url(meta: Message, label: str) → Optional[str]¶
Get a specific URL from the
project_urlskey of a package’s metadata.- Parameters
meta (
email.message.Message) – The package metadata, as returned by theimportlib.metadata.metadatafunction.label (
str) –The URL’s label. Consider the follow snippet of a
setup.cfgfile:project_urls = Change log = https://safir.lsst.io/changelog.html Source code = https://github.com/lsst-sqre/safir Issue tracker = https://github.com/lsst-sqre/safir/issues
To get the
https://github.com/lsst-sqre/safirURL, the label isSource code.
- Returns
url – The URL. If the label is not found, the function returns
None.- Return type
Examples
>>> from importlib_metadata import metadata >>> meta = metadata("safir") >>> get_project_url(meta, "Source code") 'https://github.com/lsst-sqre/safir'