Check the Development Installation document for how to install the project and all required packages.
This project leverages pixi to manage the dependencies and environments, which provides a lock file to help users install your project and all required packages with the same version as you have. However, maybe someone prefer to use conda environment to install your project and all required packages. If you want to spread out your project with specific conda environment, you may need a conda.yml to help users to create the same environment as you have. You can use the following command to export your conda environment to the conda.yml.
Make sure you are in the correct conda environment before you run the following command.
You can enter the correct conda environment now by:
```bash
conda activate <env_name>
```
conda env export --no-builds | grep -v "prefix" > requirements/conda.ymlPre-commit hooks are used to automatically format, lint your commit and check your commit messages. You can refer to Code Style and Git Hooks document on how to use them. You can also add or remove the pre-commit hooks in the .pre-commit-config.yaml file, if you want.
We leverage pytest and pytest-cov to run the unit tests and generate the coverage report. You can refer to Unit tests document on how to use them to run the unit tests and generate the coverage report. We recommend you to add unit tests under the tests folder for each module you write to make your code more robust.
If you want to run the unit tests and generate the coverage report for each commit automatically, you have to follow the following steps:
- [Optional if your repo is public] Setup up your project on codecov and set up the
CODECOV_TOKENsecret for your project. You can skip this step if your project is public since the upload action of codecov supports tokenless upload for public repo now. But if your project is private, it's required to set up theCODECOV_TOKENsecret for your project. - [Optional] Enable the multi-version unit tests job
unit-tests-python-versionby uncommenting it in the.github/workflows/unit_tests.ymlfile. You can also add more versions or remove them if you want. - Add unit tests in the
testsfolder following the pytest style. Commit your changes and push them to the remote repo. - Enable flag analysis in the
Flagssetting of your project on codecov. - Done. You can see the test results and coverage reports in the codecov dashboard.
We recommend you follow the conventional commit style for commit messages. You can refer to Version, Tag and Release document on how to write the commit messages more easily and how to use them to generate the changelog and semantic version automatically.
If you want to publish your project as a python package and also generate github release automatically, you have to follow the following steps:
- Make up a new name for your project.
- Modify the
project.nameandproject.authorsinpyproject.tomland rename thesrc/projectfolder. - Add any content you want in the
srcfolder. - Move the
.github/examples/release.ymland.github/examples/pre_release.ymlto the.github/workflowsfolder. - Commit your changes following the conventional commit style.
- Bump version by commitizen using the
cz bumpcommand. A changelog file will be generated in thedocs/get_startedfolder automatically according to your commit messages. - Add your project as a publisher on PyPI and TestPyPI respectively. You should set up the
release.ymlfor PyPI and thepre_release.ymlfor TestPyPI. - Push your changes and tags to the remote repo.
If you want to build a documentation site for your project, you have to follow the following steps:
- Import your project from readthedocs.
- In
Admin > Automation Rulesof the Setting of your project, add a new rule to automatically activate the new version when a new tag is published. TheMatchof the rule should beSemVer versions. TheVersion typeshould betagand theActionshould beActivate version. - Make a new name
<project_name>for your project. - Modify the
project.nameandproject.authorsinpyproject.toml. - Modify the API document index path in
docs/index.mdfromautoapi/project/indextoautoapi/<project_name>/index. - Rewrite an introduction in
README.mdand copy it todocs/index.mdto replace the original introduction. - [Optional] Write the Usage in
docs/get_started/usage.md. Add more docs as you want to thedocs/folder and update thetoctreeindocs/index.md. - Commit the changes and push them to the remote repo.
- Done. You have successfully deployed the documentation of your project, and you can see a new version when you push a new tag to the remote repo.