hatch.publish.plugin.interface.PublisherInterface

class hatch.publish.plugin.interface.PublisherInterface(app, root, cache_dir, project_config, plugin_config)

Bases: ABC

Example usage:

```python tab=”plugin.py”

from hatch.publish.plugin.interface import PublisherInterface

class SpecialPublisher(PublisherInterface):

PLUGIN_NAME = ‘special’ …

```

```python tab=”hooks.py”

from hatchling.plugin import hookimpl

from .plugin import SpecialPublisher

@hookimpl def hatch_register_publisher():

return SpecialPublisher

```

__init__(app, root, cache_dir, project_config, plugin_config)

Methods

__init__(app, root, cache_dir, ...)

publish(artifacts, options)

Attributes

PLUGIN_NAME

The name used for selection.

app

An instance of [Application](../utilities.md#hatchling.bridge.app.Application).

cache_dir

The directory reserved exclusively for this plugin as a path-like object.

disable

Whether this plugin is disabled, thus requiring confirmation when publishing.

plugin_config

This is defined in Hatch's [config file](../../config/hatch.md).

project_config

`toml config-example [tool.hatch.publish.<PLUGIN_NAME>] `

root

The root of the project tree as a path-like object.

PLUGIN_NAME = ''

The name used for selection.

property app

An instance of [Application](../utilities.md#hatchling.bridge.app.Application).

property cache_dir

The directory reserved exclusively for this plugin as a path-like object.

property disable

Whether this plugin is disabled, thus requiring confirmation when publishing. Local [project configuration](reference.md#hatch.publish.plugin.interface.PublisherInterface.project_config) takes precedence over global [plugin configuration](reference.md#hatch.publish.plugin.interface.PublisherInterface.plugin_config).

property plugin_config: dict

This is defined in Hatch’s [config file](../../config/hatch.md).

`toml tab="config.toml" [publish.<PLUGIN_NAME>] `

property project_config: dict

`toml config-example [tool.hatch.publish.<PLUGIN_NAME>] `

abstract publish(artifacts: list[str], options: dict)
Material-align-horizontal-left:

REQUIRED :material-align-horizontal-right:

This is called directly by the [publish](../../cli/reference.md#hatch-publish) command with the arguments and options it receives.

property root

The root of the project tree as a path-like object.