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.

dev.rst 2.9 kB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. .. _dev:
  2. ================
  3. For Developer
  4. ================
  5. Install with Dev Mode
  6. =======================
  7. As a developer, you often want make changes to ``learnware`` and hope it would reflect directly in your environment without reinstalling it. You can install ``learnware`` in editable mode with following command.
  8. .. code-block:: bash
  9. $ git clone https://github.com/Learnware-LAMDA/Learnware.git && cd Learnware
  10. $ pip install -e .[dev]
  11. .. note::
  12. It's recommended to use anaconda/miniconda to setup the environment. Also you can run ``pip install -e .[full, dev]`` to install ``torch`` automatically.
  13. Commit Format
  14. ==============
  15. Please submit in the following manner: Submit using the format ``prefix`` + ``space`` + ``suffix``.
  16. There are four choices for the prefix, and they can be combined using commas:
  17. - [ENH]: Represents enhancement, indicating the addition of new features.
  18. - [DOC]: Indicates modifications to the documentation.
  19. - [FIX]: Represents bug fixes and typo corrections.
  20. - [MNT]: Indicates other minor modifications, such as version updates.
  21. The suffix specifies the specific nature of the modification, with the initial letter capitalized.
  22. Examples: The following are all valid:
  23. - [DOC] Fix the document
  24. - [FIX, ENH] Fix the bug and add some features
  25. Docstring
  26. ============
  27. Please use the `Numpydoc Style <https://stackoverflow.com/a/24385103>`_.
  28. You can fix the bug by inputting the following code in the command line.
  29. Continuous Integration
  30. ======================
  31. Continuous Integration (CI) tools help you stick to the quality standards by running tests every time you push a new commit and reporting the results to a pull request.
  32. This project will check the following tests when you pull a request:
  33. 1. We will check your code length, you can fix your code style by the following commands:
  34. .. code-block:: bash
  35. pip install black
  36. python -m black . -l 120
  37. 2. We will check the pytest, you commit should can pass all tests in the tests directory. Run the following commands to check:
  38. .. code-block:: bash
  39. pip install pytest
  40. python -m pytest tests
  41. ``pre-commit`` Config
  42. ========================
  43. The ``learnware`` package support config ``pre-commit``. Run the following command to install ``pre-commit``:
  44. .. code-block:: bash
  45. pip install pre-commit
  46. Run the following command in the root directory of ``Learnware`` Project to enable ``pre-commit``:
  47. .. code-block:: bash
  48. pre-commit install
  49. ``isort`` Config
  50. ===================
  51. The codes in the ``learnware`` package will be processed by ``isort`` (``examples`` and ``tests`` are excluded). Run the following command to install ``isort``:
  52. .. code-block:: bash
  53. pip install isort
  54. Run the following command in the root directory of ``Learnware`` Project to run ``isort``:
  55. .. code-block:: bash
  56. isort learnware --reverse-relative