Skip to content
Open
Show file tree
Hide file tree
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
12 changes: 12 additions & 0 deletions docs/environment.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,18 @@ Unless an environment is [chosen explicitly](#selection), Hatch will use the `de

## Creation

The `env create` command creates environments from your project configuration; it does not add or modify that configuration. Before creating a custom environment, define it in one of your project configuration files:

```toml tab="pyproject.toml"
[tool.hatch.envs.env-name]
```

```toml tab="hatch.toml"
[envs.env-name]
```

Then run `hatch env create env-name`. The `default` environment is available without an explicit configuration table.

You can create environments by using the [`env create`](cli/reference.md#hatch-env-create) command. Let's enter the directory of the project we created in the [setup phase](intro.md#new-project):

```console
Expand Down
8 changes: 7 additions & 1 deletion src/hatch/cli/env/create.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,13 @@
@click.argument("env_name", default="default")
@click.pass_obj
def create(app: Application, env_name: str):
"""Create environments."""
"""Create environments from project configuration.

Define custom environments in `pyproject.toml` under
`[tool.hatch.envs.ENV_NAME]` or in `hatch.toml` under `[envs.ENV_NAME]`
before running this command. It does not add or modify configuration.
The `default` environment is available without an explicit definition.
"""
app.ensure_environment_plugin_dependencies()

environments = app.project.expand_environments(env_name)
Expand Down