Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Separate build targets with different names / versions #1914

Open
awerchniak opened this issue Feb 14, 2025 · 0 comments
Open

Separate build targets with different names / versions #1914

awerchniak opened this issue Feb 14, 2025 · 0 comments

Comments

@awerchniak
Copy link

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant