Skip to content

Commit eaa654c

Browse files
authored
Update CONTRIBUTING.md to enhance development guidelines (#824)
Same as line/line-bot-sdk-php#715
1 parent e98fa7d commit eaa654c

File tree

2 files changed

+68
-65
lines changed

2 files changed

+68
-65
lines changed

CONTRIBUTING.md

Lines changed: 68 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,76 @@
1-
## How to contribute to LINE Bot SDK for Python project
1+
# How to contribute to LINE Bot SDK for Python project
22

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:
56

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__).
99
- Contribute your work by sending [a pull request](https://github.com/line/line-bot-sdk-python/pulls).
1010

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
1273

1374
When you are sending a pull request and it's a non-trivial change beyond fixing typos, please make sure to sign
1475
[the ICLA (individual contributor license agreement)](https://cla-assistant.io/line/line-bot-sdk-python). Please
1576
[contact us](mailto:dl_oss_dev@linecorp.com) if you need the CCLA (corporate contributor license agreement).
16-

README.rst

Lines changed: 0 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -376,63 +376,6 @@ Contributing
376376
------------
377377
Please check `CONTRIBUTING <CONTRIBUTING.md>`__ before making a contribution.
378378

379-
For SDK developers
380-
------------------
381-
382-
First install for development.
383-
384-
::
385-
386-
$ pip install -r requirements-dev.txt
387-
388-
389-
You can generate new or fixed models and APIs by this command.
390-
391-
::
392-
393-
$ python generate-code.py
394-
395-
396-
When you update line-bot-sdk-python version, please update `linebot/__about__.py <linebot/__about__.py>`__ and generate code again.
397-
398-
399-
If you edit `README.rst <README.rst>`__, you should execute the following command to check the syntax of README.
400-
401-
::
402-
403-
$ python -m readme_renderer README.rst
404-
405-
406-
Run tests
407-
~~~~~~~~~
408-
409-
Test by using tox. We test against the following versions.
410-
411-
- 3.9
412-
- 3.10
413-
- 3.11
414-
- 3.12
415-
- 3.13
416-
417-
To run all tests and to run ``flake8`` against all versions, use:
418-
419-
::
420-
421-
tox
422-
423-
To run all tests against version 3.10, use:
424-
425-
::
426-
427-
$ tox -e py3.10
428-
429-
To run a test against version 3.10 and against a specific file, use:
430-
431-
::
432-
433-
$ tox -e py3.10 -- tests/test_webhook.py
434-
435-
436379
.. |PyPI version| image:: https://badge.fury.io/py/line-bot-sdk.svg
437380
:target: https://badge.fury.io/py/line-bot-sdk
438381

0 commit comments

Comments
 (0)