get_project_url¶
- safir.metadata.get_project_url(meta, label)¶
Get a specific URL from a package’s
project_urlsmetadata.- Parameters:
meta (
Message) – The package metadata, as returned by theimportlib.metadata.metadatafunction.label (
str) –The URL’s label. Consider the follow snippet of a
pyproject.tomlfile:[project.urls] Homepage = "https://safir.lsst.io/" Source = "https://github.com/lsst-sqre/safir"
To get the
https://github.com/lsst-sqre/safirURL, the label isSource.Packages using
setup.cfguse a different syntax but a similar approach.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:
The URL. If the label is not found, the function returns
None.- Return type:
str or None
Examples
>>> from importlib_metadata import metadata >>> meta = metadata("safir") >>> get_project_url(meta, "Source") 'https://github.com/lsst-sqre/safir'