Skip to content

DataDog/hatch-datadog-build-metadata

Repository files navigation

hatch-datadog-build-metadata

CI/CD CI - Test CD - Build
Package PyPI - Version PyPI - Python Version
Meta Hatch project code style - black types - Mypy License - MIT

This provides a plugin for Hatch that injects metadata from your preferred version control system like Git.

Table of Contents

Global dependency

Ensure hatch-datadog-build-metadata is defined within the build-system.requires field in your pyproject.toml file.

[build-system]
requires = ["hatchling", "hatch-datadog-build-metadata"]
build-backend = "hatchling.build"

Metadata hook

Note: only Git is supported

The metadata hook plugin name is datadog-build-metadata.

  • pyproject.toml

    [tool.hatch.metadata.hooks.datadog-build-metadata]

Metadata hook options

URLs

The urls option is equivalent to project.urls except that each URL supports context formatting with the following fields:

  • commit_hash - the latest commit hash
  • remote_url - the raw remote URL as stored in VCS config
  • remote_http_url - the remote_url converted to an HTTP(S) URL

Be sure to add urls to project.dynamic:

  • pyproject.toml

    [project]
    dynamic = [
      "urls",
    ]

By default, the following URLs are set:

  • source_code_link -> {remote_http_url}#{commit_hash}

Example

The following example assumes that the code is hosted by GitHub.

  • pyproject.toml

    [tool.hatch.metadata.hooks.datadog-build-metadata.urls]
    Homepage = "https://www.example.com"
    source_archive = "{remote_http_url}/archive/{commit_hash}.tar.gz"
  • hatch.toml

    [metadata.hooks.datadog-build-metadata.urls]
    Homepage = "https://www.example.com"
    source_archive = "{remote_http_url}/archive/{commit_hash}.tar.gz"

License

hatch-datadog-build-metadata is distributed under the terms of the MIT license.

About

Hatch build plugin for source code metadata used by APM

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 3

  •  
  •  
  •  

Languages