import { UVPyprojectToml } from '../../types'; import { Logger } from '../../../../executors/utils/logger'; import { BuildExecutorSchema } from '../../../../executors/build/schema'; import { ExecutorContext } from '@nx/devkit'; /** * Resolves project dependencies for UV package manager when lockedVersion is false. * * This resolver handles complex dependency scenarios including: * - Local workspace dependencies with path references * - Optional dependencies (extras) merging and promotion * - Multi-level dependency resolution * - Bundle vs publish mode handling * * The resolver processes dependencies recursively, merging optional dependencies * from local packages into the target package's metadata, ensuring that when * a local dependency is bundled, its optional dependencies are properly included * in the final wheel metadata. */ export declare class ProjectDependencyResolver { private readonly logger; private readonly options; private readonly context; private readonly isWorkspace; private rootUvLock; constructor(logger: Logger, options: BuildExecutorSchema, context: ExecutorContext, isWorkspace: boolean); /** * Applies dependency resolution to the pyproject.toml configuration. * * This is the main entry point that processes all dependencies in the project, * including local workspace dependencies and their optional dependencies. * * @param projectRoot - The root path of the current project * @param buildFolderPath - The build output directory path * @param buildTomlData - The pyproject.toml configuration to modify * @param workspaceRoot - The workspace root path * @returns Modified pyproject.toml configuration with resolved dependencies */ apply(projectRoot: string, buildFolderPath: string, buildTomlData: UVPyprojectToml, workspaceRoot: string): UVPyprojectToml; /** * Recursively updates the pyproject.toml with resolved dependencies. * * This method follows a "do one thing well" design principle by processing * only ONE level of local dependencies at a time. This approach prevents * complexity explosion and makes the extras/optional dependency merging * logic manageable. * * **Design Philosophy:** * - Each call processes exactly one level of local dependencies * - Results are accumulated incrementally: A -> A+B -> A+B+C -> A+B+C+D * - Complex logic (extras merging, optional promotion) is handled one level at a time * - Each recursive call only needs to worry about the next level, not the entire tree * * **Benefits:** * - Predictable and debuggable: each call has a single responsibility * - Memory efficient: only loads one level of dependencies at a time * - Error isolation: failures are contained to specific levels * - Testable: each level can be tested independently * * This method handles the core dependency resolution logic: * 1. Processes all dependencies (main and optional) * 2. Resolves local workspace dependencies * 3. Merges optional dependencies from local packages * 4. Promotes optional dependencies to main dependencies when needed * 5. Handles multi-level dependency resolution * * @param projectRoot - The root path of the current project * @param buildFolderPath - The build output directory path * @param pyproject - The pyproject.toml configuration to modify * @param workspaceRoot - The workspace root path * @param loggedDependencies - Array of already logged dependencies to avoid duplicates * @returns Modified pyproject.toml configuration */ private updatePyproject; /** * Removes a dependency from the specified group in pyproject.toml. * * @param group - The dependency group ('__main__' for main dependencies, or extra name) * @param dependency - The dependency string to remove * @param pyproject - The pyproject.toml configuration to modify */ private removeDependency; /** * Appends a dependency to the specified group in pyproject.toml. * * Handles both main dependencies and optional dependencies, with support * for force updates and index management. * * @param pyproject - The pyproject.toml configuration to modify * @param targetOptions - Build options for the target project * @param group - The dependency group ('__main__' for main dependencies, or extra name) * @param dependency - The dependency string to add * @param force - Whether to force update existing dependencies */ private appendDependency; /** * Gets all dependencies from the pyproject.toml as a flat array. * * Returns both main dependencies and optional dependencies in the format: * [['__main__', 'dependency1'], ['extra1', 'dependency2'], ...] * * @param pyproject - The pyproject.toml configuration to extract dependencies from * @returns Array of [group, dependency] pairs */ private getProjectDependencies; /** * Gets the absolute path to a local dependency. * * Handles both workspace mode (using uv.lock) and relative path mode. * * @param workspaceRoot - The workspace root path * @param dependency - The dependency name * @param projectRoot - The current project root * @param relativePath - Optional relative path from pyproject.toml * @returns The absolute path to the dependency, or undefined if not found */ private getDependencyPath; /** * Adds a custom index to the pyproject.toml if specified in build options. * * @param buildTomlData - The pyproject.toml configuration to modify * @param targetOptions - Build options that may contain custom source URL * @returns The name of the added index, or undefined if no custom source */ private addIndex; /** * Gets the Nx project configuration for a given root path. * * @param root - The project root path to find configuration for * @returns The Nx project configuration * @throws Error if project configuration is not found */ private getProjectConfig; /** * Resolves duplicate indexes by creating unique names with MD5 hashes. * * When multiple indexes have the same name but different URLs, this method * creates a new unique name by appending an MD5 hash of the URL. * * @param indexes - Existing indexes array * @param newIndex - The new index to add * @returns Tuple of [updated indexes array, final index name] */ private resolveDuplicateIndexes; } //# sourceMappingURL=project.d.ts.map