From b1224f609c5a4b382e86bca67aa875244685a764 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sun, 1 Feb 2026 21:19:38 +0000 Subject: [PATCH 1/5] Initial plan From 815dfde40c7e8acbd5088d89a75a39659d1b958a Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sun, 1 Feb 2026 21:24:01 +0000 Subject: [PATCH 2/5] Add CITATION.cff and codemeta.json to bumpversion config; update release docs Co-authored-by: bact <128572+bact@users.noreply.github.com> --- CONTRIBUTING.md | 4 +- pyproject.toml | 10 +++ release.md | 152 +++++++++++++++++++++++++++++++++++++--------- release.md.backup | 45 ++++++++++++++ 4 files changed, 180 insertions(+), 31 deletions(-) create mode 100644 release.md.backup diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 113fe2aba..06911142c 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -175,10 +175,10 @@ This will create distribution packages in the `dist/` directory. #current_version = 2.3.3 bump-my-version bump patch - #current_version = 2.3.6-dev0 + #current_version = 2.3.4-dev0 bump-my-version bump minor - #current_version = 2.3.1-dev0 + #current_version = 2.4.0-dev0 bump-my-version bump build #current_version = 2.3.1-dev1 diff --git a/pyproject.toml b/pyproject.toml index d93d8f9ae..3b2913dd7 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -275,6 +275,16 @@ filename = "pythainlp/__init__.py" search = '__version__ = "{current_version}"' replace = '__version__ = "{new_version}"' +[[tool.bumpversion.files]] +filename = "CITATION.cff" +search = 'version: {current_version}' +replace = 'version: {new_version}' + +[[tool.bumpversion.files]] +filename = "codemeta.json" +search = '"version": "{current_version}"' +replace = '"version": "{new_version}"' + [tool.bumpversion.parts.release] optional_value = "prod" first_value = "dev" diff --git a/release.md b/release.md index b1682a410..88c4c8a1c 100644 --- a/release.md +++ b/release.md @@ -6,39 +6,133 @@ SPDX-License-Identifier: CC0-1.0 # How to cut a new release -0. Check if the package can be built properly. - Include "[cd build]" in the commit message to trigger wheel building. -1. Update `CHANGELOG.md` with a short summary of important changes since - the previous stable release. - For example, deprecation or termination of support. -2. This project follows [semantic versioning][semver]. - Ensure the version and release date fields in these files - have been updated to the version of the new planned release: - - `codemeta.json` - - `pyproject.toml` - - `CHANGELOG.md` - - `CITATION.cff` (will auto-generated from `codemeta.json`) - - `README.md` - - `README.TH.md` -4. Navigate to the [releases page][releases] and click the +This project follows [semantic versioning][semver]. + +## Prerequisites + +Install development dependencies including `bump-my-version`: + +```sh +pip install -e ".[dev]" +``` + +## Release Process + +1. **Check if the package can be built properly** + + Build the package locally to ensure there are no build errors: + + ```sh + python -m build + ``` + + You can also include `[cd build]` in a commit message to trigger wheel + building in CI. + +2. **Update CHANGELOG.md** + + Update `CHANGELOG.md` with a short summary of important changes since + the previous stable release. For example, deprecation or termination + of support. Follow the [Keep a Changelog][keepachangelog] format. + +3. **Update version using bump-my-version** + + We use [`bump-my-version`][bump-my-version] to manage version numbers. + The configuration is in `pyproject.toml` under `[tool.bumpversion]`. + + Version format: `MAJOR.MINOR.PATCH[-RELEASE][BUILD]` + where RELEASE can be `dev`, `beta`, or omitted (production). + + **To bump the version:** + + ```sh + # For a patch release (e.g., 5.2.0 -> 5.2.1-dev0) + bump-my-version bump patch + + # For a minor release (e.g., 5.2.0 -> 5.3.0-dev0) + bump-my-version bump minor + + # For a major release (e.g., 5.2.0 -> 6.0.0-dev0) + bump-my-version bump major + + # To move from dev to beta (e.g., 5.2.1-dev0 -> 5.2.1-beta0) + bump-my-version bump release + + # To move from beta to production (e.g., 5.2.1-beta0 -> 5.2.1) + bump-my-version bump release + + # To increment build number (e.g., 5.2.1-dev0 -> 5.2.1-dev1) + bump-my-version bump build + ``` + + This command will automatically update version numbers in: + - `pyproject.toml` + - `pythainlp/__init__.py` + - `CITATION.cff` + - `codemeta.json` + + It will also create a git commit and tag by default. + +4. **Update release date in metadata files** + + After bumping the version, manually update the release date fields: + - `codemeta.json`: Update `dateModified` field + - `CITATION.cff`: Update `date-released` field + +5. **Update README files if needed** + + If the release introduces significant changes, update: + - `README.md` + - `README_TH.md` + +6. **Push changes and tag** + + ```sh + git push origin dev + git push origin --tags + ``` + +7. **Create GitHub Release** + + Navigate to the [releases page][releases] and click the "Draft a new release" button. Only project maintainers are able to perform this step. -5. Then enter the new tag in the "Choose a tag" box. - The tag should begin with "v", as in, for instance, `v5.0.1`. -6. The release title should be the same as the new version tag. - For instance, the title could be `v5.0.1`. -7. Add a short summary of important changes since the previous stable - release. - _This should be similar to what has been logged in `CHANGELOG.md`._ - Then click the "Generate release notes" button. -8. You can optionally include any particular thank-yous to contributors or - reviewers in a note at the bottom of the release. -9. You can then click "Publish release" button. -10. If [the CI][ci] run is [successful][actions], - then the release will be published on both - the GitHub release page and the [Python Package Index][pypi]. + +8. **Select the tag** + + In the "Choose a tag" dropdown, select the tag that was created by + `bump-my-version` (e.g., `v5.2.1`). Tags follow the format `vMAJOR.MINOR.PATCH`. + +9. **Set release title** + + The release title should be the same as the version tag + (e.g., `v5.2.1`). + +10. **Add release notes** + + Add a short summary of important changes since the previous stable + release. This should be similar to what has been logged in `CHANGELOG.md`. + Then click the "Generate release notes" button to auto-generate + contributor information. + +11. **Optional: Thank contributors** + + You can optionally include any particular thank-yous to contributors or + reviewers in a note at the bottom of the release. + +12. **Publish the release** + + Click the "Publish release" button. + +13. **Verify CI/CD** + + If [the CI][ci] run is [successful][actions], + then the release will be published on both + the GitHub release page and the [Python Package Index][pypi]. [semver]: https://semver.org/ +[keepachangelog]: https://keepachangelog.com/en/1.0.0/ +[bump-my-version]: https://github.com/callowayproject/bump-my-version [releases]: https://github.com/PyThaiNLP/pythainlp/releases [ci]: https://github.com/PyThaiNLP/pythainlp/blob/dev/.github/workflows/pypi-publish.yml [actions]: https://github.com/PyThaiNLP/pythainlp/actions/workflows/pypi-publish.yml diff --git a/release.md.backup b/release.md.backup new file mode 100644 index 000000000..b1682a410 --- /dev/null +++ b/release.md.backup @@ -0,0 +1,45 @@ +--- +SPDX-FileCopyrightText: 2025-2026 PyThaiNLP Project +SPDX-FileType: DOCUMENTATION +SPDX-License-Identifier: CC0-1.0 +--- + +# How to cut a new release + +0. Check if the package can be built properly. + Include "[cd build]" in the commit message to trigger wheel building. +1. Update `CHANGELOG.md` with a short summary of important changes since + the previous stable release. + For example, deprecation or termination of support. +2. This project follows [semantic versioning][semver]. + Ensure the version and release date fields in these files + have been updated to the version of the new planned release: + - `codemeta.json` + - `pyproject.toml` + - `CHANGELOG.md` + - `CITATION.cff` (will auto-generated from `codemeta.json`) + - `README.md` + - `README.TH.md` +4. Navigate to the [releases page][releases] and click the + "Draft a new release" button. + Only project maintainers are able to perform this step. +5. Then enter the new tag in the "Choose a tag" box. + The tag should begin with "v", as in, for instance, `v5.0.1`. +6. The release title should be the same as the new version tag. + For instance, the title could be `v5.0.1`. +7. Add a short summary of important changes since the previous stable + release. + _This should be similar to what has been logged in `CHANGELOG.md`._ + Then click the "Generate release notes" button. +8. You can optionally include any particular thank-yous to contributors or + reviewers in a note at the bottom of the release. +9. You can then click "Publish release" button. +10. If [the CI][ci] run is [successful][actions], + then the release will be published on both + the GitHub release page and the [Python Package Index][pypi]. + +[semver]: https://semver.org/ +[releases]: https://github.com/PyThaiNLP/pythainlp/releases +[ci]: https://github.com/PyThaiNLP/pythainlp/blob/dev/.github/workflows/pypi-publish.yml +[actions]: https://github.com/PyThaiNLP/pythainlp/actions/workflows/pypi-publish.yml +[pypi]: https://pypi.org/project/pythainlp/ From 483377f35a496539654450224ed395db599850fb Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sun, 1 Feb 2026 21:26:49 +0000 Subject: [PATCH 3/5] Fix trailing space in dev dependencies and add build package Co-authored-by: bact <128572+bact@users.noreply.github.com> --- pyproject.toml | 3 ++- release.md.backup | 45 --------------------------------------------- 2 files changed, 2 insertions(+), 46 deletions(-) delete mode 100644 release.md.backup diff --git a/pyproject.toml b/pyproject.toml index 3b2913dd7..25e72d3e5 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -70,7 +70,8 @@ dependencies = [ # Development and testing dependencies dev = [ "black>=25.11.0", - "bump-my-version>=1.2.6 ", + "build>=1.0.0", + "bump-my-version>=1.2.6", "coverage>=7.10.7", "flake8>=7.3.0", "ruff>=0.14.14", diff --git a/release.md.backup b/release.md.backup deleted file mode 100644 index b1682a410..000000000 --- a/release.md.backup +++ /dev/null @@ -1,45 +0,0 @@ ---- -SPDX-FileCopyrightText: 2025-2026 PyThaiNLP Project -SPDX-FileType: DOCUMENTATION -SPDX-License-Identifier: CC0-1.0 ---- - -# How to cut a new release - -0. Check if the package can be built properly. - Include "[cd build]" in the commit message to trigger wheel building. -1. Update `CHANGELOG.md` with a short summary of important changes since - the previous stable release. - For example, deprecation or termination of support. -2. This project follows [semantic versioning][semver]. - Ensure the version and release date fields in these files - have been updated to the version of the new planned release: - - `codemeta.json` - - `pyproject.toml` - - `CHANGELOG.md` - - `CITATION.cff` (will auto-generated from `codemeta.json`) - - `README.md` - - `README.TH.md` -4. Navigate to the [releases page][releases] and click the - "Draft a new release" button. - Only project maintainers are able to perform this step. -5. Then enter the new tag in the "Choose a tag" box. - The tag should begin with "v", as in, for instance, `v5.0.1`. -6. The release title should be the same as the new version tag. - For instance, the title could be `v5.0.1`. -7. Add a short summary of important changes since the previous stable - release. - _This should be similar to what has been logged in `CHANGELOG.md`._ - Then click the "Generate release notes" button. -8. You can optionally include any particular thank-yous to contributors or - reviewers in a note at the bottom of the release. -9. You can then click "Publish release" button. -10. If [the CI][ci] run is [successful][actions], - then the release will be published on both - the GitHub release page and the [Python Package Index][pypi]. - -[semver]: https://semver.org/ -[releases]: https://github.com/PyThaiNLP/pythainlp/releases -[ci]: https://github.com/PyThaiNLP/pythainlp/blob/dev/.github/workflows/pypi-publish.yml -[actions]: https://github.com/PyThaiNLP/pythainlp/actions/workflows/pypi-publish.yml -[pypi]: https://pypi.org/project/pythainlp/ From 7537ab9accad4ac67fcd189ba0f907b386884fcb Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sun, 1 Feb 2026 21:39:57 +0000 Subject: [PATCH 4/5] Automate release date updates in CITATION.cff and codemeta.json Co-authored-by: bact <128572+bact@users.noreply.github.com> --- pyproject.toml | 12 ++++++++++++ release.md | 37 +++++++++++++++++-------------------- 2 files changed, 29 insertions(+), 20 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 25e72d3e5..0bcd4ab56 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -281,11 +281,23 @@ filename = "CITATION.cff" search = 'version: {current_version}' replace = 'version: {new_version}' +[[tool.bumpversion.files]] +filename = "CITATION.cff" +regex = true +search = 'date-released: \d{{4}}-\d{{2}}-\d{{2}}' +replace = 'date-released: {now:%Y-%m-%d}' + [[tool.bumpversion.files]] filename = "codemeta.json" search = '"version": "{current_version}"' replace = '"version": "{new_version}"' +[[tool.bumpversion.files]] +filename = "codemeta.json" +regex = true +search = '"dateModified": "\d{{4}}-\d{{2}}-\d{{2}}"' +replace = '"dateModified": "{now:%Y-%m-%d}"' + [tool.bumpversion.parts.release] optional_value = "prod" first_value = "dev" diff --git a/release.md b/release.md index 88c4c8a1c..de3c69f23 100644 --- a/release.md +++ b/release.md @@ -65,66 +65,63 @@ pip install -e ".[dev]" bump-my-version bump build ``` - This command will automatically update version numbers in: - - `pyproject.toml` - - `pythainlp/__init__.py` - - `CITATION.cff` - - `codemeta.json` + This command will automatically update version numbers and release dates in: + - `pyproject.toml` - version number + - `pythainlp/__init__.py` - version number + - `CITATION.cff` - version number and `date-released` field + - `codemeta.json` - version number and `dateModified` field - It will also create a git commit and tag by default. - -4. **Update release date in metadata files** + The release dates are automatically set to the current date when you run + the bump command. - After bumping the version, manually update the release date fields: - - `codemeta.json`: Update `dateModified` field - - `CITATION.cff`: Update `date-released` field + It will also create a git commit and tag by default. -5. **Update README files if needed** +4. **Update README files if needed** If the release introduces significant changes, update: - `README.md` - `README_TH.md` -6. **Push changes and tag** +5. **Push changes and tag** ```sh git push origin dev git push origin --tags ``` -7. **Create GitHub Release** +6. **Create GitHub Release** Navigate to the [releases page][releases] and click the "Draft a new release" button. Only project maintainers are able to perform this step. -8. **Select the tag** +7. **Select the tag** In the "Choose a tag" dropdown, select the tag that was created by `bump-my-version` (e.g., `v5.2.1`). Tags follow the format `vMAJOR.MINOR.PATCH`. -9. **Set release title** +8. **Set release title** The release title should be the same as the version tag (e.g., `v5.2.1`). -10. **Add release notes** +9. **Add release notes** Add a short summary of important changes since the previous stable release. This should be similar to what has been logged in `CHANGELOG.md`. Then click the "Generate release notes" button to auto-generate contributor information. -11. **Optional: Thank contributors** +10. **Optional: Thank contributors** You can optionally include any particular thank-yous to contributors or reviewers in a note at the bottom of the release. -12. **Publish the release** +11. **Publish the release** Click the "Publish release" button. -13. **Verify CI/CD** +12. **Verify CI/CD** If [the CI][ci] run is [successful][actions], then the release will be published on both From 56be1a20d530932c99e107bcd5ec068574b820d6 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sun, 1 Feb 2026 21:50:00 +0000 Subject: [PATCH 5/5] Fix incorrect version in CONTRIBUTING.md build bump example Co-authored-by: bact <128572+bact@users.noreply.github.com> --- CONTRIBUTING.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 06911142c..94f728e47 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -181,7 +181,7 @@ This will create distribution packages in the `dist/` directory. #current_version = 2.4.0-dev0 bump-my-version bump build - #current_version = 2.3.1-dev1 + #current_version = 2.4.0-dev1 bump-my-version bump major #current_version = 3.0.0-dev0