import { ExecutorContext } from '@nx/devkit'; import { PoetryPyprojectToml } from '../../types'; import { BuildExecutorSchema } from '../../../../executors/build/schema'; import { Logger } from '../../../../executors/utils/logger'; import { BaseDependencyResolver } from './base'; /** * Resolves project dependencies for Poetry 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. * * Unlike UV, Poetry uses a different structure for dependencies and extras, * with dependencies stored as objects with version, path, and optional properties. */ export declare class ProjectDependencyResolver extends BaseDependencyResolver { constructor(logger: Logger, options: BuildExecutorSchema, context: ExecutorContext); /** * 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 root - The root path of the current project * @param buildFolderPath - The build output directory path * @param buildTomlData - The pyproject.toml configuration to modify * @returns Modified pyproject.toml configuration with resolved dependencies */ apply(root: string, buildFolderPath: string, buildTomlData: PoetryPyprojectToml): PoetryPyprojectToml; /** * 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 * * Poetry-specific handling includes: * - Managing dependency objects with version, path, and optional properties * - Handling extras as arrays of dependency names * - Converting optional dependencies to required when referenced via extras * * @param root - The root path of the current project * @param pyproject - The pyproject.toml configuration to modify * @param buildFolderPath - The build output directory path * @param loggedDependencies - Array of already logged dependencies to avoid duplicates * @returns Modified pyproject.toml configuration */ private updatePyproject; /** * Adds a custom source to the pyproject.toml if specified in build options. * * Poetry uses "sources" instead of "indexes" (UV terminology) for custom * package repositories. * * @param buildTomlData - The pyproject.toml configuration to modify * @param targetOptions - Build options that may contain custom source URL * @returns The name of the added source, or undefined if no custom source */ private addSource; /** * 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 sources by creating unique names with MD5 hashes. * * When multiple sources have the same name but different URLs, this method * creates a new unique name by appending an MD5 hash of the URL. * * Poetry uses "sources" instead of "indexes" (UV terminology) for custom * package repositories. * * @param sources - Existing sources array * @param newSource - The new source to add * @returns Tuple of [updated sources array, final source name] */ private resolveDuplicateSources; } //# sourceMappingURL=project.d.ts.map