Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Configure from section in pyproject.toml #146

Closed
radusuciu opened this issue Mar 10, 2023 · 2 comments
Closed

Configure from section in pyproject.toml #146

radusuciu opened this issue Mar 10, 2023 · 2 comments
Assignees
Labels
feature/request New feature or request

Comments

@radusuciu
Copy link
Contributor

It would be great for Python projects if git-cliff could be configured from pyproject.toml as can be done for Rust projects in Cargo.toml (implemented in #46). I think the implementation would require minimal additional changes.

The docs give this as an example for Rust projects:

[package]
name = "..."
[dependencies]
# ...
[package.metadata.git-cliff.changelog]
header = "All notable changes to this project will be documented in this file."
body = "..."
footer = "<!-- generated by git-cliff -->"
# see [changelog] section for more keys
[package.metadata.git-cliff.git]
conventional_commits = true
commit_parsers = []
filter_commits = false
# see [git] section for more keys

pyproject.toml would look like:

name = "..."

[project]
dependencies = []

[tool.git-cliff.changelog]
header = "All notable changes to this project will be documented in this file."
body = "..."
footer = "<!-- generated by git-cliff -->"
# see [changelog] section for more keys
[tool.git-cliff.git]
conventional_commits = true
commit_parsers = []
filter_commits = false
# see [git] section for more keys

The format of pyproject.toml is detailed in PEP621 and the [tool] table is described in PEP518.

Looking at the implementation in f48d207 it seems that you could add a regex to support this:

/// Regex for matching the metadata in Cargo.toml
const CARGO_METADATA_REGEX: &str =
	r"^\[(?:workspace|package)\.metadata\.git\-cliff\.";

/// Regex for matching the metadata in pyproject.toml
const PYPROJECT_METADATA_REGEX: &str =
	r"^\[(?:tool)\.git\-cliff\.";
@orhun
Copy link
Owner

orhun commented Mar 11, 2023

That's actually a great idea! Let's proceed with the implementation.

@orhun
Copy link
Owner

orhun commented Mar 31, 2023

Implemented in #147

@orhun orhun closed this as completed Mar 31, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature/request New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants