Building newsfiles for your project.
Version control system integration for managing news fragments and staging files.
Remove news fragment files from the repository after building the changelog.
def remove_files(base_directory: str, fragment_filenames: list[str]) -> None:
"""
Remove fragment files from the VCS.
Args:
base_directory: Base directory of the repository
fragment_filenames: List of fragment filenames to remove
"""Stage the generated news file in version control.
def stage_newsfile(directory: str, filename: str) -> None:
"""
Stage the news file in version control.
Args:
directory: Directory containing the news file
filename: Name of the news file to stage
"""Get information about remote branches and determine default comparison targets.
def get_remote_branches(base_directory: str) -> list[str]:
"""
Get list of remote branches.
Args:
base_directory: Base directory of the repository
Returns:
List of remote branch names
"""
def get_default_compare_branch(
base_directory: str,
branches: Container[str]
) -> str | None:
"""
Determine the default branch to compare against.
Args:
base_directory: Base directory of the repository
branches: Available branch names
Returns:
Default branch name or None if unable to determine
"""
def list_changed_files_compared_to_branch(
base_directory: str,
compare_with: str,
include_staged: bool
) -> list[str]:
"""
List files changed compared to a branch.
Args:
base_directory: Base directory of the repository
compare_with: Branch name to compare against
include_staged: Whether to include staged files
Returns:
List of changed file paths
"""from towncrier._vcs import (
remove_files,
stage_newsfile,
get_remote_branches,
get_default_compare_branch,
list_changed_files_compared_to_branch
)Install with Tessl CLI
npx tessl i tessl/pypi-towncrier