Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions schemas/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
12 changes: 12 additions & 0 deletions src/strategies/python.ts
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,18 @@ export class Python extends BaseStrategy {
}
}

async getDefaultPackageName(): Promise<string | undefined> {
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<string | null> {
const ARTIFACT_NAME_REGEX = /name *= *['"](?<name>.*)['"](\r|\n|$)/;
const setupPyContents = await this.getSetupPyContents();
Expand Down
Loading