From eacd368990fb95e244f0662eab63ea4a54257d85 Mon Sep 17 00:00:00 2001 From: "Xuan (Sean) Hu" Date: Mon, 20 May 2024 08:55:03 +0800 Subject: [PATCH] chore: remove unnecessary git-changelog related stuff (#552) --- .github/workflows/ci.yml | 5 --- .github/workflows/release.yml | 5 --- .gitignore | 1 - .readthedocs.yaml | 4 +- Makefile | 24 ++--------- README.md | 1 + docs/changelog.md | 5 --- docs/development/commit.md | 4 -- docs/index.md | 2 +- docs/management/release.md | 2 +- includes/variable.jinja | 15 ++++++- pdm.lock | 41 +------------------ pyproject.toml | 1 - template/.gitignore.jinja | 1 - template/.readthedocs.yaml.jinja | 4 +- template/Makefile.jinja | 24 ++--------- .../workflows/ci.yml.jinja | 5 --- .../workflows/release.yml.jinja | 5 --- template/docs/changelog.md | 5 --- template/docs/development/commit.md | 4 -- template/docs/index.md.jinja | 3 +- template/docs/management/release.md.jinja | 2 +- template/pyproject.toml.jinja | 1 - 23 files changed, 28 insertions(+), 136 deletions(-) delete mode 100644 docs/changelog.md delete mode 100644 template/docs/changelog.md diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 5acd6c5f..1bf949cc 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -26,16 +26,11 @@ jobs: cache: true python-version: ${{ matrix.python-version }} version: 2.15.2 - - id: pages - name: Setup pages - uses: actions/configure-pages@983d7736d9b0ae728b81ab479565c72886d7745b # v5.0.0 - run: env | sort - run: make dev - run: make lint - run: make test - run: make doc - env: - CI_PAGES_URL: ${{ steps.pages.outputs.base_url }} - run: make build strategy: matrix: diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 560a2228..95dc6de9 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -21,14 +21,9 @@ jobs: cache: true python-version: '3.12' version: 2.15.2 - - id: pages - name: Setup pages - uses: actions/configure-pages@983d7736d9b0ae728b81ab479565c72886d7745b # v5.0.0 - run: env | sort - run: make dev-doc - run: make doc - env: - CI_PAGES_URL: ${{ steps.pages.outputs.base_url }} - name: Upload pages artifact uses: actions/upload-pages-artifact@56afc609e74202658d3ffba0e8f6dda462b719fa # v3.0.1 with: diff --git a/.gitignore b/.gitignore index 04d811c4..888cd92a 100644 --- a/.gitignore +++ b/.gitignore @@ -4,7 +4,6 @@ .copier-answers.yml Pipfile public -release-notes.md # Byte-compiled / optimized / DLL files __pycache__/ diff --git a/.readthedocs.yaml b/.readthedocs.yaml index 98edbc6d..a40addee 100644 --- a/.readthedocs.yaml +++ b/.readthedocs.yaml @@ -25,13 +25,11 @@ build: - asdf global pdm 2.15.2 post_install: - VIRTUAL_ENV=$READTHEDOCS_VIRTUALENV_PATH make dev-doc - pre_build: - - VIRTUAL_ENV=$READTHEDOCS_VIRTUALENV_PATH CI_PAGES_URL=https://${READTHEDOCS_PROJECT}.readthedocs.io/${READTHEDOCS_LANGUAGE}/stable make changelog post_build: - VIRTUAL_ENV=$READTHEDOCS_VIRTUALENV_PATH make doc-mypy doc-coverage os: ubuntu-22.04 tools: - python: "3.12" + python: '3.12' sphinx: fail_on_warning: true version: 2 diff --git a/Makefile b/Makefile index 93a1bbe6..5e1b5d05 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,4 @@ -.PHONY: clean deepclean install dev mypy ruff ruff-format toml-sort lint pre-commit test-run test build publish doc-autobuild changelog doc-gen doc-mypy doc-coverage doc consistency +.PHONY: clean deepclean install dev mypy ruff ruff-format toml-sort lint pre-commit test-run test build publish doc-autobuild doc-gen doc-mypy doc-coverage doc consistency ######################################################################################## # Variables @@ -7,10 +7,6 @@ # Documentation target directory, will be adapted to specific folder for readthedocs. PUBLIC_DIR := $(shell [ "$$READTHEDOCS" = "True" ] && echo "$${READTHEDOCS_OUTPUT}html" || echo "public") -# URL and Path of changelog source code. -CHANGELOG_URL := $(shell echo $${CI_PAGES_URL:-https://serious-scaffold.github.io/ss-python}/_sources/changelog.md.txt) -CHANGELOG_PATH := docs/changelog.md - ######################################################################################## # Development Environment Management ######################################################################################## @@ -29,8 +25,7 @@ clean: __pypackages__ \ build \ coverage.xml \ - dist \ - release-notes.md + dist find . -name '*.egg-info' -print0 | xargs -0 rm -rf find . -name '*.pyc' -print0 | xargs -0 rm -f find . -name '*.swp' -print0 | xargs -0 rm -f @@ -120,19 +115,6 @@ doc-autobuild: --watch src \ -a -# Generate changelog from git commits. -# NOTE(xuan.hu): Need to be run before document generation to take effect. -changelog: - @if wget -q --spider $(CHANGELOG_URL); then \ - echo "Existing Changelog found at '$(CHANGELOG_URL)', download for incremental generation."; \ - wget -q -O $(CHANGELOG_PATH) $(CHANGELOG_URL); \ - fi - pdm run git-changelog -ETrio $(CHANGELOG_PATH) -c conventional -s build,chore,ci,doc,feat,fix,perf,refactor,revert,style,test - -# Generate release notes from changelog. -release-notes: - @pdm run git-changelog --input $(CHANGELOG_PATH) --release-notes - # Build documentation only from src. doc-gen: pdm run python -m sphinx.cmd.build docs $(PUBLIC_DIR) @@ -147,7 +129,7 @@ doc-coverage: test-run pdm run bash scripts/generate-coverage-badge.sh $(PUBLIC_DIR)/_static/badges # Generate all documentation with reports. -doc: changelog doc-gen doc-mypy doc-coverage +doc: doc-gen doc-mypy doc-coverage ######################################################################################## # Template diff --git a/README.md b/README.md index 2d6c9869..6af599cb 100644 --- a/README.md +++ b/README.md @@ -8,6 +8,7 @@ An evolving Python project template that covers the full development lifecycle. [![Release](https://github.com/serious-scaffold/ss-python/actions/workflows/release.yml/badge.svg)](https://github.com/serious-scaffold/ss-python/actions/workflows/release.yml) [![Renovate](https://github.com/serious-scaffold/ss-python/actions/workflows/renovate.yml/badge.svg)](https://github.com/serious-scaffold/ss-python/actions/workflows/renovate.yml) [![Coverage](https://img.shields.io/endpoint?url=https://serious-scaffold.github.io/ss-python/_static/badges/coverage.json)](https://serious-scaffold.github.io/ss-python/reports/coverage) +[![Release](https://img.shields.io/github/v/release/serious-scaffold/ss-python)](https://github.com/serious-scaffold/ss-python/releases) [![PyPI](https://img.shields.io/pypi/v/ss-python)](https://pypi.org/project/ss-python/) [![PyPI - Python Version](https://img.shields.io/pypi/pyversions/ss-python)](https://pypi.org/project/ss-python/) [![GitHub](https://img.shields.io/github/license/serious-scaffold/ss-python)](https://github.com/serious-scaffold/ss-python/blob/main/LICENSE) diff --git a/docs/changelog.md b/docs/changelog.md deleted file mode 100644 index eedc3af1..00000000 --- a/docs/changelog.md +++ /dev/null @@ -1,5 +0,0 @@ -# Changelog - - - - diff --git a/docs/development/commit.md b/docs/development/commit.md index f18c6653..0ae0469c 100644 --- a/docs/development/commit.md +++ b/docs/development/commit.md @@ -40,10 +40,6 @@ Scope [Optional] A "breaking change" refers to any modification that disrupts the existing functionality in a way that may affect users. It can be denoted using an exclamation mark (`!`) before the colon, like `refactor!: Stuff`. -```{note} -For more details, please refer to [the Angular convention](https://pawamoy.github.io/git-changelog/usage/#angularkarma-convention) and [the Conventional Commit convention](https://pawamoy.github.io/git-changelog/usage/#conventional-commit-convention) described in the documentation of `git-changelog`. -``` - ## Commit in Development Branches While the commit convention seems strict, we aim for flexibility during the development phase. diff --git a/docs/index.md b/docs/index.md index cf28b011..feb6e35c 100644 --- a/docs/index.md +++ b/docs/index.md @@ -9,7 +9,7 @@ advanced/index cli/index api/index reports/index -changelog +Changelog ``` ```{include} ../README.md diff --git a/docs/management/release.md b/docs/management/release.md index c4ba5f83..064e6d6e 100644 --- a/docs/management/release.md +++ b/docs/management/release.md @@ -1,6 +1,6 @@ # Release Process -The release process is primarily automated to ensure consistency and efficiency. The automation is mostly handled by GitHub Actions or GitLab CI/CD, with the help of tools like `git-changelog`. To ensure seamless execution, maintainers should follow specific guidelines and conventions throughout the development and release cycles. +The release process is primarily automated to ensure consistency and efficiency. The automation is mostly handled by GitHub Actions or GitLab CI/CD, with the help of [semantic-release](https://github.com/semantic-release/semantic-release). To ensure seamless execution, maintainers should follow specific guidelines and conventions throughout the development and release cycles. The release process includes the following tasks: diff --git a/includes/variable.jinja b/includes/variable.jinja index 41bec460..729daddd 100644 --- a/includes/variable.jinja +++ b/includes/variable.jinja @@ -51,10 +51,21 @@ [%- endif %] [%- endmacro %] +[% macro releases_url() -%] + [% if repo_platform == 'github' -%] + https://{{ repo_url() }}/releases + [%- elif repo_platform == 'gitlab' or repo_platform == 'gitlab-self-managed' -%] + https://{{ repo_url() }}/-/releases + [%- endif -%] +[%- endmacro %] + [% macro release_badge() -%] - [%- if repo_platform == 'gitlab' or repo_platform == 'gitlab-self-managed' -%] -[![Latest Release](https://{{ repo_url() }}/-/badges/release.svg)](https://{{ repo_url() }}/-/releases) + [% if repo_platform == 'github' -%] +[![Release](https://img.shields.io/github/v/release/{{ repo_namespace }}/{{ repo_name }})] + [%- elif repo_platform == 'gitlab' or repo_platform == 'gitlab-self-managed' -%] +[![Latest Release](https://{{ repo_url() }}/-/badges/release.svg)] [%- endif -%] +({{ releases_url()}}) [![PyPI](https://img.shields.io/pypi/v/{{ package_name }})](https://pypi.org/project/{{ package_name }}/) [%- endmacro %] diff --git a/pdm.lock b/pdm.lock index dc0e4837..eff11b4e 100644 --- a/pdm.lock +++ b/pdm.lock @@ -5,7 +5,7 @@ groups = ["default", "doc", "lint", "test"] strategy = ["cross_platform", "inherit_metadata"] lock_version = "4.4.1" -content_hash = "sha256:4fd9aa4e9711a299952841fa37180e053cc68269432fa66fcfa32cf20fee9b29" +content_hash = "sha256:e98ab3120cfcfd3c0c3163fc3e4dd560469da2131448be1a7c7d1b97721e8f65" [[package]] name = "alabaster" @@ -32,16 +32,6 @@ files = [ {file = "annotated_types-0.6.0.tar.gz", hash = "sha256:563339e807e53ffd9c267e99fc6d9ea23eb8443c08f112651963e24e22f84a5d"}, ] -[[package]] -name = "appdirs" -version = "1.4.4" -summary = "A small Python module for determining appropriate platform-specific dirs, e.g. a \"user data dir\"." -groups = ["doc"] -files = [ - {file = "appdirs-1.4.4-py2.py3-none-any.whl", hash = "sha256:a841dacd6b99318a741b166adb07e19ee71a274450e68237b4650ca1055ab128"}, - {file = "appdirs-1.4.4.tar.gz", hash = "sha256:7d5d0167b2b1ba821647616af46a749d1c653740dd0d2415100fe26e27afdf41"}, -] - [[package]] name = "autodoc-pydantic" version = "2.1.0" @@ -310,24 +300,6 @@ files = [ {file = "furo-2024.5.6.tar.gz", hash = "sha256:81f205a6605ebccbb883350432b4831c0196dd3d1bc92f61e1f459045b3d2b0b"}, ] -[[package]] -name = "git-changelog" -version = "2.5.2" -requires_python = ">=3.8" -summary = "Automatic Changelog generator using Jinja2 templates." -groups = ["doc"] -dependencies = [ - "Jinja2>=2.10", - "appdirs>=1.4", - "packaging>=24.0", - "semver>=2.13", - "tomli>=2.0; python_version < \"3.11\"", -] -files = [ - {file = "git_changelog-2.5.2-py3-none-any.whl", hash = "sha256:82eca31bd80fbd85e6b252fece82fe450706a7796b92c9d2c7f17c5944fe9ca7"}, - {file = "git_changelog-2.5.2.tar.gz", hash = "sha256:b71a404a524dc0b14a34f92d306ae011a05c5fcf7c78ee5b484af50ac44ced65"}, -] - [[package]] name = "idna" version = "3.6" @@ -1000,17 +972,6 @@ files = [ {file = "ruff-0.4.4.tar.gz", hash = "sha256:f87ea42d5cdebdc6a69761a9d0bc83ae9b3b30d0ad78952005ba6568d6c022af"}, ] -[[package]] -name = "semver" -version = "3.0.2" -requires_python = ">=3.7" -summary = "Python helper for Semantic Versioning (https://semver.org)" -groups = ["doc"] -files = [ - {file = "semver-3.0.2-py3-none-any.whl", hash = "sha256:b1ea4686fe70b981f85359eda33199d60c53964284e0cfb4977d243e37cf4bf4"}, - {file = "semver-3.0.2.tar.gz", hash = "sha256:6253adb39c70f6e51afed2fa7152bcd414c411286088fb4b9effb133885ab4cc"}, -] - [[package]] name = "shellingham" version = "1.5.4" diff --git a/pyproject.toml b/pyproject.toml index 7c40307d..9c1936b9 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -78,7 +78,6 @@ doc = [ "autodoc-pydantic", "coverage", "furo", - "git-changelog", "mypy[reports]", "myst-parser", "pytest", diff --git a/template/.gitignore.jinja b/template/.gitignore.jinja index 9eaf518c..8f0885cc 100644 --- a/template/.gitignore.jinja +++ b/template/.gitignore.jinja @@ -6,7 +6,6 @@ [%- endif %] Pipfile public -release-notes.md # Byte-compiled / optimized / DLL files __pycache__/ diff --git a/template/.readthedocs.yaml.jinja b/template/.readthedocs.yaml.jinja index 9e4a3a62..4f1f5f1e 100644 --- a/template/.readthedocs.yaml.jinja +++ b/template/.readthedocs.yaml.jinja @@ -25,13 +25,11 @@ build: - asdf global pdm 2.15.2 post_install: - VIRTUAL_ENV=$READTHEDOCS_VIRTUALENV_PATH make dev-doc - pre_build: - - VIRTUAL_ENV=$READTHEDOCS_VIRTUALENV_PATH CI_PAGES_URL=https://${READTHEDOCS_PROJECT}.readthedocs.io/${READTHEDOCS_LANGUAGE}/stable make changelog post_build: - VIRTUAL_ENV=$READTHEDOCS_VIRTUALENV_PATH make doc-mypy doc-coverage os: ubuntu-22.04 tools: - python: "{{ default_py }}" + python: '{{ default_py }}' sphinx: fail_on_warning: true version: 2 diff --git a/template/Makefile.jinja b/template/Makefile.jinja index f5ec8191..955dc121 100644 --- a/template/Makefile.jinja +++ b/template/Makefile.jinja @@ -1,5 +1,5 @@ [% from pathjoin("includes", "variable.jinja") import page_url with context -%] -.PHONY: clean deepclean install dev mypy ruff ruff-format toml-sort lint pre-commit test-run test build publish doc-autobuild changelog doc-gen doc-mypy doc-coverage doc +.PHONY: clean deepclean install dev mypy ruff ruff-format toml-sort lint pre-commit test-run test build publish doc-autobuild doc-gen doc-mypy doc-coverage doc [%- if project_name == "Serious Scaffold Python" %] consistency[% endif %] ######################################################################################## @@ -9,10 +9,6 @@ # Documentation target directory, will be adapted to specific folder for readthedocs. PUBLIC_DIR := $(shell [ "$$READTHEDOCS" = "True" ] && echo "$${READTHEDOCS_OUTPUT}html" || echo "public") -# URL and Path of changelog source code. -CHANGELOG_URL := $(shell echo $${CI_PAGES_URL:-https://{{ page_url() }}}/_sources/changelog.md.txt) -CHANGELOG_PATH := docs/changelog.md - ######################################################################################## # Development Environment Management ######################################################################################## @@ -31,8 +27,7 @@ clean: __pypackages__ \ build \ coverage.xml \ - dist \ - release-notes.md + dist find . -name '*.egg-info' -print0 | xargs -0 rm -rf find . -name '*.pyc' -print0 | xargs -0 rm -f find . -name '*.swp' -print0 | xargs -0 rm -f @@ -122,19 +117,6 @@ doc-autobuild: --watch src \ -a -# Generate changelog from git commits. -# NOTE(xuan.hu): Need to be run before document generation to take effect. -changelog: - @if wget -q --spider $(CHANGELOG_URL); then \ - echo "Existing Changelog found at '$(CHANGELOG_URL)', download for incremental generation."; \ - wget -q -O $(CHANGELOG_PATH) $(CHANGELOG_URL); \ - fi - pdm run git-changelog -ETrio $(CHANGELOG_PATH) -c conventional -s build,chore,ci,doc,feat,fix,perf,refactor,revert,style,test - -# Generate release notes from changelog. -release-notes: - @pdm run git-changelog --input $(CHANGELOG_PATH) --release-notes - # Build documentation only from src. doc-gen: pdm run python -m sphinx.cmd.build docs $(PUBLIC_DIR) @@ -149,7 +131,7 @@ doc-coverage: test-run pdm run bash scripts/generate-coverage-badge.sh $(PUBLIC_DIR)/_static/badges # Generate all documentation with reports. -doc: changelog doc-gen doc-mypy doc-coverage +doc: doc-gen doc-mypy doc-coverage [% if project_name == "Serious Scaffold Python" -%] ######################################################################################## diff --git a/template/[% if repo_platform == 'github' %].github[% endif %]/workflows/ci.yml.jinja b/template/[% if repo_platform == 'github' %].github[% endif %]/workflows/ci.yml.jinja index d27a536e..f82d2f08 100644 --- a/template/[% if repo_platform == 'github' %].github[% endif %]/workflows/ci.yml.jinja +++ b/template/[% if repo_platform == 'github' %].github[% endif %]/workflows/ci.yml.jinja @@ -27,16 +27,11 @@ jobs: cache: true python-version: {{ '${{ matrix.python-version }}' }} version: 2.15.2 - - id: pages - name: Setup pages - uses: actions/configure-pages@983d7736d9b0ae728b81ab479565c72886d7745b # v5.0.0 - run: env | sort - run: make dev - run: make lint - run: make test - run: make doc - env: - CI_PAGES_URL: {{ '${{ steps.pages.outputs.base_url }}' }} - run: make build strategy: matrix: diff --git a/template/[% if repo_platform == 'github' %].github[% endif %]/workflows/release.yml.jinja b/template/[% if repo_platform == 'github' %].github[% endif %]/workflows/release.yml.jinja index d4dccaf6..d1c57934 100644 --- a/template/[% if repo_platform == 'github' %].github[% endif %]/workflows/release.yml.jinja +++ b/template/[% if repo_platform == 'github' %].github[% endif %]/workflows/release.yml.jinja @@ -22,14 +22,9 @@ jobs: cache: true python-version: '{{ default_py }}' version: 2.15.2 - - id: pages - name: Setup pages - uses: actions/configure-pages@983d7736d9b0ae728b81ab479565c72886d7745b # v5.0.0 - run: env | sort - run: make dev-doc - run: make doc - env: - CI_PAGES_URL: {{ '${{ steps.pages.outputs.base_url }}' }} - name: Upload pages artifact uses: actions/upload-pages-artifact@56afc609e74202658d3ffba0e8f6dda462b719fa # v3.0.1 with: diff --git a/template/docs/changelog.md b/template/docs/changelog.md deleted file mode 100644 index eedc3af1..00000000 --- a/template/docs/changelog.md +++ /dev/null @@ -1,5 +0,0 @@ -# Changelog - - - - diff --git a/template/docs/development/commit.md b/template/docs/development/commit.md index f18c6653..0ae0469c 100644 --- a/template/docs/development/commit.md +++ b/template/docs/development/commit.md @@ -40,10 +40,6 @@ Scope [Optional] A "breaking change" refers to any modification that disrupts the existing functionality in a way that may affect users. It can be denoted using an exclamation mark (`!`) before the colon, like `refactor!: Stuff`. -```{note} -For more details, please refer to [the Angular convention](https://pawamoy.github.io/git-changelog/usage/#angularkarma-convention) and [the Conventional Commit convention](https://pawamoy.github.io/git-changelog/usage/#conventional-commit-convention) described in the documentation of `git-changelog`. -``` - ## Commit in Development Branches While the commit convention seems strict, we aim for flexibility during the development phase. diff --git a/template/docs/index.md.jinja b/template/docs/index.md.jinja index 57736396..c882388a 100644 --- a/template/docs/index.md.jinja +++ b/template/docs/index.md.jinja @@ -1,3 +1,4 @@ +[% from pathjoin("includes", "variable.jinja") import releases_url with context -%] # Welcome to {{ project_name }}'s documentation ```{toctree} @@ -9,7 +10,7 @@ advanced/index cli/index api/index reports/index -changelog +Changelog <{{ releases_url() }}> ``` ```{include} ../README.md diff --git a/template/docs/management/release.md.jinja b/template/docs/management/release.md.jinja index 8d8b6bd8..4a76df62 100644 --- a/template/docs/management/release.md.jinja +++ b/template/docs/management/release.md.jinja @@ -1,6 +1,6 @@ # Release Process -The release process is primarily automated to ensure consistency and efficiency. The automation is mostly handled by GitHub Actions or GitLab CI/CD, with the help of tools like `git-changelog`. To ensure seamless execution, maintainers should follow specific guidelines and conventions throughout the development and release cycles. +The release process is primarily automated to ensure consistency and efficiency. The automation is mostly handled by GitHub Actions or GitLab CI/CD, with the help of [semantic-release](https://github.com/semantic-release/semantic-release). To ensure seamless execution, maintainers should follow specific guidelines and conventions throughout the development and release cycles. The release process includes the following tasks: diff --git a/template/pyproject.toml.jinja b/template/pyproject.toml.jinja index d270fbb9..6e5484b0 100644 --- a/template/pyproject.toml.jinja +++ b/template/pyproject.toml.jinja @@ -119,7 +119,6 @@ doc = [ "autodoc-pydantic", "coverage", "furo", - "git-changelog", "mypy[reports]", "myst-parser", "pytest",