https://github.com/jasonstiefel/changelog-parser
Yet another Python CHANGELOG.md parser
https://github.com/jasonstiefel/changelog-parser
changelog-formatter changelog-parser keepachangelog python3
Last synced: 17 days ago
JSON representation
Yet another Python CHANGELOG.md parser
- Host: GitHub
- URL: https://github.com/jasonstiefel/changelog-parser
- Owner: JasonStiefel
- License: mit
- Created: 2023-07-25T20:47:43.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2023-10-04T15:44:49.000Z (over 1 year ago)
- Last Synced: 2025-04-27T09:06:08.904Z (about 1 month ago)
- Topics: changelog-formatter, changelog-parser, keepachangelog, python3
- Language: Python
- Homepage: https://pypi.org/project/changelog-parser
- Size: 39.1 KB
- Stars: 1
- Watchers: 1
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
- Codeowners: .github/CODEOWNERS
Awesome Lists containing this project
README
# changelog-parser
Yet another python changelog parser.
* Loads data from a [`CHANGELOG.md` file](https://keepachangelog.com/en/1.1.0/) using code like:
```python
import changelogwith open( "CHANGELOG.md", 'rb' ) as fp:
changes = changelog.load( fp )
```
or
```python
import changelogwith open( "CHANGELOG.md", 'r' ) as fp:
changes = changelog.loads( fp.read() )
```
* Returns it in the following schema (some types are Python objects and not valid JSON schema):
```js
{
"$schema": "https://json-schema.org/draft-07/schema#",
"title": "Loaded Changelog",
"type": "array",
"items": {
"type": "object",
"properties": {
"version": {
"oneOf": [ {
"const": "Unreleased"
}, {
"type": "semver.Version",
"description": "Python object from https://pypi.org/project/semver/"
} ]
},
"date": {
"oneOf": [ {
"const": null
}, {
"type": "datetime.date",
"description": "Python object from https://docs.python.org/3/library/datetime.html#date-objects; parsed using \"fromisoformat\""
} ]
},
"yanked": {
"type": "boolean"
},
"added": { "$ref": "#/$defs/change_list" },
"changed": { "$ref": "#/$defs/change_list" },
"depreciated": { "$ref": "#/$defs/change_list" },
"removed": { "$ref": "#/$defs/change_list" },
"fixed": { "$ref": "#/$defs/change_list" },
"security": { "$ref": "#/$defs/change_list" },
"compare_url": {
"type": "string",
"pattern": "^https?:\\/\\/.+"
}
},
"required": [ "version", "date", "yanked" ],
"additionalProperties": false
},
"$defs": {
"change_list": {
"type": "array",
"items": { "type": "string" }
}
}
}
```
* Dumps data, structured like that above, to a [`CHANGELOG.md` file](https://keepachangelog.com) using code like
```python
import changelog
import semver
from datetime import datewith open( "CHANGELOG.md", 'rb' ) as fp:
changes = changelog.load( fp )changes.insert( 0, {
"version": semver.Version( major = 0, minor = 0, patch = 6 ),
"date": date.today(),
"added": [ "`dump` and `dumps` examples" ]
} )with open( "CHANGELOG.md", 'wb' ) as fp:
changelog.dump( changes, fp )
```
or
```python
import changelog
...
changelog_contents = changelog.dumps( changes )
with open( "CHANGELOG.md", 'w' ) as fp:
fp.write( changelog_contents )
```