Developper guide#
Installation#
Create environment#
We recommend using conda
conda create -n pysirta python=3.12
conda activate pysirta
On IPSL mesocentre
# load latest python envs
module load pangeo-meso/2024.01.22
# create directory for python envs
mkdir -p /homedata/$USER/python_envs
conda create -p /homedata/$USER/python_envs/pysirta python=3.12
Install pySIRTA#
Clone repository
git clone git@gitlab.in2p3.fr:ipsl/sirta/pysirta cd pysirta
Install dependencies
pip install .[dev,docs]
Install pre-commits
pre-commit install pre-commit install --hook-type commit-msg
Configuraing vscode#
Recommended extensions:
python
Mypy Type Checker
ruff
Commits#
Use the conventional commits format for your commit message. The documentation is availabe here.
Quality checks#
Ruff#
If you use vscode, you can use the ruff extension. The problems detected by ruff will be displayed.
Pre-commit#
Each time you commit, pre-commit will run the checks defined in .pre-commit-config.yaml
.
The pre-commit may change the files you are trying to commit. If it does, you will need to add the changes before you are able to commit.
Mypy#
The project is configure to use mypy to check types.
Running tests#
pytest
Development process#
Create a new branch
git switch -c feature/my_feature
Write code
Write tests
Run the tests
Update the documentation
Commit changes
Push branch
Create a merge request of your branch to
main
Documentation#
The documentation use sphinx with Myst parser. To view the documentation locally, run:
cd docs
sphinx-autobuild source build
Create a relase#
On the
main
branchMake sure the tests pass
Make sure your environment is clean
Generate changelog
generate-changelog
Apply pre-commit to make format of the changelog compliant
pre-commit run --all
Bump the version
bump-my-version bump [major|minor|patch]
Push the changes
git push origin main git push --tags