---
title: Public imports of project-internal modules (PublicImportOfProjectInternalModule)
framework: swift-compiler
role: article
role_heading: Article
path: swift-compiler/documentation/diagnostics/public-import-of-project-internal-module
---

# Public imports of project-internal modules (PublicImportOfProjectInternalModule)

## Overview

Overview Modules built with -library-level ipi are considered project-internal and therefore are not intended to be redistributed. As a result, modules that are intended for redistribution should not import -library-level ipi modules publicly since clients will not be able to resolve references to them. When a module built with -library-level api or -library-level spi imports a -library-level ipi module in a way that exposes the dependency to clients (a bare public import, an explicit public import, or an @_exported import), the compiler emits a warning. For example: // MainLib is built with -library-level api public import ProjectInternalUtilities   // |- warning: Project internal module 'ProjectInternalUtilities' cannot be imported publicly because 'MainLib' has '-library-level api' Clang Modules Clang modules do not have their own -library-level setting. To indicate to the compiler that a Clang module is not intended for redistribution, pass -ipi-clang-module <module name> when compiling the Swift modules that import it. Imports of the Clang module will be diagnosed the same way that -library-level ipi Swift modules are: swiftc -library-level api -ipi-clang-module ProjectInternalCUtilities ... // In a module built with the flags above: public import ProjectInternalCUtilities   // |- warning: Project internal module 'ProjectInternalCUtilities' cannot be imported publicly because 'MainLib' has '-library-level api' Resolving the warning If the dependency is purely an implementation detail and is never referenced in public or @inlinable API, mark the import internal (or adopt the upcoming feature InternalImportsByDefault, where a bare import is already internal): internal import ProjectInternalUtilities If the importing module is itself not meant to be redistributed, lower its library level to ipi. Imports between non-distributable modules are unrestricted because the result is also non-distributable: swiftc -library-level ipi ...

## See Also

### Related Documentation

- [SE-0409: Access level on imports](swift-compiler/documentation/swift-evolution/0409-access-level-on-imports.md)

- [@dynamicCallable implementation requirements (DynamicCallable)](swift-compiler/documentation/diagnostics/dynamic-callable-requirements.md)
- [Add @preconcurrency import (AddPreconcurrencyImport)](swift-compiler/documentation/diagnostics/add-preconcurrency-import.md)
- [Always enabled availability domains (AlwaysAvailableDomain)](swift-compiler/documentation/diagnostics/always-available-domain.md)
- [Argument matching for trailing closures (TrailingClosureMatching)](swift-compiler/documentation/diagnostics/trailing-closure-matching.md)
- [Calling a mutating async actor-isolated method (ActorIsolatedMutatingAsync)](swift-compiler/documentation/diagnostics/actor-isolated-mutating-async.md)
- [Calling an actor-isolated method from a synchronous nonisolated context (ActorIsolatedCall)](swift-compiler/documentation/diagnostics/actor-isolated-call.md)
- [Captures in a `@Sendable` closure (SendableClosureCaptures)](swift-compiler/documentation/diagnostics/sendable-closure-captures.md)
- [Compilation caching (CompilationCaching)](swift-compiler/documentation/diagnostics/compilation-caching.md)
- [Conforming to `StringInterpolationProtocol` (StringInterpolationConformance)](swift-compiler/documentation/diagnostics/string-interpolation-conformance.md)
- [Conversion from `@isolated(any)` function type to synchronous function type (ConversionFromIsolatedAnyToSynchronous)](swift-compiler/documentation/diagnostics/conversion-from-isolated-any-to-synchronous.md)
- [Cross-isolation data race (RegionIsolationCrossIsolationDataRace)](swift-compiler/documentation/diagnostics/region-isolation-cross-isolation-data-race.md)
- [Deprecated declaration warnings (DeprecatedDeclaration)](swift-compiler/documentation/diagnostics/deprecated-declaration.md)
- [Deprecated implementation-only imports (ImplementationOnlyDeprecated)](swift-compiler/documentation/diagnostics/implementation-only-deprecated.md)
- [Dynamic exclusivity (DynamicExclusivity)](swift-compiler/documentation/diagnostics/dynamic-exclusivity.md)
- [Embedded Swift language restrictions (EmbeddedRestrictions)](swift-compiler/documentation/diagnostics/embedded-restrictions.md)
