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

Add documentation on pyproject.toml plugin entry-points #9460

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 28 additions & 0 deletions docs/concepts/projects/config.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ affects selection of dependency versions (they must support the same Python vers

## Entry points

### Scripts

Projects may define entry points for the project in the `[project.scripts]` table of the
`pyproject.toml`.

Expand All @@ -34,6 +36,32 @@ hello = "example_package_app:hello"

Using `[project.scripts]` requires a [build system](#build-systems) to be defined.

### Plugins

Projects may define plugins that attach to frameworks of other projects. These plugins
can be declared in the `[project.entry-points]` table if the `pyproject.toml`.

For example, to declare a [flake8 plugin](https://flake8.pycqa.org/en/stable/plugin-development)
with a check extension rule error code of `X`, attached to a class `ExamplePlugin` in the
`flake8_example` module:

```toml title="pyproject.toml"
[project.entry-points."flake8.extension"]
X = "flake8_example:ExamplePlugin"
```

Or to create a [Hatch plugin](https://hatch.pypa.io/latest/plugins/about#discovery) named `foo`,
which refers to the registration hooks module `pkg.hooks`:

```toml title="pyproject.toml"
[project.entry-points.hatch]
foo = "pkg.hooks"
```

!!! important

Using `[project.entry-points]` requires a [build system](#build-systems) to be defined.

## Build systems

A build system determines how the project should be packaged and installed. Projects may declare and
Expand Down
Loading