Parses changelog files
Project description
changelog-parser
Yet another python changelog parser.
- Loads data from a
CHANGELOG.md
file using code like:import changelog with open( "CHANGELOG.md", 'rb' ) as fp: changes = changelog.load( fp )
orimport changelog with 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):
{ "$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 using code likeimport changelog import semver from datetime import date with 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", 'rb' ) as fp: changelog.dump( changes, fp )
orimport changelog ... changelog_contents = changelog.dumps( changes ) with open( "CHANGELOG.md", 'r' ) as fp: fp.write( changelog_contents )
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
changelog-parser-0.0.6.tar.gz
(16.3 kB
view details)
Built Distribution
File details
Details for the file changelog-parser-0.0.6.tar.gz
.
File metadata
- Download URL: changelog-parser-0.0.6.tar.gz
- Upload date:
- Size: 16.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/4.0.2 CPython/3.11.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 91ef70c952eb5a885ab0d63051ee75bcf7002437544c067e5e99e63238cc4dec |
|
MD5 | defe888b134bd3c4da4848243d75204b |
|
BLAKE2b-256 | 47c1450c44a6d42d9746ba0f6d379d1d0153ab62ee75fedb8ae422dfc8b61fb9 |
Provenance
File details
Details for the file changelog_parser-0.0.6-py3-none-any.whl
.
File metadata
- Download URL: changelog_parser-0.0.6-py3-none-any.whl
- Upload date:
- Size: 6.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/4.0.2 CPython/3.11.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 82fd63cb47cb2d2343d49b15443771ba484e786dc6f2d1ffa6b95518e9cc41ac |
|
MD5 | 7c0c022d7f6baf586c842019aebffa94 |
|
BLAKE2b-256 | 4e2cf4133704781493bc11f1955303bd50b005acb94bcf93f9b9b23ffdbb4e56 |