Skip to content

Commit

Permalink
Merge pull request #27 from brainelectronics/feature/parse-meta-data
Browse files Browse the repository at this point in the history
Use snippets2changelog
  • Loading branch information
brainelectronics authored Oct 4, 2024
2 parents 1cd1542 + 92b1221 commit e499cd4
Show file tree
Hide file tree
Showing 16 changed files with 69 additions and 27 deletions.
13 changes: 11 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,25 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v4
with:
# all history is needed to crawl it properly
fetch-depth: 0
- name: Set up Python
uses: actions/setup-python@v3
uses: actions/setup-python@v5
with:
python-version: '3.9'
- name: Install build and deploy dependencies
run: |
python -m pip install -U setuptools wheel build
if [ -f requirements-deploy.txt ]; then pip install -r requirements-deploy.txt; fi
pip install .
- name: Update changelog with snippets
run: |
changelog-generator \
changelog changelog.md \
--snippets=.snippets \
--in-place
- name: Parse changelog
id: parse_changelog
run: |
Expand Down
13 changes: 11 additions & 2 deletions .github/workflows/test-release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,25 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v4
with:
# all history is needed to crawl it properly
fetch-depth: 0
- name: Set up Python
uses: actions/setup-python@v3
uses: actions/setup-python@v5
with:
python-version: '3.9'
- name: Install deploy dependencies
run: |
python -m pip install -U setuptools wheel build
if [ -f requirements-deploy.txt ]; then pip install -r requirements-deploy.txt; fi
pip install .
- name: Update changelog with snippets
run: |
changelog-generator \
changelog changelog.md \
--snippets=.snippets \
--in-place
- name: Parse changelog
id: parse_changelog
run: |
Expand Down
15 changes: 12 additions & 3 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,16 @@ jobs:
# runs-on: ${{ matrix.os }}
strategy:
matrix:
python-version: ['3.8', '3.9', '3.10', '3.11']
python-version: ['3.9', '3.10', '3.11']
# os: [ubuntu-latest, macos-latest, windows-latest]
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
# all history is needed to crawl it properly
fetch-depth: 0
- name: Set up Python
uses: actions/setup-python@v3
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
# python-version: '3.9'
Expand All @@ -43,6 +46,12 @@ jobs:
python -m pip install -U setuptools wheel build
if [ -f requirements-deploy.txt ]; then pip install -r requirements-deploy.txt; fi
pip install .
- name: Update changelog with snippets
run: |
changelog-generator \
changelog changelog.md \
--snippets=.snippets \
--in-place
- name: Build package
run: |
changelog2version \
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/unittest.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ jobs:
test-and-coverage:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v3
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.9'
- name: Execute tests
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ examples/*.c
examples/*.h
examples/*.py
examples/version_info
changelog.json

# custom, package specific ignores
.DS_Store
Expand Down
12 changes: 12 additions & 0 deletions .snippets/26.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
## Use snippets2changelog
<!--
type: feature
scope: all
affected: all
-->

- run isort on all files
- drop Python 3.8 support everywhere and update README badge
- add generated `changelog.json` file to `.gitignore`
- use latest `actions/checkout@v4` and `actions/setup-python@v5`
- use `snippets2changelog` package, closes #26
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

[![Downloads](https://pepy.tech/badge/changelog2version)](https://pepy.tech/project/changelog2version)
![Release](https://img.shields.io/github/v/release/brainelectronics/changelog2version?include_prereleases&color=success)
![Python](https://img.shields.io/badge/python3-Ok-green.svg)
![Python](https://img.shields.io/badge/Python-3.9%20|%203.10%20|%203.11-green.svg)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
[![codecov](https://codecov.io/github/brainelectronics/changelog2version/branch/main/graph/badge.svg)](https://app.codecov.io/github/brainelectronics/changelog2version)

Expand Down
2 changes: 1 addition & 1 deletion create_report_dirs.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#!/usr/bin/env python3
"""Create test report directories."""
from pathlib import Path
import os
import shutil
from pathlib import Path

if os.path.exists('reports'):
shutil.rmtree('reports', ignore_errors=True)
Expand Down
1 change: 1 addition & 0 deletions requirements-deploy.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@
# Avoid fixed versions
# # to upload package to PyPi or other package hosts
twine>=5.1.1,<6
snippets2changelog>=1.2.1,<2
2 changes: 0 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,6 @@
# that you indicate you support Python 3. These classifiers are *not*
# checked by 'pip install'. See instead 'python_requires' below.
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
Expand Down
5 changes: 3 additions & 2 deletions src/changelog2version/extract_version.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,13 @@
"""

import logging
from pathlib import Path
import re
from semver import VersionInfo
from pathlib import Path
from sys import stdout
from typing import List, Optional

from semver import VersionInfo


class ExtractVersionError(Exception):
"""Base class for exceptions in this module."""
Expand Down
3 changes: 2 additions & 1 deletion src/changelog2version/render_version_file.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,12 @@

"""Render version file based on template"""

from jinja2 import Environment, FileSystemLoader
import logging
from pathlib import Path
from typing import Optional, Union

from jinja2 import Environment, FileSystemLoader

from .extract_version import ExtractVersion


Expand Down
7 changes: 4 additions & 3 deletions src/changelog2version/update_version.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,15 @@

import argparse
import fileinput
from hashlib import sha1
import json
import logging
from pathlib import Path
import re
import semver
from hashlib import sha1
from pathlib import Path
from sys import stdout

import semver

from .extract_version import ExtractVersion
from .render_version_file import RenderVersionFile
from .version import __version__
Expand Down
12 changes: 6 additions & 6 deletions tests/test_extract_version.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,16 @@
"""Unittest for testing the extract_version file"""

import logging
from nose2.tools import params
import unittest
from pathlib import Path
from semver import VersionInfo
from sys import stdout
from typing import List
import unittest
from unittest.mock import patch, mock_open
from unittest.mock import mock_open, patch

from changelog2version.extract_version import ExtractVersion, \
ExtractVersionError
from changelog2version.extract_version import (ExtractVersion,
ExtractVersionError)
from nose2.tools import params
from semver import VersionInfo


class TestExtractVersion(unittest.TestCase):
Expand Down
2 changes: 1 addition & 1 deletion tests/test_update_version.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
"""Unittest for testing the update_version file"""

import logging
import unittest
from pathlib import Path
from sys import stdout
import unittest


class TestUpdateVersion(unittest.TestCase):
Expand Down
2 changes: 1 addition & 1 deletion tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
# and also to help confirm pull requests to this project.

[tox]
envlist = py{37,38,39,310}
envlist = py{39,310,311}

# Define the minimal tox version required to run;
# if the host tox is less than this the tool with create an environment and
Expand Down

0 comments on commit e499cd4

Please sign in to comment.