Skip to content

Commit

Permalink
Merge pull request #42 from Colin-b/develop
Browse files Browse the repository at this point in the history
Release 2.0.0.dev3
  • Loading branch information
Colin-b committed Oct 19, 2022
2 parents 7c94109 + 13cdcf2 commit 9d79410
Show file tree
Hide file tree
Showing 11 changed files with 231 additions and 32 deletions.
36 changes: 36 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: Release

on:
push:
branches:
- master

jobs:
build:

runs-on: ubuntu-latest
strategy:
matrix:
python-version: ['3.7', '3.8', '3.9', '3.10']

steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install .[testing]
- name: Test with pytest
run: |
pytest --cov=keepachangelog --cov-fail-under=100 --cov-report=term-missing
- name: Create packages
run: |
python -m pip install wheel
python setup.py sdist bdist_wheel
- name: Publish packages
run: |
python -m pip install twine
python -m twine upload dist/* --skip-existing --username __token__ --password ${{ secrets.pypi_password }}
25 changes: 25 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: Test

on: [push]

jobs:
build:

runs-on: ubuntu-latest
strategy:
matrix:
python-version: ['3.7', '3.8', '3.9', '3.10']

steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install .[testing]
- name: Test with pytest
run: |
pytest --cov=keepachangelog --cov-fail-under=100 --cov-report=term-missing
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
repos:
- repo: https://github.com/psf/black
rev: 21.7b0
rev: 22.10.0
hooks:
- id: black
16 changes: 0 additions & 16 deletions .travis.yml

This file was deleted.

10 changes: 9 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,13 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

## [2.0.0.dev3] - 2022-10-19
### Fixed
- `keepachangelog.from_dict` now returns a single new line at end of file in case no url could be found. (Thanks [rockstarr-programmerr](https://github.com/rockstarr-programmerr))

### Changed
- Dropped support for python 3.6

## [2.0.0.dev2] - 2021-08-04
### Fixed
- `keepachangelog.release` will now properly bump version in case the number of digit to compare was previously increased (such as if version 9 and 10 existed).
Expand Down Expand Up @@ -84,7 +91,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Added
- Initial release.

[Unreleased]: https://github.com/Colin-b/keepachangelog/compare/v2.0.0.dev2...HEAD
[Unreleased]: https://github.com/Colin-b/keepachangelog/compare/v2.0.0.dev3...HEAD
[2.0.0.dev3]: https://github.com/Colin-b/keepachangelog/compare/v2.0.0.dev2...v2.0.0.dev3
[2.0.0.dev2]: https://github.com/Colin-b/keepachangelog/compare/v2.0.0.dev1...v2.0.0.dev2
[2.0.0.dev1]: https://github.com/Colin-b/keepachangelog/compare/v2.0.0.dev0...v2.0.0.dev1
[2.0.0.dev0]: https://github.com/Colin-b/keepachangelog/compare/v1.0.0...v2.0.0.dev0
Expand Down
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2021 Colin Bounouar
Copyright (c) 2022 Colin Bounouar

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@

<p align="center">
<a href="https://pypi.org/project/keepachangelog/"><img alt="pypi version" src="https://img.shields.io/pypi/v/keepachangelog"></a>
<a href="https://travis-ci.com/Colin-b/keepachangelog"><img alt="Build status" src="https://api.travis-ci.com/Colin-b/keepachangelog.svg?branch=master"></a>
<a href="https://travis-ci.com/Colin-b/keepachangelog"><img alt="Coverage" src="https://img.shields.io/badge/coverage-100%25-brightgreen"></a>
<a href="https://github.com/Colin-b/keepachangelog/actions"><img alt="Build status" src="https://github.com/Colin-b/keepachangelog/workflows/Release/badge.svg"></a>
<a href="https://github.com/Colin-b/keepachangelog/actions"><img alt="Coverage" src="https://img.shields.io/badge/coverage-100%25-brightgreen"></a>
<a href="https://github.com/psf/black"><img alt="Code style: black" src="https://img.shields.io/badge/code%20style-black-000000.svg"></a>
<a href="https://travis-ci.com/Colin-b/keepachangelog"><img alt="Number of tests" src="https://img.shields.io/badge/tests-40 passed-blue"></a>
<a href="https://github.com/Colin-b/keepachangelog/actions"><img alt="Number of tests" src="https://img.shields.io/badge/tests-41 passed-blue"></a>
<a href="https://pypi.org/project/keepachangelog/"><img alt="Number of downloads" src="https://img.shields.io/pypi/dm/keepachangelog"></a>
</p>

Expand Down Expand Up @@ -294,7 +294,7 @@ add_changelog_endpoint(api, "path/to/CHANGELOG.md")
Note: [flask-restx](https://pypi.python.org/pypi/flask-restx) module must be installed.

## How to install
1. [python 3.6+](https://www.python.org/downloads/) must be installed
1. [python 3.7+](https://www.python.org/downloads/) must be installed
2. Use pip to install module:
```sh
python -m pip install keepachangelog
Expand Down
9 changes: 6 additions & 3 deletions keepachangelog/_changelog.py
Original file line number Diff line number Diff line change
Expand Up @@ -158,14 +158,17 @@ def from_dict(changes: Dict[str, dict]):

content += "\n"

content += "\n"

urls_content = []
for current_release in changes.values():
metadata = current_release["metadata"]
if not metadata.get("url"):
continue
urls_content.append(f"[{metadata['version'].capitalize()}]: {metadata['url']}")

content += f"[{metadata['version'].capitalize()}]: {metadata['url']}\n"
if urls_content:
content += "\n"
content += "\n".join(urls_content)
content += "\n"

return content

Expand Down
2 changes: 1 addition & 1 deletion keepachangelog/version.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@
# Major should be incremented in case there is a breaking change. (eg: 2.5.8 -> 3.0.0)
# Minor should be incremented in case there is an enhancement. (eg: 2.5.8 -> 2.6.0)
# Patch should be incremented in case there is a bug fix. (eg: 2.5.8 -> 2.5.9)
__version__ = "2.0.0.dev2"
__version__ = "2.0.0.dev3"
12 changes: 7 additions & 5 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,10 @@
"Natural Language :: English",
"Programming Language :: Python",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.6",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Topic :: Software Development :: Build Tools",
],
keywords=["changelog", "CHANGELOG.md", "markdown"],
Expand All @@ -39,15 +39,17 @@
extras_require={
"testing": [
# Used to check starlette endpoint
"requests==2.*",
"starlette==0.16.*",
"httpx==0.23.*",
"starlette==0.21.*",
# Flask-Restx is buggy for now
"werkzeug==2.1.2",
# Used to check flask-restx endpoint
"flask-restx==0.5.*",
# Used to check coverage
"pytest-cov==2.*",
"pytest-cov==4.*",
]
},
python_requires=">=3.6",
python_requires=">=3.7",
project_urls={
"GitHub": "https://github.com/Colin-b/keepachangelog",
"Changelog": "https://github.com/Colin-b/keepachangelog/blob/master/CHANGELOG.md",
Expand Down
141 changes: 141 additions & 0 deletions tests/test_changelog_no_url.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,141 @@
import keepachangelog


changelog_as_text = """# 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.1.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## [1.2.0] - 2018-06-01
### Added
- Enhancement 1
- sub enhancement 1
- sub enhancement 2
- Enhancement 2
### Changed
- Release note 1.
- Release note 2.
### Deprecated
- Deprecated feature 1
- Future removal 2
### Fixed
- Bug fix 1
- sub bug 1
- sub bug 2
- Bug fix 2
### Removed
- Deprecated feature 2
- Future removal 1
### Security
- Known issue 1
- Known issue 2
## [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)
"""


changelog_as_dict = {
"1.2.0": {
"added": [
"Enhancement 1",
"sub enhancement 1",
"sub enhancement 2",
"Enhancement 2",
],
"changed": ["Release note 1.", "Release note 2."],
"deprecated": ["Deprecated feature 1", "Future removal 2"],
"fixed": ["Bug fix 1", "sub bug 1", "sub bug 2", "Bug fix 2"],
"removed": ["Deprecated feature 2", "Future removal 1"],
"security": ["Known issue 1", "Known issue 2"],
"metadata": {
"release_date": "2018-06-01",
"version": "1.2.0",
"semantic_version": {
"buildmetadata": None,
"major": 1,
"minor": 2,
"patch": 0,
"prerelease": None,
},
},
},
"1.1.0": {
"changed": [
"Enhancement 1 (1.1.0)",
"sub enhancement 1",
"sub enhancement 2",
"Enhancement 2 (1.1.0)",
],
"metadata": {
"release_date": "2018-05-31",
"version": "1.1.0",
"semantic_version": {
"buildmetadata": None,
"major": 1,
"minor": 1,
"patch": 0,
"prerelease": None,
},
},
},
"1.0.1": {
"fixed": [
"Bug fix 1 (1.0.1)",
"sub bug 1",
"sub bug 2",
"Bug fix 2 (1.0.1)",
],
"metadata": {
"release_date": "2018-05-31",
"version": "1.0.1",
"semantic_version": {
"buildmetadata": None,
"major": 1,
"minor": 0,
"patch": 1,
"prerelease": None,
},
},
},
"1.0.0": {
"deprecated": ["Known issue 1 (1.0.0)", "Known issue 2 (1.0.0)"],
"metadata": {
"release_date": "2017-04-10",
"version": "1.0.0",
"semantic_version": {
"buildmetadata": None,
"major": 1,
"minor": 0,
"patch": 0,
"prerelease": None,
},
},
},
}


def test_changelog_dont_have_2_newline_at_eof():
assert keepachangelog.from_dict(changelog_as_dict) == changelog_as_text

0 comments on commit 9d79410

Please sign in to comment.