Skip to content

Python: add support for __about__.py #2433

Open
@fredrikaverpil

Description

@fredrikaverpil

Is your feature request related to a problem? Please describe.

I cannot make release-please bump the version string inside any other Python file than __init__.py, as this is today hard-coded:

if (!projectName) {
this.logger.warn('No project/component found.');
} else {
[projectName, projectName.replace(/-/g, '_')]
.flatMap(packageName => [
`${packageName}/__init__.py`,
`src/${packageName}/__init__.py`,
])
.forEach(packagePath =>
updates.push({
path: this.addPath(packagePath),
createIfMissing: false,
updater: new PythonFileWithVersion({version}),
})
);
}

Some Python projects doesn't use __init__.py to store the version string. Some projects like to place this in a __about__.py file or __version__.py file instead. In short, this separates concerns so that the version string can be watched outside of any other potential code changes. In my case, I wanted release-please to bump an __about__.py file.

Describe the solution you'd like

  • I'd like to have release-please attempt to bump __init__.py like it does today for backwards compatibility reasons.
  • I'd like to define the desired filename in which the version string will be bumped, using the version-file manifest configuration (but this is currently not taken into consideration for release-please's Python strategy).

Describe alternatives you've considered

N/A

PR proposal

This enables the use of version-file: #2434

Metadata

Metadata

Assignees

Labels

priority: p3Desirable enhancement or fix. May not be included in next release.type: feature request‘Nice-to-have’ improvement, new feature or different behavior or design.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions