Convert changelog into dict.
Project description
Convert changelog into dict
Convert changelog markdown file following keep a changelog format into python dict.
import keepachangelog
changes = keepachangelog.to_dict("path/to/CHANGELOG.md")
changes
would look like:
changes = {
"1.1.0": {
"changed": [
"- Enhancement 1 (1.1.0)",
"- sub enhancement 1",
"- sub enhancement 2",
"- Enhancement 2 (1.1.0)",
],
"release_date": "2018-05-31",
"version": "1.1.0",
},
"1.0.1": {
"fixed": [
"- Bug fix 1 (1.0.1)",
"- sub bug 1",
"- sub bug 2",
"- Bug fix 2 (1.0.1)",
],
"release_date": "2018-05-31",
"version": "1.0.1",
},
"1.0.0": {
"deprecated": ["- Known issue 1 (1.0.0)", "- Known issue 2 (1.0.0)"],
"release_date": "2017-04-10",
"version": "1.0.0",
},
}
For a markdown file with the following content:
# Changelog
All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## [Unreleased]
### Changed
- Release note 1.
- Release note 2.
### Added
- Enhancement 1
- sub enhancement 1
- sub enhancement 2
- Enhancement 2
### Fixed
- Bug fix 1
- sub bug 1
- sub bug 2
- Bug fix 2
### Security
- Known issue 1
- Known issue 2
### Deprecated
- Deprecated feature 1
- Future removal 2
### Removed
- Deprecated feature 2
- Future removal 1
## [1.1.0] - 2018-05-31
### Changed
- Enhancement 1 (1.1.0)
- sub enhancement 1
- sub enhancement 2
- Enhancement 2 (1.1.0)
## [1.0.1] - 2018-05-31
### Fixed
- Bug fix 1 (1.0.1)
- sub bug 1
- sub bug 2
- Bug fix 2 (1.0.1)
## [1.0.0] - 2017-04-10
### Deprecated
- Known issue 1 (1.0.0)
- Known issue 2 (1.0.0)
[Unreleased]: https://github.test_url/test_project/compare/v1.1.0...HEAD
[1.1.0]: https://github.test_url/test_project/compare/v1.0.1...v1.1.0
[1.0.1]: https://github.test_url/test_project/compare/v1.0.0...v1.0.1
[1.0.0]: https://github.test_url/test_project/releases/tag/v1.0.0
Endpoint
Starlette
An helper function is available to create a starlette endpoint to retrieve changelog as JSON.
from starlette.applications import Starlette
from keepachangelog.starlette import add_changelog_endpoint
app = Starlette()
# /changelog endpoint will return the dict extracted from the changelog as JSON.
add_changelog_endpoint(app, "path/to/CHANGELOG.md")
Note: starlette module must be installed.
How to install
- python 3.6+ must be installed
- Use pip to install module:
python -m pip install keepachangelog
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
keepachangelog-0.1.0.tar.gz
(4.3 kB
view hashes)
Built Distribution
Close
Hashes for keepachangelog-0.1.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8d7b5dbe865610680051e9fa799777d5307aa6ec7c6e99a2a8177bef8222c4c7 |
|
MD5 | 0a773c504e96105b94f46a3991055c91 |
|
BLAKE2b-256 | ae0ed2753699994b0a4f3228bc4f4b38c2e8d213b4469660eb15fcfc6df6849f |