Contribution#
Development#
git clone https://github.com/shenmishajing/lightning_template.git
cd lightning_template
pip install -e ".[dev]"
pre-commit install
Build Documents#
Install the required dependencies for building documents.
pip install -e ".[docs]"
Launch the live server for building and previewing documents.
sphinx-autobuild docs docs/_build
Build Package#
Install the required dependencies for building package.
pip install -e ".[build]"
Build the package.
python -m build
See the github action workflow file python-publish.yml for details.
Code Style and Git Hooks#
The code is formatted and linted by ruff. The docstring is in Google style and formatted by docformatter. The spelling is checked by codespell. All commit messages should follow the conventional commits style to generate the changelog and semantic version automatically.
All the above requirements are checked by pre-commit hooks. You can install them by pre-commit install after you clone the repo. See the pre-commit config file for details.
Version, Tag and Release#
We use commitizen to bump the semantic version, create tags and generate the changelog automatically according to the commit messages. Then, setuptools_scm is used to generate the version number from the tags. Therefore, all commit messages should follow the conventional commits style to facilitate the version management tools.
Fortunately, the commitizen can be used to generate the commit messages in the conventional commits style. The whole process of contribution is as follows:
Install commitizen. You can install it by
pip install commitizen, or if you have installed the[dev]extra dependencies, you can skip this step since commitizen has already been included in the[dev]extra dependencies. Or if you are using vscode, you can install the vscode-commitizen extension.Make changes.
Commit changes. Then you can use
cz committo commit your changes. It will guide you to write the commit message in the conventional commits style.Bump version (Optional). If you have made some commits related to codes with
feat,fix,refactor,perforBREAKING CHANGEcategory, you can usecz bumpto bump the version and generate the changelog automatically.Push changes. Then you can push your changes to the remote repo. If you have bumped the version, you should push the tags to the remote repo by
git push --tags.