From 660ba4593ecf44608201fd784161e54953a75e45 Mon Sep 17 00:00:00 2001 From: Euchi Yuta Date: Mon, 14 Jul 2025 18:54:58 +0900 Subject: [PATCH 1/2] Update CONTRIBUTING.md to enhance development guidelines --- CONTRIBUTING.md | 76 +++++++++++++++++++++++++++++++++++++++++++------ 1 file changed, 68 insertions(+), 8 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 87fef766b..1ee05fbc3 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -1,16 +1,76 @@ -## How to contribute to LINE Bot SDK for Python project +# How to contribute to LINE Bot SDK for Python project -First of all, thank you so much for taking your time to contribute! LINE Bot SDK for Python is not very different from any other open -source projects you are aware of. It will be amazing if you could help us by doing any of the following: +First of all, thank you so much for taking your time to contribute! +LINE Bot SDK for Python is not very different from any other open source projects you are aware of. +It will be amazing if you could help us by doing any of the following: -- File an issue in [the issue tracker](https://github.com/line/line-bot-sdk-python/issues) to report bugs and propose new features and - improvements. -- Ask a question using [the issue tracker](https://github.com/line/line-bot-sdk-python/issues). +- File an issue in [the issue tracker](https://github.com/line/line-bot-sdk-python/issues) to report bugs and propose new features and improvements. +- Ask a question using [the issue tracker](https://github.com/line/line-bot-sdk-python/issues) (__Please ask only about this SDK__). - Contribute your work by sending [a pull request](https://github.com/line/line-bot-sdk-python/pulls). -### Contributor license agreement +## Development + +### Install dependencies + +Run `pip install -r requirements-dev.txt` to install all dependencies for development and testing. + +### Understand the project structure + +The project structure is as follows: + +- `linebot`: The main library code. +- `tests`: Test code. +- `examples`: Example projects that use the library. +- `generator`: Custom OpenAPI generator for Python code. +- `tools`: Development tools. +- `docs`: Documentation files for Sphinx. + +### Edit OpenAPI templates + +Most of the API client code is generated with OpenAPI Generator based on [line-openapi](https://github.com/line/line-openapi)'s YAML files. +You cannot edit almost all code under `linebot/v3/` directly. + +If you need to change the generated code, you should modify the custom templates under: +- `generator/src/main/resources/python-nextgen-custom-client/` + +After editing the templates, run `python generate-code.py` to regenerate the code, and then commit all affected files. +If not, CI status will fail. + +When you update code, be sure to check consistencies between generated code and your changes. + +### Add unit tests + +We use [pytest](https://pytest.org/) for unit tests. +Please add tests to the appropriate test directories to verify your changes. + +Especially for bug fixes, please follow this flow for testing and development: +1. Write a test before making changes to the library and confirm that the test fails. +2. Modify the code of the library. +3. Run the test again and confirm that it passes thanks to your changes. + +### Run your code in your local environment + +You can use the [example projects](examples/) to test your changes locally before submitting a pull request. + +### Run CI tasks in your local environment + +Test by using tox. +To run all tests and to run flake8 against all versions, use: `tox` + +To run all tests against version 3.10, use: `tox -e py3.10` + +To run a test against version 3.10 and against a specific file, use: `tox -e py3.10 -- tests/test_webhook.py` + +### Documentation + +If you edit README.rst, you should execute the following command to check the syntax of README. + +``` +python -m readme_renderer README.rst +``` + +## Contributor license agreement When you are sending a pull request and it's a non-trivial change beyond fixing typos, please make sure to sign [the ICLA (individual contributor license agreement)](https://cla-assistant.io/line/line-bot-sdk-python). Please [contact us](mailto:dl_oss_dev@linecorp.com) if you need the CCLA (corporate contributor license agreement). - From 18af228992b3d1c7e9bc496cf803f55aec66af02 Mon Sep 17 00:00:00 2001 From: Euchi Yuta Date: Mon, 14 Jul 2025 18:59:25 +0900 Subject: [PATCH 2/2] Fix README.rst --- README.rst | 57 ------------------------------------------------------ 1 file changed, 57 deletions(-) diff --git a/README.rst b/README.rst index 2d01892b5..20bfd1992 100644 --- a/README.rst +++ b/README.rst @@ -376,63 +376,6 @@ Contributing ------------ Please check `CONTRIBUTING `__ before making a contribution. -For SDK developers ------------------- - -First install for development. - -:: - - $ pip install -r requirements-dev.txt - - -You can generate new or fixed models and APIs by this command. - -:: - - $ python generate-code.py - - -When you update line-bot-sdk-python version, please update `linebot/__about__.py `__ and generate code again. - - -If you edit `README.rst `__, you should execute the following command to check the syntax of README. - -:: - - $ python -m readme_renderer README.rst - - -Run tests -~~~~~~~~~ - -Test by using tox. We test against the following versions. - -- 3.9 -- 3.10 -- 3.11 -- 3.12 -- 3.13 - -To run all tests and to run ``flake8`` against all versions, use: - -:: - - tox - -To run all tests against version 3.10, use: - -:: - - $ tox -e py3.10 - -To run a test against version 3.10 and against a specific file, use: - -:: - - $ tox -e py3.10 -- tests/test_webhook.py - - .. |PyPI version| image:: https://badge.fury.io/py/line-bot-sdk.svg :target: https://badge.fury.io/py/line-bot-sdk