diff --git a/schemas/config.json b/schemas/config.json index 5934e6aa8..27e291340 100644 --- a/schemas/config.json +++ b/schemas/config.json @@ -12,6 +12,18 @@ "description": "The strategy to use for this component.", "type": "string" }, + "path": { + "description": "Path to the package directory in a monorepo. Used to identify which package this configuration applies to.", + "type": "string" + }, + "component": { + "description": "Name of the component used for branch naming and release tagging. If not provided, the component may be automatically detected from the package manifest (e.g., package.json for Node, pyproject.toml for Python).", + "type": "string" + }, + "package-name": { + "description": "Name of the package. If not provided, it may be automatically detected from the package manifest.", + "type": "string" + }, "bump-minor-pre-major": { "description": "Breaking changes only bump semver minor if version < 1.0.0", "type": "boolean" diff --git a/src/strategies/python.ts b/src/strategies/python.ts index bd9325165..dfb4f11d6 100644 --- a/src/strategies/python.ts +++ b/src/strategies/python.ts @@ -168,6 +168,18 @@ export class Python extends BaseStrategy { } } + async getDefaultPackageName(): Promise { + const parsedPyProject = await this.getPyProject( + this.addPath('pyproject.toml') + ); + const pyProject = parsedPyProject?.project || parsedPyProject?.tool?.poetry; + if (pyProject?.name) { + return pyProject.name; + } + const nameFromSetupPy = await this.getNameFromSetupPy(); + return nameFromSetupPy ?? undefined; + } + protected async getNameFromSetupPy(): Promise { const ARTIFACT_NAME_REGEX = /name *= *['"](?.*)['"](\r|\n|$)/; const setupPyContents = await this.getSetupPyContents();