Skip to main content

Generate changelog from Git commits.

Project description

Generate changelog from Git commits.

PyPI Version Supported Python versions Build Status GPL-2.0-only OR LGPL-2.1-or-later Coverage

Prerequisites

  • Python 3.6, 3.7 and 3.8

Documentation

Documentation is available on Read the Docs.

Installation

Latest stable version on PyPI:

pip install matyan

Usage

Basic usage

See Basic concepts section to get impression on possible commit methodology and assumptions taken.

Generate changelog:

generate-changelog

Generate changelog skipping orphaned commits:

In some cases you would only want to show what has been done with tickets and skip all non-ticket related commits.

generate-changelog --no-other

Generate changelog between two releases:

In other cases you would want to show what has been done since last release. The following example would generate changelog since version 0.0.1 to version 0.0.3.

generate-changelog 0.0.1..0.0.3

Generate changelog between two branches:

Sometimes you just need to show the changes made on acceptance since last production release. The following example would generate changelog with changes that are on acceptance branch and not yet in master.

generate-changelog master..acceptance

Generate changelog with releases info shown

generate-changelog --show-releases

Generate changelog between releases with releases info shown

generate-changelog 0.0.1..0.0.3 --show-releases

Generate changelog between branches with releases info shown

generate-changelog master..dev --show-releases

Generate changelog for the latest release with releases info shown

generate-changelog --latest-release --show-releases

Generate changelog with headings only (no commit messages) and releases info shown

generate-changelog --headings-only --show-releases

Generate changelog between two branches, show unreleased changes only:

generate-changelog master..acceptance --show-releases --unreleased-only

Rendering

The following renderers are implemented:

  • Markdown

  • RestructuredText

  • Historical Markdown (for compatibility with matyan versions prior to 0.4).

Markdown

generate-changelog --show-releases --renderer=markdown

RestructuredText

generate-changelog --show-releases --renderer=rest

Historical Markdown

generate-changelog --show-releases --renderer=historical-markdown

Jira integration

It’s possible to fetch ticket title and description from Jira. In order for it to work, you should provide a fetch-title and fetch-description arguments.

The following needs to be added to your .matyan.ini:

[Settings]
fetchDataFrom=Jira

In addition to that, you should put valid Jira credentials into your global .matyan.ini configuration file.

Command to run:

generate-changelog --show-releases --fetch-title --fetch-description

Have in mind, that matyan shall be installed with jira option.

pip install matyan[jira]

Alternatively, make sure atlassian-python-api is installed.

pip install atlassian-python-api

Examples

See the output directory for examples.

Additionally see the Jupyter notebook examples.

Configuration

In order to customize names and texts, add a .matyan.ini in your project directory, from which you will be running the generate-changelog command.

Sample configuration:

[BranchTypes]
feature: Feature
bugfix: Bugfix
hotfix: Hotfix
deprecation: Deprecation

[OtherBranchType]
other: Other

[Unreleased]
unreleased: Unreleased

[IgnoreCommits]
exact: more
       clean up
       code comments
       more on docs
       repo
       working
       more on
       wip
       commit
prefix: more on
        continue on

Note, that placing .matyan.ini into the home root will make that configuration global for all projects. That however could be handy, since local .matyan.ini files simply extend the global ones. For example, you could use global configuration for storing Jira credentials.

[Jira]
url:https://barseghyanartur.atlassian.net/
username:user@domain.com
token:abcd1234

Note, however, that sections are copied over entirely.

Tips and tricks

Write to file

generate-changelog --show-releases 2>&1 | tee changelog.md

Create initial config file

matyan-make-config

Testing

Simply type:

./runtests.py

Or use tox:

tox

Or use tox to check specific env:

tox -e py38

Debugging

Sometimes checking logs could be handy. Matyan logs are stored in the directory, from which you are running the generate-changelog (or any other Matyan) command.

Update your .matyan.ini configuration in the following way:

[Settings]
debug=true
tail -f /path/to/your/project/matyan.log

If you want to modify current logging, use MATYAN_LOGGING_CONFIG environment variable.

Default configuration:

DEFAULT_LOGGING_CONFIG = {
    'version': 1,
    'disable_existing_loggers': False,
    'root': {
        'level': 'WARNING',
        'handlers': ['file'],
    },
    'formatters': {
        'verbose': {
            'format': '{levelname} {asctime} {module} {process:d} {thread:d} '
                      '{message}',
            'style': '{',
        },
        'simple': {
            'format': '{levelname} {message}',
            'style': '{',
        },
    },
    'handlers': {
        'console': {
            'level': 'WARNING',
            'class': 'logging.StreamHandler',
            'formatter': 'simple'
        },
        'file': {
            'level': 'WARNING',
            'class': 'logging.handlers.RotatingFileHandler',
            'filename': os.path.join(os.getcwd(), "matyan.log"),
            'maxBytes': 1048576,
            'backupCount': 99,
            'formatter': 'verbose',
        },
    },
    'loggers': {
        'matyan': {
            'handlers': ['file'],
            'propagate': True,
        },
    },
}

Writing documentation

Keep the following hierarchy.

=====
title
=====

header
======

sub-header
----------

sub-sub-header
~~~~~~~~~~~~~~

sub-sub-sub-header
^^^^^^^^^^^^^^^^^^

sub-sub-sub-sub-header
++++++++++++++++++++++

sub-sub-sub-sub-sub-header
**************************

License

GPL-2.0-only OR LGPL-2.1-or-later

Support

For any issues contact me at the e-mail given in the Author section.

Author

Artur Barseghyan <artur.barseghyan@gmail.com>

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

matyan-0.4.7.tar.gz (52.2 kB view details)

Uploaded Source

Built Distribution

matyan-0.4.7-py2.py3-none-any.whl (52.1 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file matyan-0.4.7.tar.gz.

File metadata

  • Download URL: matyan-0.4.7.tar.gz
  • Upload date:
  • Size: 52.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.6.0 requests-toolbelt/0.9.1 tqdm/4.38.0 CPython/3.6.9

File hashes

Hashes for matyan-0.4.7.tar.gz
Algorithm Hash digest
SHA256 3af7bb333e02b0a03dd1e83761304fffc46c4a35e225a22640a32c01cfec7640
MD5 d877c0aab5027c6c10ec9f1b19861370
BLAKE2b-256 097aab34acad898cbd6aac4428df34c890874d05c6b734ae2b5ab1124d45494e

See more details on using hashes here.

File details

Details for the file matyan-0.4.7-py2.py3-none-any.whl.

File metadata

  • Download URL: matyan-0.4.7-py2.py3-none-any.whl
  • Upload date:
  • Size: 52.1 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.6.0 requests-toolbelt/0.9.1 tqdm/4.38.0 CPython/3.6.9

File hashes

Hashes for matyan-0.4.7-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 667d8926737352178868262005b84de2df76774993a306fa119070edbf49b31e
MD5 d905b6310d6220f58a3c335d6c7f9cca
BLAKE2b-256 7b095348971e0c6191aa35f366d2ab062101a880450b2968bc248b6b095bbbc7

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page