Skip to content

Add support for namespace packages #34

@jaraco

Description

@jaraco

In coherent-oss/coherent.build#2, I'm working on adding editable support for Coherent System projects that follow the essential layout. And while I recognize this project primarily aims to support the src layout, it would be nice to re-use the redirector functionality for projects using the essential layout.

At first blush, it doesn't appear to me as if the editables project can support (PEP 420) namespace packages in any layout. That is, if a project like jaraco.functools or coherent.build doesn't have any __init__.py in the root namespace, it is incompatible with the redirector (because the target of a redirection needs a file location and there's no file location for a namespace package).

Moreover, any redirector should probably support redirecting the inner module/package and not the namespace package so that the editable-installed package can exist alongside other packages sharing the same namespace (e.g. jaraco.functools editable-installed alongside jaraco.context installed on the file system).

I believe it should be possible for the redirector to support redirecting namespace submodules. In particular, I'm imagining something like:

F.install()
F.map_module("jaraco.functools", "path/to/jaraco.functools/__init__.py")

The redirector would then expose the parent jaraco module (if it doesn't already exist) and the jaraco.functools module (from the indicated path).

Maybe we'll want to add something to #24, but I wanted to start with a dedicated issue to discuss the possibilities and concerns.

Some questions:

Is this use-case something that was considered and rejected?

Do you have any specific goals that would prevent adding support to the Redirector (with or without support in EditableProject)?

Is there another construct/approach that's meant to address this need?

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