Skip to content

Separate build targets with different names / versions #1914

@awerchniak

Description

@awerchniak

I have a project where I want to build two different wheels; a beta/internal version and a prod/stable version. I want these wheels to be distinguishable via either naming or versioning - for example, something like my-project-0.1-py3-none-any.whl vs either my-project-0.1+beta-py3-none-any.whl or my-project-beta-0.1-py3-none-any.whl.

I have found Custom Metadata Hooks which allow me to change the project metadata, something like the following:

from hatchling.metadata.plugin.interface import MetadataHookInterface


class CustomMetadataHook(MetadataHookInterface):
    def update(self, metadata: dict) -> None:
        """
        This updates the metadata mapping of the `project` table in-place.
        """
        metadata["name"] += "-beta"

But, I only want to apply this to one build target, and I don't believe that [tool.hatch.metadata.hooks.custom] can be applied only on particular targets (for example, [tool.hatch.build.targets.custom.metadata.hooks.custom] doesn't seem to work, and with the above syntax, the metadata change is applied to all targets).

Is such a thing possible? If not, what is best practice for building two separate wheels which have different names / versions?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions