Skip to content

There is no way to specify and explicit allow-list of imports, which could be useful for (for example shared testing code)

There's currently no way of telling the import guardian that a given import, which is disallowed in most places, is allowed in a specific place.

This could be useful, for example, in a project whose tests need to reach across importguardian boundaries for the sake of not having to re-jig code layouts for the sake of making certain modules available to test-only code.

An example solution could be to take an allowed_imports stanza in the importguardian.json:

{
    "foo.bar.baz": {
        "forbidden_from": [
            "spam.eggs",
        ]
    },
    "allowed_imports":
        "foo.bar.baz": {
            "allowed_in": [
                "spam.eggs.tests"
            ]
        }
    }
}
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information