You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

develop.md 3.1 kB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. # Develop
  2. ## 1. Code Style
  3. We adopt [PEP8](https://www.python.org/dev/peps/pep-0008/) as the preferred code style.
  4. We use the following toolsseed isortseed isortseed isort for linting and formatting:
  5. - [flake8](http://flake8.pycqa.org/en/latest/): linter
  6. - [yapf](https://github.com/google/yapf): formatter
  7. - [isort](https://github.com/timothycrosley/isort): sort imports
  8. Style configurations of yapf and isort can be found in [setup.cfg](../../setup.cfg).
  9. We use [pre-commit hook](https://pre-commit.com/) that checks and formats for `flake8`, `yapf`, `seed-isort-config`, `isort`, `trailing whitespaces`,
  10. fixes `end-of-files`, sorts `requirments.txt` automatically on every commit.
  11. The config for a pre-commit hook is stored in [.pre-commit-config](../../.pre-commit-config.yaml).
  12. After you clone the repository, you will need to install initialize pre-commit hook.
  13. ```bash
  14. pip install -r requirements/tests.txt
  15. ```
  16. From the repository folder
  17. ```bash
  18. pre-commit install
  19. ```
  20. After this on every commit check code linters and formatter will be enforced.
  21. If you want to use pre-commit to check all the files, you can run
  22. ```bash
  23. pre-commit run --all-files
  24. ```
  25. If you only want to format and lint your code, you can run
  26. ```bash
  27. make linter
  28. ```
  29. ## 2. Test
  30. ### 2.1 Unit test
  31. ```bash
  32. make test
  33. ```
  34. ### 2.2 Test data
  35. TODO
  36. ## Code Review
  37. 1. Run following command to create an aone CR, replace `TARGET_BRANCH` and `CR_NAME` with the one you want.
  38. ```shell
  39. git push origin HEAD:refs/for/TARGET_BRANCH/CR_NAME
  40. ```
  41. Please refer to [https://yuque.antfin.com/aone/platform/lcg8yr](https://yuque.antfin.com/aone/platform/lcg8yr) for more details.
  42. The following output is expected.
  43. ```shell
  44. Counting objects: 5, done.
  45. Delta compression using up to 96 threads.
  46. Compressing objects: 100% (5/5), done.
  47. Writing objects: 100% (5/5), 543 bytes | 0 bytes/s, done.
  48. Total 5 (delta 4), reused 0 (delta 0)
  49. remote: +------------------------------------------------------------------------+
  50. remote: | Merge Request #8949062 was created or updated. |
  51. remote: | View merge request at URL: |
  52. remote: | https://code.aone.alibaba-inc.com/Ali-MaaS/MaaS-lib/codereview/8949062 |
  53. remote: +------------------------------------------------------------------------+
  54. To git@gitlab.alibaba-inc.com:Ali-MaaS/MaaS-lib.git
  55. * [new branch] HEAD -> refs/for/master/support_kwargs_pipeline
  56. ```
  57. 2. Open the remote url `https://code.aone.alibaba-inc.com/Ali-MaaS/MaaS-lib/codereview/ID` and edit the title of CR with following format before merging your code:
  58. * Feature
  59. ```shell
  60. [to #AONE_ID] feat: commit title
  61. Link: https://code.alibaba-inc.com/Ali-MaaS/MaaS-lib/codereview/8949062
  62. * commit msg1
  63. * commit msg2
  64. ```
  65. * Bugfix
  66. ```shell
  67. [to #AONE_ID] fix: commit title
  68. Link: https://code.alibaba-inc.com/Ali-MaaS/MaaS-lib/codereview/8949062
  69. * commit msg1
  70. * commit msg2
  71. ```
  72. ## Build pip package
  73. ```bash
  74. make whl
  75. ```

致力于通过开放的社区合作,开源AI模型以及相关创新技术,推动基于模型即服务的生态繁荣发展