|
1 |
| -## How to contribute to LINE Bot SDK for Python project |
| 1 | +# How to contribute to LINE Bot SDK for Python project |
2 | 2 |
|
3 |
| -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 |
4 |
| -source projects you are aware of. It will be amazing if you could help us by doing any of the following: |
| 3 | +First of all, thank you so much for taking your time to contribute! |
| 4 | +LINE Bot SDK for Python is not very different from any other open source projects you are aware of. |
| 5 | +It will be amazing if you could help us by doing any of the following: |
5 | 6 |
|
6 |
| -- File an issue in [the issue tracker](https://github.com/line/line-bot-sdk-python/issues) to report bugs and propose new features and |
7 |
| - improvements. |
8 |
| -- Ask a question using [the issue tracker](https://github.com/line/line-bot-sdk-python/issues). |
| 7 | +- 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. |
| 8 | +- Ask a question using [the issue tracker](https://github.com/line/line-bot-sdk-python/issues) (__Please ask only about this SDK__). |
9 | 9 | - Contribute your work by sending [a pull request](https://github.com/line/line-bot-sdk-python/pulls).
|
10 | 10 |
|
11 |
| -### Contributor license agreement |
| 11 | +## Development |
| 12 | + |
| 13 | +### Install dependencies |
| 14 | + |
| 15 | +Run `pip install -r requirements-dev.txt` to install all dependencies for development and testing. |
| 16 | + |
| 17 | +### Understand the project structure |
| 18 | + |
| 19 | +The project structure is as follows: |
| 20 | + |
| 21 | +- `linebot`: The main library code. |
| 22 | +- `tests`: Test code. |
| 23 | +- `examples`: Example projects that use the library. |
| 24 | +- `generator`: Custom OpenAPI generator for Python code. |
| 25 | +- `tools`: Development tools. |
| 26 | +- `docs`: Documentation files for Sphinx. |
| 27 | + |
| 28 | +### Edit OpenAPI templates |
| 29 | + |
| 30 | +Most of the API client code is generated with OpenAPI Generator based on [line-openapi](https://github.com/line/line-openapi)'s YAML files. |
| 31 | +You cannot edit almost all code under `linebot/v3/` directly. |
| 32 | + |
| 33 | +If you need to change the generated code, you should modify the custom templates under: |
| 34 | +- `generator/src/main/resources/python-nextgen-custom-client/` |
| 35 | + |
| 36 | +After editing the templates, run `python generate-code.py` to regenerate the code, and then commit all affected files. |
| 37 | +If not, CI status will fail. |
| 38 | + |
| 39 | +When you update code, be sure to check consistencies between generated code and your changes. |
| 40 | + |
| 41 | +### Add unit tests |
| 42 | + |
| 43 | +We use [pytest](https://pytest.org/) for unit tests. |
| 44 | +Please add tests to the appropriate test directories to verify your changes. |
| 45 | + |
| 46 | +Especially for bug fixes, please follow this flow for testing and development: |
| 47 | +1. Write a test before making changes to the library and confirm that the test fails. |
| 48 | +2. Modify the code of the library. |
| 49 | +3. Run the test again and confirm that it passes thanks to your changes. |
| 50 | + |
| 51 | +### Run your code in your local environment |
| 52 | + |
| 53 | +You can use the [example projects](examples/) to test your changes locally before submitting a pull request. |
| 54 | + |
| 55 | +### Run CI tasks in your local environment |
| 56 | + |
| 57 | +Test by using tox. |
| 58 | +To run all tests and to run flake8 against all versions, use: `tox` |
| 59 | + |
| 60 | +To run all tests against version 3.10, use: `tox -e py3.10` |
| 61 | + |
| 62 | +To run a test against version 3.10 and against a specific file, use: `tox -e py3.10 -- tests/test_webhook.py` |
| 63 | + |
| 64 | +### Documentation |
| 65 | + |
| 66 | +If you edit README.rst, you should execute the following command to check the syntax of README. |
| 67 | + |
| 68 | +``` |
| 69 | +python -m readme_renderer README.rst |
| 70 | +``` |
| 71 | + |
| 72 | +## Contributor license agreement |
12 | 73 |
|
13 | 74 | When you are sending a pull request and it's a non-trivial change beyond fixing typos, please make sure to sign
|
14 | 75 | [the ICLA (individual contributor license agreement)](https://cla-assistant.io/line/line-bot-sdk-python). Please
|
15 | 76 | [contact us](mailto:dl_oss_dev@linecorp.com) if you need the CCLA (corporate contributor license agreement).
|
16 |
| - |
|
0 commit comments