changelog-chug 0.0.3


pip install changelog-chug

  Latest version

Released: Oct 26, 2024


Meta
Author: Ben Finney
Maintainer: Ben Finney <ben+python@benfinney.id>
Requires Python: >=3.7

Classifiers

Development Status
  • 2 - Pre-Alpha

License
  • OSI Approved :: GNU Affero General Public License v3 or later (AGPLv3+)

Programming Language
  • Python :: 3

Intended Audience
  • Developers

Topic
  • Software Development :: Build Tools

changelog-chug is a parser for project Change Log documents.

changelog-chug

Example

Given a reStructuredText document ChangeLog:

Change Log
##########

Version 1.0.1
=============

:Released: 2020-01-10
:Maintainer: Cathy Morris <cathy.morris@example.com>

…

Version 1.0
===========

:Released: 2020-01-10
:Maintainer: Luis Flores <ayalaian@example.org>

…

Version 0.2
===========

:Released: 2019-07-04
:Maintainer: Cathy Morris <cathy.morris@example.com>

…

Version 0.2-alpha1
==================

:Released: 2019-07-04
:Maintainer: Cathy Morris <cathy.morris@example.com>

…

Version 0.1
===========

:Released: 2019-05-16
:Maintainer: Cathy Morris <cathy.morris@example.com>

…

Generate Change Log entry data for all versions from the reStructuredText formatted ChangeLog:

>>> import pathlib
>>> import pprint
>>> import chug.parsers.rest
>>> import chug.writers
>>> infile_path = pathlib.Path(".", "ChangeLog")
>>> document_text = chug.parsers.get_changelog_document_text(infile_path)
>>> document = chug.parsers.rest.parse_rest_document_from_text(
...     document_text)
>>> entries = chug.parsers.rest.make_change_log_entries_from_document(
...     document)
>>> pprint.pprint([entry.as_version_info_entry() for entry in entries])
[OrderedDict([('release_date', '2020-01-10'),
              ('version', '1.0.1'),
              ('maintainer', 'Cathy Morris <cathy.morris@example.com>'),
              ('body', '…')]),
 OrderedDict([('release_date', '2020-01-10'),
              ('version', '1.0'),
              ('maintainer', 'Luis Flores <ayalaian@example.org>'),
              ('body', '…')]),
 OrderedDict([('release_date', '2019-07-04'),
              ('version', '0.2'),
              ('maintainer', 'Cathy Morris <cathy.morris@example.com>'),
              ('body', '…')]),
 OrderedDict([('release_date', '2019-07-04'),
              ('version', '0.2-alpha1'),
              ('maintainer', 'Cathy Morris <cathy.morris@example.com>'),
              ('body', '…')]),
 OrderedDict([('release_date', '2019-05-16'),
              ('version', '0.1'),
              ('maintainer', 'Cathy Morris <cathy.morris@example.com>'),
              ('body', '…')])]

Generate a JSON document describing the latest version:

>>> import json
>>> latest_entry = entries[0]
>>> latest_entry_json = json.dumps(
...     latest_entry.as_version_info_entry(), indent=4)
>>> print(latest_entry_json)
{
    "release_date": "2020-01-10",
    "version": "1.0.1",
    "maintainer": "Cathy Morris <cathy.morris@example.com>",
    "body": "\u2026"
}

Copying

changelog-chug is free software. See the file COPYING for details.

Wheel compatibility matrix

Platform Python 3
any

Files in release

Extras:
Dependencies:
semver (>=3.0.0)
docutils (>=0.21.0)