From 567e5350f9b4a4a72469e5ced49e7d45a8154941 Mon Sep 17 00:00:00 2001 From: Arthit Suriyawongkul Date: Tue, 11 Feb 2025 03:03:22 +0700 Subject: [PATCH 1/6] Update upload/download-artifact actions Signed-off-by: Arthit Suriyawongkul --- .github/workflows/pypi-publish.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/pypi-publish.yml b/.github/workflows/pypi-publish.yml index 73013b0e3..f3a27c644 100644 --- a/.github/workflows/pypi-publish.yml +++ b/.github/workflows/pypi-publish.yml @@ -1,4 +1,5 @@ # SPDX-FileCopyrightText: 2016-2025 PyThaiNLP Project +# SPDX-FileType: SOURCE # SPDX-License-Identifier: CC0-1.0 name: Build and publish to PyPI @@ -66,7 +67,7 @@ jobs: run: twine check dist/* - name: Store distributions - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: path: dist @@ -77,7 +78,7 @@ jobs: if: github.event_name == 'release' && github.event.action == 'published' steps: - name: Retrieve distributions - uses: actions/download-artifact@v3 + uses: actions/download-artifact@v4 with: name: artifact path: dist From be76c9ebb24bd6c34f6cf7bbd7b962f5c45671c7 Mon Sep 17 00:00:00 2001 From: Arthit Suriyawongkul Date: Tue, 11 Feb 2025 03:34:09 +0700 Subject: [PATCH 2/6] Update release.md - Add how to trigger wheel building - Make contributing.md more of Markdown Signed-off-by: Arthit Suriyawongkul --- CONTRIBUTING.md | 6 ++---- release.md | 11 +++++++---- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index a79385a18..0e5b089d7 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -18,7 +18,7 @@ Please refer to our [Contributor Covenant Code of Conduct](https://github.com/Py - Name identifiers (variables, classes, functions, module names) with meaningful and pronounceable names (`x` is always wrong); - Please follow this [naming convention](https://namingconvention.org/python/). For example, global constant variables must be in `ALL_CAPS`; - + ![Naming Convention](https://i.stack.imgur.com/uBr10.png) - Write tests for your new features. The test suite is in `tests/` directory. (see "Testing" section below); - Run all tests before pushing (just execute `tox`) so you will know if your changes broke something; @@ -131,9 +131,7 @@ See more in [tests/README.md](./tests/README.md) ## Credits - - - +[![Contributors](https://contributors-img.firebaseapp.com/image?repo=PyThaiNLP/pythainlp)](https://github.com/PyThaiNLP/pythainlp/graphs/contributors) Thanks to all [contributors](https://github.com/PyThaiNLP/pythainlp/graphs/contributors). (Image made with [contributors-img](https://contributors-img.firebaseapp.com)) diff --git a/release.md b/release.md index 81b4e3dd2..5b010abb4 100644 --- a/release.md +++ b/release.md @@ -1,7 +1,9 @@ # How to cut a new release -0. This project follows [semantic versioning][semver]. -1. Ensure the version and release date fields (if any) in these files +0. Check if the package can be built properly. + Add the prefix "[cd build]" to the commit message to trigger wheel building. +1. This project follows [semantic versioning][semver]. + Ensure the version and release date fields (if any) in these files have been updated to the version of the new planned release: - `pyproject.toml` - `setup.cfg` @@ -11,7 +13,7 @@ - `README.TH.md` - `CHANGELOG.md` 2. Navigate to the - [releases page][releases] and + [releases page][releases] and click the "Draft a new release" button. Only project maintainers are able to perform this step. 3. Then enter the new tag in the "Choose a tag" box. @@ -22,7 +24,8 @@ 6. You can optionally include any particular thank-you's to contributors or reviewers in a note at the bottom of the release. 7. You can then click "publish release." -8. If [the CI][ci] run is [successful][actions], then the release will be published on both +8. If [the CI][ci] run is [successful][actions], + then the release will be published on both the GitHub release page and also the [Python Package Index][pypi]. [semver]: https://semver.org/ From 8ae08c277700661122670f1935243e9ea3ac2a57 Mon Sep 17 00:00:00 2001 From: Arthit Suriyawongkul Date: Tue, 11 Feb 2025 03:45:01 +0700 Subject: [PATCH 3/6] [cd build] Update contributing guide Signed-off-by: Arthit Suriyawongkul --- CONTRIBUTING.md | 48 ++++++++++++++++++++++++++++++++---------------- 1 file changed, 32 insertions(+), 16 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 0e5b089d7..fe113c854 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -7,27 +7,42 @@ Please refer to our [Contributor Covenant Code of Conduct](https://github.com/Py ## Issue Report and Discussion - Discussion: -- GitHub issues (for problems and suggestions): -- Facebook group (not specific to PyThaiNLP, for Thai NLP discussion in general): +- GitHub issues (for problems and suggestions): + +- Facebook group (for general Thai NLP discussion, not specific to PyThaiNLP): + ## Code ## Code Guidelines -- Follow [PEP8](http://www.python.org/dev/peps/pep-0008/), use [black](https://github.com/ambv/black) with `--line-length` = 79; -- Name identifiers (variables, classes, functions, module names) with meaningful - and pronounceable names (`x` is always wrong); - - Please follow this [naming convention](https://namingconvention.org/python/). For example, global constant variables must be in `ALL_CAPS`; - ![Naming Convention](https://i.stack.imgur.com/uBr10.png) -- Write tests for your new features. The test suite is in `tests/` directory. (see "Testing" section below); +- Follow [PEP8][pep8], use [black][black] with `--line-length` = 79; +- Name identifiers (variables, classes, functions, module names) + with meaningful and pronounceable names (`x` is always wrong); + - Please follow this [naming convention][naming]. + For example, global constant variables must be in `ALL_CAPS`; + ![Naming Convention](https://i.stack.imgur.com/uBr10.png) +- Write tests for your new features. The test suite is in `tests/` directory. + (see "Testing" section below); - Run all tests before pushing (just execute `tox`) so you will know if your changes broke something; -- Commented out codes are [dead - codes](http://www.codinghorror.com/blog/2008/07/coding-without-comments.html); -- All `#TODO` comments should be turned into [issues](https://github.com/pythainlp/pythainlp/issues) in GitHub; -- When appropriate, use [f-string](https://www.python.org/dev/peps/pep-0498/) - (use `f"{a} = {b}"`, instead of `"{} = {}".format(a, b)` and `"%s = %s' % (a, b)"`); -- All text files, including source codes, must end with one empty line. This is [to please git](https://stackoverflow.com/questions/5813311/no-newline-at-end-of-file#5813359) and [to keep up with POSIX standard](https://stackoverflow.com/questions/729692/why-should-text-files-end-with-a-newline). +- Commented out codes are [dead codes][dead-codes]; +- All `#TODO` comments should be turned into [issues][issues] in GitHub; +- When appropriate, use [f-string][pep0498] + (use `f"{a} = {b}"`, + instead of `"{} = {}".format(a, b)` and `"%s = %s' % (a, b)"`); +- All text files, including source codes, must end with one empty line. + This is [to please Git][empty-line] and + [to keep up with POSIX standard][posix]. + +[pep8]: http://www.python.org/dev/peps/pep-0008/ +[black]: https://github.com/ambv/black +[naming]: https://namingconvention.org/python/ +[pep0498]: https://www.python.org/dev/peps/pep-0498/ +[dead-codes]: http://www.codinghorror.com/blog/2008/07/coding-without-comments.html +[issues]: https://github.com/pythainlp/pythainlp/issues +[empty-line]: https://stackoverflow.com/questions/5813311/no-newline-at-end-of-file#5813359 +[posix]: https://stackoverflow.com/questions/729692/why-should-text-files-end-with-a-newline ### Version Control System @@ -42,12 +57,13 @@ so it may be a good idea to familiarize yourself with it. ### Pull Request -- We use the famous [gitflow](http://nvie.com/posts/a-successful-git-branching-model/) -to manage our branches. +- We use the famous [gitflow][] to manage our branches. - When you create pull requests on GitHub, GitHub Actions will run tests and several checks automatically. Click the "Details" link at the end of each check to see what needs to be fixed. +[gitflow]: http://nvie.com/posts/a-successful-git-branching-model/ + ## Documentation - We use [Sphinx](https://www.sphinx-doc.org/en/master/) to generate API document From e9684fa151aeb4d21e0ed31a432e605cbccf54cd Mon Sep 17 00:00:00 2001 From: Arthit Suriyawongkul Date: Tue, 11 Feb 2025 11:34:06 +0700 Subject: [PATCH 4/6] Add back pypi-publish triggers [ci build] Signed-off-by: Arthit Suriyawongkul --- .github/workflows/pypi-publish.yml | 9 ++++++++- release.md | 2 +- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/.github/workflows/pypi-publish.yml b/.github/workflows/pypi-publish.yml index f3a27c644..7f42b651a 100644 --- a/.github/workflows/pypi-publish.yml +++ b/.github/workflows/pypi-publish.yml @@ -5,8 +5,15 @@ name: Build and publish to PyPI on: + push: # Use together with "[cd build]" commit message + branches: + - dev + pull_request: # Use together with "[cd build]" commit message + branches: + - dev release: - types: [published] + types: [published] # "Publish release" button + workflow_dispatch: # Manual trigger to test wheel build jobs: echo_github_env: diff --git a/release.md b/release.md index 5b010abb4..dc836786f 100644 --- a/release.md +++ b/release.md @@ -23,7 +23,7 @@ 5. The click the "Generate release notes" button. 6. You can optionally include any particular thank-you's to contributors or reviewers in a note at the bottom of the release. -7. You can then click "publish release." +7. You can then click "Publish release" button. 8. If [the CI][ci] run is [successful][actions], then the release will be published on both the GitHub release page and also the [Python Package Index][pypi]. From 73703deb538101272c9fea9b751a727e24111cb1 Mon Sep 17 00:00:00 2001 From: Arthit Suriyawongkul Date: Tue, 11 Feb 2025 12:17:19 +0700 Subject: [PATCH 5/6] [cd build] Update release.md Signed-off-by: Arthit Suriyawongkul --- release.md | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/release.md b/release.md index dc836786f..1c4ef5b53 100644 --- a/release.md +++ b/release.md @@ -12,19 +12,20 @@ - `README.md` - `README.TH.md` - `CHANGELOG.md` -2. Navigate to the - [releases page][releases] and - click the "Draft a new release" button. +2. Navigate to the [releases page][releases] and click the + "Draft a new release" button. Only project maintainers are able to perform this step. 3. Then enter the new tag in the "Choose a tag" box. The tag should begin with "v", as in, for instance, `v5.0.1`. 4. The release title should be the same as the new version tag. For instance, the title could be `v5.0.1`. -5. The click the "Generate release notes" button. -6. You can optionally include any particular thank-you's to contributors or +5. Add a short summary of important changes in this release. + For example, deprecation or termination of support. +6. Then click the "Generate release notes" button. +7. You can optionally include any particular thank-you's to contributors or reviewers in a note at the bottom of the release. -7. You can then click "Publish release" button. -8. If [the CI][ci] run is [successful][actions], +8. You can then click "Publish release" button. +9. If [the CI][ci] run is [successful][actions], then the release will be published on both the GitHub release page and also the [Python Package Index][pypi]. From 1b07d9f8d1687cff2fe449987f6f5bf1ad14c646 Mon Sep 17 00:00:00 2001 From: Arthit Suriyawongkul Date: Tue, 11 Feb 2025 12:28:32 +0700 Subject: [PATCH 6/6] Update release.md [cd build] Signed-off-by: Arthit Suriyawongkul --- CHANGELOG.md | 5 +++-- CONTRIBUTING.md | 6 ++++++ release.md | 23 +++++++++++++++-------- 3 files changed, 24 insertions(+), 10 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9f9893dd1..9bdf7f624 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,7 @@ --- -SPDX-FileCopyrightText: 2024 PyThaiNLP Project -SPDX-License-Identifier: Apache-2.0 +SPDX-FileCopyrightText: 2025 PyThaiNLP Project +SPDX-FileType: DOCUMENTATION +SPDX-License-Identifier: CC0-1.0 --- # Changelog diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index fe113c854..87d06b780 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -1,3 +1,9 @@ +--- +SPDX-FileCopyrightText: 2025 PyThaiNLP Project +SPDX-FileType: DOCUMENTATION +SPDX-License-Identifier: CC0-1.0 +--- + # Contributing to PyThaiNLP Hi! Thanks for your interest in contributing to [PyThaiNLP](https://github.com/PyThaiNLP/pythainlp). diff --git a/release.md b/release.md index 3507b16a8..d441392e3 100644 --- a/release.md +++ b/release.md @@ -1,8 +1,16 @@ +--- +SPDX-FileCopyrightText: 2025 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. This project follows [semantic versioning][semver]. +1. Update `CHANGELOG.md` with a short summary of important changes since + the previous release. For example, deprecation or termination of support. +2. This project follows [semantic versioning][semver]. Ensure the version and release date fields (if any) in these files have been updated to the version of the new planned release: - `codemeta.json` @@ -13,17 +21,16 @@ - `CITATION.cff` - `README.md` - `README.TH.md` -2. Navigate to the [releases page][releases] and click the +3. Navigate to the [releases page][releases] and click the "Draft a new release" button. Only project maintainers are able to perform this step. -3. Then enter the new tag in the "Choose a tag" box. +4. Then enter the new tag in the "Choose a tag" box. The tag should begin with "v", as in, for instance, `v5.0.1`. -4. The release title should be the same as the new version tag. +5. The release title should be the same as the new version tag. For instance, the title could be `v5.0.1`. -5. Add a short summary of important changes in this release. - For example, deprecation or termination of support. - This should be similar to what have been logged in `CHANGELOG.md`. -6. Then click the "Generate release notes" button. +6. Add a short summary of important changes in this release. + _This should be similar to what have been logged in `CHANGELOG.md`._ + Then click the "Generate release notes" button. 7. You can optionally include any particular thank-you's to contributors or reviewers in a note at the bottom of the release. 8. You can then click "Publish release" button.