Skip to content

Build environment with skip-install=false and dev-mode=true #1927

@yonting

Description

@yonting

I got a problem with making a custom build that needs the project to be installed for the build. Is this possible?

If the project makes library my_project then I need my_project library in my hatch_build.py.

I thought I would be able to configure hatch-build environment

# file: pyproject.toml
...
[tool.hatch.envs.hatch-build]
skip-install = false
dev-mode = true

[tool.hatch.build.targets.custom]
path = "hatch_build.py"

and then have hatch_build.py like

# file: hatch_build.py
from my_project import *

...

But running hatch build -t custom gives ModuleNotFoundError: No module named 'my_project' so it doesn't look like the library got installed. I made an example repo (attached). It look like also that the build environment is named my-project-build?

https://github.com/yonting/hatch-example

hatch-example-main.zip

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